diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-03-31 22:59:56 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-03-31 22:59:56 +0000 |
commit | 6c5c65b4867eb3c595581c40f696bc48170fe670 (patch) | |
tree | 82a3bb03fe1d971b197bebfb742beb2cd81941fa /ui | |
parent | 2328de7bf87cef40e90a93e7b291cb04b6e5bf32 (diff) |
Add a setTitlebarForCaptureFile() and have it set the titlebar and the
"modified" indicator. For some reason, it's not getting called in all
the right places.
svn path=/trunk/; revision=48682
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window.cpp | 22 | ||||
-rw-r--r-- | ui/qt/main_window.h | 1 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 3 |
3 files changed, 22 insertions, 4 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index f1b765bccb..24a1887fd5 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -83,6 +83,7 @@ MainWindow::MainWindow(QWidget *parent) : { gbl_cur_main_window = this; main_ui_->setupUi(this); + setTitlebarForCaptureFile(); setMenusForCaptureFile(); setForCapturedPackets(false); setMenusForSelectedPacket(); @@ -1113,6 +1114,24 @@ void MainWindow::captureStop() { } } +// Titlebar +void MainWindow::setTitlebarForCaptureFile() +{ + gchar *display_name; + + if (cap_file_ && cap_file_->filename) { + display_name = cf_get_display_name(cap_file_); + setWindowModified(cap_file_->unsaved_changes); + // Clear the window title so that setWindowFilePath does something + setWindowTitle(NULL); + setWindowFilePath(display_name); + g_free(display_name); + } else { + /* We have no capture file. */ + setWindowTitle("The Wireshark Network Analyzer"); + } +} + // Menu state /* Enable or disable menu items based on whether you have a capture file @@ -1259,8 +1278,7 @@ void MainWindow::setMenusForFileSet(bool enable_list_files) { } void MainWindow::updateForUnsavedChanges() { -// set_titlebar_for_capture_file(cf); -// this->setWindowModified(cf->unsaved_changes); + setTitlebarForCaptureFile(); setMenusForCaptureFile(); // set_toolbar_for_capture_file(cf); diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 2ee55568cb..5ad595c2a4 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -124,6 +124,7 @@ private: bool testCaptureFileClose(bool from_quit = false, QString& before_what = *new QString()); void captureStop(); + void setTitlebarForCaptureFile(); void setMenusForCaptureFile(bool force_disable = false); void setMenusForCaptureInProgress(bool capture_in_progress = false); void setMenusForCaptureStopping(); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 6d21c716f6..1c4e02bdec 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -313,12 +313,11 @@ void MainWindow::captureFileReadFinished(const capture_file *cf) { // wsApp->setLastOpenDir(dir_path); // g_free(dir_path); // } -// set_titlebar_for_capture_file(cf); /* Update the appropriate parts of the main window. */ updateForUnsavedChanges(); -// /* Enable menu items that make sense if you have some captured packets. */ + /* Enable menu items that make sense if you have some captured packets. */ setForCapturedPackets(true); main_ui_->statusBar->popFileStatus(); |