[vlmc-devel] [PATCH 2/2] WelcomePage: Add QMessageBox noticing user when project file is not found

Hieu Pham phamhuuquanghieu at gmail.com
Mon Mar 13 02:53:27 CET 2017


Remove redundant use of variable and pointer
---
 src/Gui/wizard/WelcomePage.cpp | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/Gui/wizard/WelcomePage.cpp b/src/Gui/wizard/WelcomePage.cpp
index 1830a24..6d1414d 100644
--- a/src/Gui/wizard/WelcomePage.cpp
+++ b/src/Gui/wizard/WelcomePage.cpp
@@ -106,18 +106,14 @@ WelcomePage::validatePage()
                                       "the list.\nThen click next to continue..." ) );
             return false;
         }        
-        else
+        else if ( QFile::exists( *m_projectPath ) == false )
         {
-            QFile* m_projectFile = new QFile( *m_projectPath );
-            if ( !m_projectFile->open( QFile::ReadOnly ) )
-            {
-                QMessageBox msgBox;
-                msgBox.setText( QObject::tr( "Sorry, we couldn't find your file. Was it moved, renamed, or deleted?" ) );
-                msgBox.setInformativeText( QObject::tr( m_projectPath->toUtf8() ) );
-                msgBox.setDefaultButton( QMessageBox::Ok );
-                msgBox.exec();
-                return false;
-            }
+            QMessageBox msgBox;
+            msgBox.setText( "Sorry, we couldn't find your file. Was it moved, renamed, or deleted?" );
+            msgBox.setInformativeText( m_projectPath->toUtf8() );
+            msgBox.setDefaultButton( QMessageBox::Ok );
+            msgBox.exec();
+            return false;
         }
         return true;
     }
-- 
2.9.3



More information about the Vlmc-devel mailing list