changeset 79:ca8d3cfe8ba1 1.0.0

Do not check path existence while typing Checking if a path exists can be expensive especially for network paths. So we only do this now once the user hits "Go"
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 16 Jun 2015 12:36:37 +0200
parents 6965fb5db4b7
children d6f3a31e505e
files src/folderselectdialog.cpp src/l10n/main_de_DE.ts
diffstat 2 files changed, 34 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/folderselectdialog.cpp	Tue Jun 16 12:35:16 2015 +0200
+++ b/src/folderselectdialog.cpp	Tue Jun 16 12:36:37 2015 +0200
@@ -79,6 +79,8 @@
         folderChangeArea->addWidget(mGoButton);
         connect(mGoButton, &QPushButton::clicked, this,
                 &FolderSelectDialog::goClicked);
+        connect(mPathLineEdit, &QLineEdit::returnPressed, this,
+                &FolderSelectDialog::goClicked);
     }
 
     mFilterWidget = new FilterWidget(mSortModel);
@@ -118,21 +120,22 @@
 
 void FolderSelectDialog::pathLineChanged() {
     const QString path = mPathLineEdit->text();
-    qDebug() << "path: " << path;
     if (path.isEmpty()) {
         mGoButton->setEnabled(false);
         return;
     }
-    QDir dir(path);
-    if (dir.exists()) {
-        mGoButton->setEnabled(true);
-        return;
-    }
-    mGoButton->setEnabled(false);
+    mGoButton->setEnabled(true);
 }
 
 
 void FolderSelectDialog::goClicked() {
+    const QString path = mPathLineEdit->text();
+    QDir dir(path);
+    if (!dir.exists()) {
+        QMessageBox::warning(this, tr("Error!"), tr("Failed to access directory: '%1'").arg(path));
+        mGoButton->setEnabled(false);
+        return;
+    }
     setFolder(mPathLineEdit->text());
     QSettings settings;
     /* assuming go is only available in root folder mode */
--- a/src/l10n/main_de_DE.ts	Tue Jun 16 12:35:16 2015 +0200
+++ b/src/l10n/main_de_DE.ts	Tue Jun 16 12:36:37 2015 +0200
@@ -27,22 +27,32 @@
         <translation></translation>
     </message>
     <message>
-        <location filename="../folderselectdialog.cpp" line="105"/>
+        <location filename="../folderselectdialog.cpp" line="107"/>
         <source>Ok</source>
         <translation>Ok</translation>
     </message>
     <message>
-        <location filename="../folderselectdialog.cpp" line="176"/>
+        <location filename="../folderselectdialog.cpp" line="135"/>
+        <source>Error!</source>
+        <translation>Fehler!</translation>
+    </message>
+    <message>
+        <location filename="../folderselectdialog.cpp" line="135"/>
+        <source>Failed to access directory: &apos;%1&apos;</source>
+        <translation>Auf das Verzeichnis &apos;%1&apos; konnte nicht zugegriffen werden.</translation>
+    </message>
+    <message>
+        <location filename="../folderselectdialog.cpp" line="179"/>
         <source>The following folders did not match the pattern: %1</source>
         <translation>Die folgenden Order entsprechen nicht dem Schema: %1</translation>
     </message>
     <message>
-        <location filename="../folderselectdialog.cpp" line="178"/>
+        <location filename="../folderselectdialog.cpp" line="181"/>
         <source>Failed to parse some folders.</source>
         <translation>Einige Ordnernamen konnten nicht verarbeitet werden.</translation>
     </message>
     <message>
-        <location filename="../folderselectdialog.cpp" line="202"/>
+        <location filename="../folderselectdialog.cpp" line="205"/>
         <source>Select %1</source>
         <translation>Bitte das %1 auswählen</translation>
     </message>
@@ -116,17 +126,22 @@
         <translation>Geschwindigkeit:</translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="136"/>
+        <location filename="../pngplayer.cpp" line="104"/>
+        <source>RetraceIT Version:&lt;br/&gt;&lt;bold&gt;%1&lt;/bold&gt;</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../pngplayer.cpp" line="138"/>
         <source>Screenshot Nr.:</source>
         <translation>Screenshot Nr.:</translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="138"/>
+        <location filename="../pngplayer.cpp" line="140"/>
         <source>Index Nr.:</source>
         <translation>Index Nr.:</translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="139"/>
+        <location filename="../pngplayer.cpp" line="141"/>
         <source>Timestamp:</source>
         <translation>Zeitstempel:</translation>
     </message>
@@ -135,12 +150,12 @@
         <translation type="vanished">Unbekannt</translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="148"/>
+        <location filename="../pngplayer.cpp" line="150"/>
         <source>%1 second per Picture</source>
         <translation>%1 Sekunde pro Bild</translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="151"/>
+        <location filename="../pngplayer.cpp" line="153"/>
         <source>%1 seconds per Picture</source>
         <translation>%1 Sekunden pro Bild</translation>
     </message>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)