[vlmc-devel] ProjectWizard: Remove workspace location field.

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


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Mar  2 14:58:11 2016 +0100| [da54fbfbfb81126fb2ce97b1288e013006d2cdad] | committer: Hugo Beauzée-Luyssen

ProjectWizard: Remove workspace location field.

This is now a global VLMC setting, not a per-project one

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

 src/Gui/wizard/GeneralPage.cpp   | 64 ++++++----------------------------------
 src/Gui/wizard/GeneralPage.h     |  1 -
 src/Gui/wizard/ProjectWizard.cpp |  2 --
 src/Gui/wizard/ui/GeneralPage.ui | 36 ++++------------------
 4 files changed, 14 insertions(+), 89 deletions(-)

diff --git a/src/Gui/wizard/GeneralPage.cpp b/src/Gui/wizard/GeneralPage.cpp
index ca1bd37..b2166a8 100644
--- a/src/Gui/wizard/GeneralPage.cpp
+++ b/src/Gui/wizard/GeneralPage.cpp
@@ -41,16 +41,11 @@ GeneralPage::GeneralPage( QWidget *parent ) :
     pValid = pInvalid = palette();
     pInvalid.setColor( QPalette::Text, QColor( 215, 30, 30 ) );
 
-    connect( ui.pushButtonBrowse, SIGNAL( clicked() ),
-             this, SLOT( openWorkspaceDirectory() ) );
     connect( ui.lineEditName, SIGNAL( textChanged(QString) ),
              this, SLOT( updateProjectLocation() ) );
-    connect( ui.lineEditWorkspace, SIGNAL( textChanged(QString) ),
-             this, SLOT( updateProjectLocation() ) );
 
     registerField( "projectName*", ui.lineEditName );
     registerField( "projectPath*", ui.lineEditProjectLocation );
-    registerField( "workspace*", ui.lineEditWorkspace );
 }
 
 void
@@ -80,10 +75,6 @@ GeneralPage::initializePage()
     QString     projectName = Project::unNamedProject;
     ui.lineEditName->setText( projectName );
 
-    //fetching the global workspace path
-    QString     workspacePath = VLMC_GET_STRING( "vlmc/DefaultProjectLocation" );
-    ui.lineEditWorkspace->setText( workspacePath );
-
     //Reinit description field
     ui.textEditDescription->clear();
 
@@ -108,17 +99,10 @@ GeneralPage::validatePage()
         ui.lineEditName->setFocus();
         return false;
     }
-    if ( ui.lineEditWorkspace->text().isEmpty() )
-    {
-        QMessageBox::information( this, tr( "Form is incomplete" ),
-                                  tr( "The workspace location must be set." ) );
-        ui.lineEditWorkspace->setFocus();
-        return false;
-    }
 
     //Create the project directory in the workspace dir.
     QString     projectPath = ui.lineEditName->text().replace( ' ', '_' );
-    QDir        workspaceDir( ui.lineEditWorkspace->text() );
+    QDir        workspaceDir( VLMC_GET_STRING( "vlmc/WorkspaceLocation" ) );
 
     if ( workspaceDir.exists( projectPath ) == false )
         workspaceDir.mkdir( projectPath );
@@ -126,46 +110,16 @@ GeneralPage::validatePage()
 }
 
 void
-GeneralPage::openWorkspaceDirectory()
-{
-    QString     workspace = QFileDialog::getExistingDirectory( this,
-                                                           "Choose a workspace directory",
-                                                           QDir::homePath() );
-    if ( workspace.isEmpty() )
-        return;
-    ui.lineEditWorkspace->setText( workspace );
-}
-
-void
 GeneralPage::updateProjectLocation()
 {
-    QString     workspacePath = ui.lineEditWorkspace->text();
-    if ( workspacePath.isEmpty() )
-    {
-        ui.lineEditProjectLocation->setText( tr( "Missing workspace location" ) );
-        setValidity( false );
-        return ;
-    }
-    else
-    {
-        QString     pName = ui.lineEditName->text().replace( ' ', '_' );
-        QDir        workspaceDir( workspacePath );
-        QDir        projectDir( QString( "%1/%2" ).arg( workspacePath, pName ) );
-
-        ui.lineEditProjectLocation->setText( projectDir.absolutePath() );
-
-        if ( workspaceDir.isRelative() )
-        {
-            ui.lineEditProjectLocation->setText( tr( "Invalid workspace location" ) );
-            setValidity( false );
-            return ;
-        }
-
-        if ( !workspaceDir.exists() )
-            setValidity( false );
-        else //Invalidate the path if the project directory already exists
-            setValidity( !projectDir.exists() );
-    }
+    auto        workspaceLocation = VLMC_GET_STRING( "vlmc/WorkspaceLocation" );
+    QString     pName = ui.lineEditName->text().replace( ' ', '_' );
+    QDir        projectDir( QString( "%1/%2" ).arg( workspaceLocation, pName ) );
+
+    ui.lineEditProjectLocation->setText( projectDir.absolutePath() );
+
+    //Invalidate the path if the project directory already exists
+    setValidity( !projectDir.exists() );
 }
 
 void
diff --git a/src/Gui/wizard/GeneralPage.h b/src/Gui/wizard/GeneralPage.h
index f317bf5..5fd1cc4 100644
--- a/src/Gui/wizard/GeneralPage.h
+++ b/src/Gui/wizard/GeneralPage.h
@@ -42,7 +42,6 @@ private:
     void                setValidity( bool status );
 
 private slots:
-    void                openWorkspaceDirectory();
     void                updateProjectLocation();
 
 private:
diff --git a/src/Gui/wizard/ProjectWizard.cpp b/src/Gui/wizard/ProjectWizard.cpp
index 49210cc..f6261de 100644
--- a/src/Gui/wizard/ProjectWizard.cpp
+++ b/src/Gui/wizard/ProjectWizard.cpp
@@ -104,8 +104,6 @@ ProjectWizard::accept()
         Core::getInstance()->newProject( field( "projectName" ).toString(), field( "projectPath" ).toString() );
         Settings* projectPreferences = Core::getInstance()->currentProject()->settings();
 
-        preferences->setValue( "vlmc/DefaultProjectLocation", field( "workspace" ) );
-
         projectPreferences->setValue( "video/VLMCOutputFPS", field( "fps" ) );
         projectPreferences->setValue( "video/VideoProjectHeight", field( "height" ) );
         projectPreferences->setValue( "video/VideoProjectWidth", field( "width" ) );
diff --git a/src/Gui/wizard/ui/GeneralPage.ui b/src/Gui/wizard/ui/GeneralPage.ui
index e9c6578..69cb399 100644
--- a/src/Gui/wizard/ui/GeneralPage.ui
+++ b/src/Gui/wizard/ui/GeneralPage.ui
@@ -82,11 +82,12 @@
       <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
 <html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
-<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
+</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
 <tr>
 <td style="border: none;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></td></tr></table></body></html></string>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></td></tr></table></body></html></string>
      </property>
      <property name="acceptRichText">
       <bool>false</bool>
@@ -107,33 +108,6 @@ p, li { white-space: pre-wrap; }
     </widget>
    </item>
    <item row="5" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>Workspace directory</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="1">
-    <widget class="QLineEdit" name="lineEditWorkspace">
-     <property name="text">
-      <string notr="true"/>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="1">
-    <widget class="QPushButton" name="pushButtonBrowse">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>Browse...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="0">
     <widget class="QLabel" name="label_5">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -146,7 +120,7 @@ p, li { white-space: pre-wrap; }
      </property>
     </widget>
    </item>
-   <item row="7" column="1">
+   <item row="5" column="1">
     <widget class="QLineEdit" name="lineEditProjectLocation">
      <property name="text">
       <string notr="true"/>



More information about the Vlmc-devel mailing list