[vlmc-devel] Properly handle the main window modified state in the title

Hugo Beauzée-Luyssen git at videolan.org
Fri Mar 4 17:14:23 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Mar  4 17:09:12 2016 +0100| [ace050f9c70cbd56c3a4c5f0bb1721a0c009296e] | committer: Hugo Beauzée-Luyssen

Properly handle the main window modified state in the title

> https://code.videolan.org/videolan/vlmc/commit/ace050f9c70cbd56c3a4c5f0bb1721a0c009296e
---

 src/Gui/MainWindow.cpp | 20 +++++++++++---------
 src/Gui/MainWindow.h   |  1 +
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 4873b5b..12a25ec 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -113,6 +113,9 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
              this, SLOT( onOudatedBackupFile() ) );
     connect( Core::getInstance()->project(), SIGNAL( backupProjectLoaded() ),
              this, SLOT( onBackupFileLoaded() ) );
+    connect( Core::getInstance()->project(), SIGNAL( projectSaved() ),
+             this, SLOT( onProjectSaved() ) );
+
 
     //Connecting Library stuff:
     const ClipRenderer* clipRenderer = qobject_cast<const ClipRenderer*>( m_clipPreview->getGenericRenderer() );
@@ -785,21 +788,20 @@ MainWindow::closeEvent( QCloseEvent* e )
 void
 MainWindow::projectUpdated( const QString& projectName )
 {
-    QString title = tr( "VideoLAN Movie Creator" );
-    title += " - ";
-    title += projectName;
+    QString title = tr( "%1 VideoLAN Movie Creator [*]" ).arg( projectName );
     setWindowTitle( title );
 }
 
 void
 MainWindow::cleanStateChanged( bool isClean )
 {
-    QString title = windowTitle();
-    if ( isClean == true )
-        title.replace(" *", "");
-    else
-        title += " *";
-    setWindowTitle( title );
+    setWindowModified( isClean == false );
+}
+
+void
+MainWindow::onProjectSaved()
+{
+    setWindowModified( false );
 }
 
 void
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 2313ab9..b4f5d7f 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -172,6 +172,7 @@ private slots:
     void                    canRedoChanged( bool canRedo );
     void                    onOudatedBackupFile();
     void                    onBackupFileLoaded();
+    void                    onProjectSaved();
 
 signals:
     void                    toolChanged( ToolButtons );



More information about the Vlmc-devel mailing list