Qt: Remove usage of setWindowFilePath
Change-Id: I29591709d88d1858e44c753d09e4a29d0f28ce53 Reviewed-on: https://code.wireshark.org/review/12781 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
parent
4a2e0bfd1e
commit
f145108f5e
|
@ -1833,26 +1833,6 @@ void MainWindow::initFreezeActions()
|
||||||
void MainWindow::setTitlebarForCaptureFile()
|
void MainWindow::setTitlebarForCaptureFile()
|
||||||
{
|
{
|
||||||
if (capture_file_.capFile() && capture_file_.capFile()->filename) {
|
if (capture_file_.capFile() && capture_file_.capFile()->filename) {
|
||||||
//
|
|
||||||
// Qt *REALLY* doesn't like windows that sometimes have a
|
|
||||||
// title set with setWindowTitle() and other times have a
|
|
||||||
// file path set; apparently, once you've set the title
|
|
||||||
// with setWindowTitle(), it sticks, and setWindowFilePath()
|
|
||||||
// has no effect. It appears to can clear the title with
|
|
||||||
// setWindowTitle(NULL), but that clears the actual title in
|
|
||||||
// the title bar, and setWindowFilePath() then, I guess, sees
|
|
||||||
// that there's already a file path, and does nothing, leaving
|
|
||||||
// the title bar empty. So you then have to clear the file path
|
|
||||||
// with setWindowFilePath(NULL), and then set it.
|
|
||||||
//
|
|
||||||
// Maybe there's a #include "you're holding it wrong" here.
|
|
||||||
// However, I really don't want to hear from people who think
|
|
||||||
// that a window can never be associated with something other
|
|
||||||
// than a user file at time T1 and with a user file at time T2,
|
|
||||||
// given that, in Wireshark, a window can be associated with a
|
|
||||||
// live capture at time T1 and then, after you've saved the live
|
|
||||||
// capture to a user file, associated with a user file at time T2.
|
|
||||||
//
|
|
||||||
if (capture_file_.capFile()->is_tempfile) {
|
if (capture_file_.capFile()->is_tempfile) {
|
||||||
//
|
//
|
||||||
// For a temporary file, put the source of the data
|
// For a temporary file, put the source of the data
|
||||||
|
@ -1863,7 +1843,6 @@ void MainWindow::setTitlebarForCaptureFile()
|
||||||
// XXX - on non-Mac platforms, put in the application
|
// XXX - on non-Mac platforms, put in the application
|
||||||
// name?
|
// name?
|
||||||
//
|
//
|
||||||
setWindowFilePath(NULL);
|
|
||||||
setWindowTitle(QString("[*]%1").arg(cf_get_tempfile_source(capture_file_.capFile())));
|
setWindowTitle(QString("[*]%1").arg(cf_get_tempfile_source(capture_file_.capFile())));
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -1881,13 +1860,12 @@ void MainWindow::setTitlebarForCaptureFile()
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
QFileInfo fi(utf8_filename);
|
||||||
if (utf8_filename == NULL) {
|
if (utf8_filename == NULL) {
|
||||||
// So what the heck else can we do here?
|
// So what the heck else can we do here?
|
||||||
setWindowTitle(tr("(File name can't be mapped to UTF-8)"));
|
setWindowTitle(tr("(File name can't be mapped to UTF-8)"));
|
||||||
} else {
|
} else {
|
||||||
setWindowTitle(NULL);
|
setWindowTitle(fi.fileName());
|
||||||
setWindowFilePath(NULL);
|
|
||||||
setWindowFilePath(utf8_filename);
|
|
||||||
g_free(utf8_filename);
|
g_free(utf8_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue