summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2015-12-15 12:12:27 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2015-12-29 18:00:47 +0000
commit6c42a103e81feef35c9a35571c5866ae644279cc (patch)
tree2e0c390c7d69e7dce8cff03fc0cfdad47da1d24f
parentf145108f5ead2bf764c50e6a6b27ce418d185ea5 (diff)
downloadwireshark-6c42a103e81feef35c9a35571c5866ae644279cc.tar.gz
Qt: Add support of gui.window_title
Ping-Bug: 11102 Bug: 11691 Change-Id: I7b1673ffafcda644f4905265061ba11733dd91d3 Reviewed-on: https://code.wireshark.org/review/12650 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--ui/qt/main_window.cpp25
-rw-r--r--ui/qt/main_window.h3
-rw-r--r--ui/qt/main_window_slots.cpp2
-rw-r--r--wireshark-qt.cpp2
4 files changed, 22 insertions, 10 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 82ec00ef48..1d6adec42a 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -1843,7 +1843,7 @@ void MainWindow::setTitlebarForCaptureFile()
// XXX - on non-Mac platforms, put in the application
// name?
//
- setWindowTitle(QString("[*]%1").arg(cf_get_tempfile_source(capture_file_.capFile())));
+ setWSWindowTitle(QString("[*]%1").arg(cf_get_tempfile_source(capture_file_.capFile())));
} else {
//
// For a user file, set the full path; that way,
@@ -1863,9 +1863,9 @@ void MainWindow::setTitlebarForCaptureFile()
QFileInfo fi(utf8_filename);
if (utf8_filename == NULL) {
// So what the heck else can we do here?
- setWindowTitle(tr("(File name can't be mapped to UTF-8)"));
+ setWSWindowTitle(tr("(File name can't be mapped to UTF-8)"));
} else {
- setWindowTitle(fi.fileName());
+ setWSWindowTitle(fi.fileName());
g_free(utf8_filename);
}
}
@@ -1873,23 +1873,32 @@ void MainWindow::setTitlebarForCaptureFile()
} else {
/* We have no capture file. */
setWindowFilePath(NULL);
- setDefaultWindowTitle();
+ setWSWindowTitle();
}
}
-void MainWindow::setDefaultWindowTitle()
+void MainWindow::setWSWindowTitle(QString title)
{
- setWindowTitle(tr("The Wireshark Network Analyzer"));
+
+ if(title.isEmpty()) {
+ title = tr("The Wireshark Network Analyzer");
+ }
+
+ if((prefs.gui_window_title != NULL) && (*prefs.gui_window_title != '\0')) {
+ title.append(QString(" [%1]").arg(prefs.gui_window_title));
+ }
+
+ setWindowTitle(title);
}
void MainWindow::setTitlebarForCaptureInProgress()
{
setWindowFilePath(NULL);
if (capture_file_.capFile()) {
- setWindowTitle(tr("Capturing from %1").arg(cf_get_tempfile_source(capture_file_.capFile())));
+ setWSWindowTitle(tr("Capturing from %1").arg(cf_get_tempfile_source(capture_file_.capFile())));
} else {
/* We have no capture in progress. */
- setDefaultWindowTitle();
+ setWSWindowTitle();
}
}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index c2cdd090fb..6a2032e256 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -188,7 +188,6 @@ private:
void initTimePrecisionFormatMenu();
void initFreezeActions();
- void setDefaultWindowTitle();
void setTitlebarForCaptureFile();
void setTitlebarForCaptureInProgress();
void setMenusForCaptureFile(bool force_disable = false);
@@ -238,6 +237,8 @@ public slots:
void updatePreferenceActions();
void updateRecentActions();
+ void setWSWindowTitle(QString title = NULL);
+
void captureCapturePrepared(capture_session *);
void captureCaptureUpdateStarted(capture_session *);
void captureCaptureUpdateFinished(capture_session *);
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 29416f02f6..c396236eb2 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -765,7 +765,7 @@ void MainWindow::captureFileClosed() {
main_ui_->statusBar->popFileStatus();
- setDefaultWindowTitle();
+ setWSWindowTitle();
setWindowIcon(wsApp->normalIcon());
setMenusForSelectedPacket();
setMenusForSelectedTreeRow();
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index cd63039447..c1382c967c 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -1331,6 +1331,8 @@ int main(int argc, char *argv[])
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
+ /* For update of WindowTitle (When use gui.window_title preference) */
+ main_w->setWSWindowTitle();
////////
/* Read the dynamic part of the recent file, as we have the gui now ready for