瀏覽代碼

Main window title

Kandrashin Denis 13 年之前
父節點
當前提交
25f8280552
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      source/fb2main.cpp

+ 7 - 2
source/fb2main.cpp

@@ -315,17 +315,23 @@ void MainWindow::setCurrentFile(const QString &filename, QTextDocument * documen
 {
     static int sequenceNumber = 1;
 
+    QString title;
     isUntitled = filename.isEmpty();
     if (isUntitled) {
         curFile = tr("book%1.fb2").arg(sequenceNumber++);
+        title = curFile;
     } else {
-        curFile = QFileInfo(filename).canonicalFilePath();
+        QFileInfo info = filename;
+        curFile = info.canonicalFilePath();
+        title = info.fileName();
     }
+    title += QString(" - ") += qApp->applicationName();
 
     if (document) textEdit->setDocument(document); else textEdit->clear();
     textEdit->document()->setModified(false);
     setWindowModified(false);
     setWindowFilePath(curFile);
+    setWindowTitle(title);
 }
 
 QString MainWindow::strippedName(const QString &fullFileName)
@@ -344,4 +350,3 @@ MainWindow *MainWindow::findMainWindow(const QString &fileName)
     }
     return 0;
 }
-