summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-02 20:30:30 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-02 20:30:30 +0200
commit264f02e1c2bd3039944c3f4978f01550716fc078 (patch)
treee37440baffd1174f56ffa5dd6f2c6cdd48a63831 /src
parent35c23e3d20a976de9736dff9c587a8f0408bf01a (diff)
downloadtwinkle-264f02e1c2bd3039944c3f4978f01550716fc078.tar
twinkle-264f02e1c2bd3039944c3f4978f01550716fc078.tar.gz
twinkle-264f02e1c2bd3039944c3f4978f01550716fc078.tar.lz
twinkle-264f02e1c2bd3039944c3f4978f01550716fc078.tar.xz
twinkle-264f02e1c2bd3039944c3f4978f01550716fc078.zip
Ported Q3Process and Q3ProgressDialog
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.cpp158
-rw-r--r--src/gui/gui.h4
-rw-r--r--src/gui/main.cpp1
3 files changed, 82 insertions, 81 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c383472..4f90132 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -67,7 +67,7 @@
#include "q3listbox.h"
#include "qmessagebox.h"
#include "qpixmap.h"
-#include "q3process.h"
+#include <QProcess>
#include "qpushbutton.h"
#include "qsize.h"
#include "qsizepolicy.h"
@@ -2031,25 +2031,82 @@ void t_gui::cb_stun_failed(t_user *user_config) {
bool t_gui::cb_ask_user_to_redirect_invite(t_user *user_config, const t_url &destination,
const string &display)
{
+ bool retval;
+ QMetaObject::invokeMethod(this, "do_cb_ask_user_to_redirect_invite", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, retval), Q_ARG(t_user*, user_config),
+ Q_ARG(const t_url&, destination), Q_ARG(const string&, display));
+
+ return retval;
+}
+
+bool t_gui::cb_ask_user_to_redirect_request(t_user *user_config,
+ const t_url &destination,
+ const string &display, t_method method)
+{
+ bool retval;
+ QMetaObject::invokeMethod(this, "do_cb_ask_user_to_redirect_request", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, retval), Q_ARG(t_user*, user_config),
+ Q_ARG(const t_url&, destination), Q_ARG(const string&, display),
+ Q_ARG(t_method, method));
+
+ return retval;
+}
+
+bool t_gui::do_cb_ask_credentials(t_user *user_config, const string &realm, string &username,
+ string &password)
+{
+ QString user(username.c_str());
+ QString passwd(password.c_str());
+
+ AuthenticationForm *af = new AuthenticationForm(mainWindow, "authentication",
+ true);
+ MEMMAN_NEW(af);
+ if (!af->exec(user_config, QString(realm.c_str()), user, passwd)) {
+ MEMMAN_DELETE(af);
+ delete af;
+ return false;
+ }
+
+ username = user.ascii();
+ password = passwd.ascii();
+ MEMMAN_DELETE(af);
+ delete af;
+
+ return true;
+}
+
+bool t_gui::cb_ask_credentials(t_user *user_config, const string &realm, string &username,
+ string &password)
+{
+ bool retval;
+ QMetaObject::invokeMethod(this, "do_cb_ask_credentials", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, retval), Q_ARG(t_user*, user_config),
+ Q_ARG(const string&, realm), Q_ARG(string&, username),
+ Q_ARG(string&, password));
+
+ return retval;
+}
+
+bool t_gui::do_cb_ask_user_to_redirect_invite(t_user *user_config, const t_url &destination,
+ const string &display)
+{
QString s;
QString title;
-
- lock();
-
+
title = PRODUCT_NAME;
title.append(" - ").append(qApp->translate("GUI", "Redirecting call"));
-
+
s = qApp->translate("GUI", "User profile:").append(" <b>");
s.append(user_config->get_profile_name().c_str());
s.append("</b><br>").append(qApp->translate("GUI", "User:")).append(" <b>");
s.append(str2html(user_config->get_display_uri().c_str()));
s.append("</b><br><br>");
-
+
s.append(qApp->translate("GUI", "Do you allow the call to be redirected to the following destination?"));
s.append("<br><br>");
s.append(str2html(ui->format_sip_address(user_config, display, destination).c_str()));
s.append("<br><br>");
- s.append(qApp->translate("GUI",
+ s.append(qApp->translate("GUI",
"If you don't want to be asked this anymore, then you must change "
"the settings in the SIP protocol section of the user profile."));
QMessageBox *mb = new QMessageBox(title, s,
@@ -2062,31 +2119,26 @@ bool t_gui::cb_ask_user_to_redirect_invite(t_user *user_config, const t_url &des
bool permission = (mb->exec() == QMessageBox::Yes);
MEMMAN_DELETE(mb);
delete mb;
-
- unlock();
-
+
return permission;
}
-bool t_gui::cb_ask_user_to_redirect_request(t_user *user_config,
- const t_url &destination,
- const string &display, t_method method)
+bool t_gui::do_cb_ask_user_to_redirect_request(t_user *user_config, const t_url &destination,
+ const string &display, t_method method)
{
QString s;
QString title;
-
- lock();
-
+
title = PRODUCT_NAME;
title.append(" - ").append(qApp->translate("GUI", "Redirecting request"));
-
+
s = qApp->translate("GUI", "User profile:").append(" <b>");
s.append(user_config->get_profile_name().c_str());
s.append("</b><br>").append(qApp->translate("GUI", "User:")).append(" <b>");
s.append(str2html(user_config->get_display_uri().c_str()));
s.append("</b><br><br>");
-
- s.append(qApp->translate("GUI",
+
+ s.append(qApp->translate("GUI",
"Do you allow the %1 request to be redirected to the following destination?").arg(
method2str(method).c_str()));
s.append("<br><br>");
@@ -2105,57 +2157,8 @@ bool t_gui::cb_ask_user_to_redirect_request(t_user *user_config,
bool permission = (mb->exec() == QMessageBox::Yes);
MEMMAN_DELETE(mb);
delete mb;
-
- unlock();
-
- return permission;
-}
-
-bool t_gui::do_cb_ask_credentials(t_user *user_config, const string &realm, string &username,
- string &password)
-{
- QString user(username.c_str());
- QString passwd(password.c_str());
- AuthenticationForm *af = new AuthenticationForm(mainWindow, "authentication",
- true);
- MEMMAN_NEW(af);
- if (!af->exec(user_config, QString(realm.c_str()), user, passwd)) {
- MEMMAN_DELETE(af);
- delete af;
- return false;
- }
-
- username = user.ascii();
- password = passwd.ascii();
- MEMMAN_DELETE(af);
- delete af;
-
- return true;
-}
-
-bool t_gui::cb_ask_credentials(t_user *user_config, const string &realm, string &username,
- string &password)
-{
- bool retval;
- QMetaObject::invokeMethod(this, "do_cb_ask_credentials", Qt::BlockingQueuedConnection,
- Q_RETURN_ARG(bool, retval), Q_ARG(t_user*, user_config),
- Q_ARG(const string&, realm), Q_ARG(string&, username),
- Q_ARG(string&, password));
-
- return retval;
-}
-
-bool t_gui::do_cb_ask_user_to_redirect_invite(t_user *user_config, const t_url &destination,
- const string &display)
-{
- // TODO
-}
-
-bool t_gui::do_cb_ask_user_to_redirect_request(t_user *user_config, const t_url &destination,
- const string &display, t_method method)
-{
- // TODO
+ return permission;
}
void t_gui::cb_ask_user_to_refer(t_user *user_config, const t_url &refer_to_uri,
@@ -2312,18 +2315,17 @@ void t_gui::cb_missed_call(int num_missed_calls) {
}
void t_gui::cb_nat_discovery_progress_start(int num_steps) {
- natDiscoveryProgressDialog = new Q3ProgressDialog(
+ natDiscoveryProgressDialog = new QProgressDialog(
qApp->translate("GUI", "Firewall / NAT discovery..."),
qApp->translate("GUI", "Abort"),
- num_steps, NULL,
- "nat discovery progress", true);
+ 0, num_steps, mainWindow);
MEMMAN_NEW(natDiscoveryProgressDialog);
natDiscoveryProgressDialog->setCaption(PRODUCT_NAME);
natDiscoveryProgressDialog->setMinimumDuration(200);
}
void t_gui::cb_nat_discovery_progress_step(int step) {
- natDiscoveryProgressDialog->setProgress(step);
+ natDiscoveryProgressDialog->setValue(step);
qApp->processEvents();
}
@@ -2333,7 +2335,7 @@ void t_gui::cb_nat_discovery_finished(void) {
}
bool t_gui::cb_nat_discovery_cancelled(void) {
- return natDiscoveryProgressDialog->wasCancelled();
+ return natDiscoveryProgressDialog->wasCanceled();
}
void t_gui::cb_line_encrypted(int line, bool encrypted, const string &cipher_mode) {
@@ -3053,13 +3055,13 @@ void t_gui::open_url_in_browser(const QString &url) {
}
}
#endif
- Q3Process process;
+ QProcess process;
bool process_started = false;
QStringList browsers;
if (sys_browser.empty()) {
- browsers << "firefox" << "mozilla" << "netscape" << "opera";
+ browsers << "xdg-open" << "firefox" << "mozilla" << "netscape" << "opera";
browsers << "galeon" << "epiphany" << "konqueror";
} else {
browsers << sys_browser.c_str();
@@ -3067,8 +3069,8 @@ void t_gui::open_url_in_browser(const QString &url) {
for (QStringList::Iterator it = browsers.begin(); it != browsers.end(); ++it)
{
- process.setArguments(QStringList() << *it << url);
- process_started = process.start();
+ process.start(*it, QStringList(url));
+ process_started = process.waitForStarted(1000);
if (process_started) break;
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index e184e67..1634a6e 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -31,7 +31,7 @@
#include "qcombobox.h"
#include "qlabel.h"
#include "qlineedit.h"
-#include "q3progressdialog.h"
+#include <QProgressDialog>
#include "qtimer.h"
#include "qtoolbutton.h"
#include "qwidget.h"
@@ -74,7 +74,7 @@ private:
QTimer *timerUpdateMessageSessions;
// Progress dialog for FW/NAT discovery progress bar
- Q3ProgressDialog *natDiscoveryProgressDialog;
+ QProgressDialog *natDiscoveryProgressDialog;
// Pointers to line information fields to display information
QLineEdit *fromLabel;
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index f93d352..cd0ad5b 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -26,7 +26,6 @@
#include <qapplication.h>
#include <qtranslator.h>
#include <qmime.h>
-#include <q3progressdialog.h>
#include <qtextcodec.h>
#include "mphoneform.h"