[niepce: 8/12] Import: it is the source not the target. Relayout the dialog a bit.



commit 89d43a65ae8527da5374f68f7e34f4bb86c7ac6d
Author: Hubert Figuière <hub figuiere net>
Date:   Tue Oct 20 21:58:00 2015 -0400

    Import: it is the source not the target. Relayout the dialog a bit.

 src/engine/importer/directoryimporter.cpp |   11 ++++---
 src/engine/importer/directoryimporter.hpp |    6 ++--
 src/engine/importer/iimporter.hpp         |   10 +++---
 src/niepce/ui/dialogs/importdialog.cpp    |   13 +++++----
 src/niepce/ui/dialogs/importdialog.hpp    |   14 +++------
 src/niepce/ui/dialogs/importdialog.ui     |   43 +++++++++++++----------------
 src/niepce/ui/niepcewindow.cpp            |   13 +++++----
 7 files changed, 52 insertions(+), 58 deletions(-)
---
diff --git a/src/engine/importer/directoryimporter.cpp b/src/engine/importer/directoryimporter.cpp
index 4a9a62a..3e0189e 100644
--- a/src/engine/importer/directoryimporter.cpp
+++ b/src/engine/importer/directoryimporter.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - engine/importer/directoryimporter.cpp
  *
- * Copyright (C) 2014 Hubert Figuiere
+ * Copyright (C) 2014-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,10 +58,11 @@ std::string DirectoryImporter::name() const
   return _("Directory");
 }
 
-bool DirectoryImporter::listTargetContent(const std::string & target)
+bool DirectoryImporter::listSourceContent(const std::string & source)
 {
-  auto content = fwk::FileList::getFilesFromDirectory(target,
-                                                   &fwk::filter_xmp_out);
+  auto content =
+    fwk::FileList::getFilesFromDirectory(source,
+                                         &fwk::filter_xmp_out);
   for(const auto & entry : *content)
   {
     std::lock_guard<std::mutex> lock(m_content_lock);
@@ -70,7 +71,7 @@ bool DirectoryImporter::listTargetContent(const std::string & target)
   return true;
 }
 
-std::list<ImportedFile::Ptr> DirectoryImporter::getTargetContent()
+std::list<ImportedFile::Ptr> DirectoryImporter::getSourceContent()
 {
   std::list<ImportedFile::Ptr> content;
   {
diff --git a/src/engine/importer/directoryimporter.hpp b/src/engine/importer/directoryimporter.hpp
index cddefb9..6be63fd 100644
--- a/src/engine/importer/directoryimporter.hpp
+++ b/src/engine/importer/directoryimporter.hpp
@@ -1,7 +1,7 @@
 /*
  * niepce - engine/importer/directoryimporter.hpp
  *
- * Copyright (C) 2014 Hubert Figuiere
+ * Copyright (C) 2014-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,8 +36,8 @@ public:
 
   std::string name() const override;
 
-  bool listTargetContent(const std::string & target) override;
-  std::list<ImportedFile::Ptr> getTargetContent() override;
+  bool listSourceContent(const std::string & source) override;
+  std::list<ImportedFile::Ptr> getSourceContent() override;
 
 private:
   std::mutex m_content_lock;
diff --git a/src/engine/importer/iimporter.hpp b/src/engine/importer/iimporter.hpp
index 595b7fd..29d2f28 100644
--- a/src/engine/importer/iimporter.hpp
+++ b/src/engine/importer/iimporter.hpp
@@ -1,7 +1,7 @@
 /*
  * niepce - engine/importer/iimporter.hpp
  *
- * Copyright (C) 2014 Hubert Figuiere
+ * Copyright (C) 2014-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,11 +34,11 @@ public:
   /** User visible importer name. */
   virtual std::string name() const = 0;
 
-  /** list the target content and store it. */
-  virtual bool listTargetContent(const std::string & target) = 0;
+  /** list the source content and store it. */
+  virtual bool listSourceContent(const std::string & source) = 0;
 
-  /** get the target content. */
-  virtual std::list<ImportedFile::Ptr> getTargetContent() = 0;
+  /** get the source content. */
+  virtual std::list<ImportedFile::Ptr> getSourceContent() = 0;
 };
 
 }
diff --git a/src/niepce/ui/dialogs/importdialog.cpp b/src/niepce/ui/dialogs/importdialog.cpp
index 85bd7f4..211c855 100644
--- a/src/niepce/ui/dialogs/importdialog.cpp
+++ b/src/niepce/ui/dialogs/importdialog.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - niepce/ui/importdialog.cpp
  *
- * Copyright (C) 2008-2014 Hubert Figuiere
+ * Copyright (C) 2008-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -137,20 +137,21 @@ void ImportDialog::setToImport(const Glib::ustring & f)
         // FIXME this should be the right kind
         m_importer = new eng::DirectoryImporter;
     }
-    auto target_content = std::async(std::launch::async,
+    auto source_content = std::async(std::launch::async,
                                      [f, this] () {
-                                         return m_importer->listTargetContent(
+                                         return m_importer->listSourceContent(
                                              f);
                                      });
 
-    m_folder_path_to_import = f;
+    m_folder_path_source = f;
     m_destinationFolder->set_text(fwk::path_basename(f));
     m_directory_name->set_text(f);
 
     m_images_list_model->clear();
 
-    if(target_content.get()) {
-        auto list_to_import = m_importer->getTargetContent();
+    // XXX this should be an event from the async result instead
+    if(source_content.get()) {
+        auto list_to_import = m_importer->getSourceContent();
 
         for(const auto & f : list_to_import) {
             DBG_OUT("selected %s", f->name().c_str());
diff --git a/src/niepce/ui/dialogs/importdialog.hpp b/src/niepce/ui/dialogs/importdialog.hpp
index 548d5d8..86c2f3e 100644
--- a/src/niepce/ui/dialogs/importdialog.hpp
+++ b/src/niepce/ui/dialogs/importdialog.hpp
@@ -1,7 +1,7 @@
 /*
  * niepce - niepce/ui/dialogs/importdialog.h
  *
- * Copyright (C) 2008-2013 Hubert Figuiere
+ * Copyright (C) 2008-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,9 +19,7 @@
 
 
 
-
-#ifndef __UI_IMPORTDIALOG_H__
-#define __UI_IMPORTDIALOG_H__
+#pragma once
 
 #include <list>
 #include <memory>
@@ -76,8 +74,8 @@ public:
 
 //  const std::list<std::string> & to_import() const
 //      { return m_list_to_import; }
-    const Glib::ustring & pathToImport() const
-        { return m_folder_path_to_import; }
+    const Glib::ustring & sourcePath() const
+        { return m_folder_path_source; }
     void setToImport(const Glib::ustring & f);
 
 private:
@@ -86,7 +84,7 @@ private:
     void doSelectDirectories();
 
     eng::IImporter *m_importer;
-    Glib::ustring m_folder_path_to_import;
+    Glib::ustring m_folder_path_source;
 
     Gtk::ComboBox *m_date_tz_combo;
     Gtk::CheckButton *m_ufraw_import_check;
@@ -116,5 +114,3 @@ private:
   End:
 */
 
-#endif
-
diff --git a/src/niepce/ui/dialogs/importdialog.ui b/src/niepce/ui/dialogs/importdialog.ui
index 76d8afe..a11dafb 100644
--- a/src/niepce/ui/dialogs/importdialog.ui
+++ b/src/niepce/ui/dialogs/importdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.19.0 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
   <object class="GtkListStore" id="import_source_model">
@@ -201,33 +201,17 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="vbox2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">8</property>
-                <child>
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">_Images to import</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
                 <child>
@@ -243,14 +227,14 @@
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
@@ -268,9 +252,9 @@
                       <object class="GtkLabel" id="label6">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes">Destination _Folder</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="expand">True</property>
@@ -409,6 +393,9 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">Presets:</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
                               </object>
                             </child>
                           </object>
@@ -464,9 +451,12 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                        <property name="xalign">0</property>
                                         <property name="label" translatable="yes">You can still change this 
after importing the pictures.</property>
                                         <property name="wrap">True</property>
+                                        <property name="xalign">0</property>
+                                        <attributes>
+                                          <attribute name="style" value="italic"/>
+                                        </attributes>
                                       </object>
                                       <packing>
                                         <property name="expand">True</property>
@@ -484,7 +474,9 @@
                                 <property name="can_focus">False</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <property name="label" translatable="yes">Date:</property>
-                                <property name="use_markup">True</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
                               </object>
                             </child>
                           </object>
@@ -526,6 +518,9 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">Attributes:</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
                               </object>
                             </child>
                           </object>
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index 5d0f549..9bd39fc 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - ui/niepcewindow.cpp
  *
- * Copyright (C) 2007-2014 Hubert Figuiere
+ * Copyright (C) 2007-2015 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -256,12 +256,13 @@ void NiepceWindow::on_action_file_import()
     {
         // import
         // XXX change the API to provide more details.
-        Glib::ustring to_import = import_dialog->pathToImport();
-        if(!to_import.empty()) {
-            cfg.setValue("last_import_location", to_import);
+        Glib::ustring source = import_dialog->sourcePath();
+        if(!source.empty()) {
+            cfg.setValue("last_import_location", source);
 
-            //DBG_OUT("%s", to_import.c_str());
-            m_libClient->importFromDirectory(to_import, false);
+            // XXX actually use the import module associated.
+            //DBG_OUT("%s", source.c_str());
+            m_libClient->importFromDirectory(source, false);
         }
         break;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]