[niepce] Rework the import dialog (UX)
- From: Hubert FiguiÃre <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Rework the import dialog (UX)
- Date: Sat, 12 Nov 2011 06:16:10 +0000 (UTC)
commit a740ddb9cc1d77d6826bc5e792b7ab7e341a5afe
Author: Hub Figuiere <hub figuiere net>
Date: Sat Oct 29 23:18:23 2011 -0700
Rework the import dialog (UX)
src/niepce/ui/dialogs/importdialog.cpp | 40 ++++++++++++++++--------
src/niepce/ui/dialogs/importdialog.hpp | 21 ++++++++----
src/niepce/ui/dialogs/importdialog.ui | 52 +++++++++++++++++++++++++++----
src/niepce/ui/niepcewindow.cpp | 8 ++---
4 files changed, 88 insertions(+), 33 deletions(-)
---
diff --git a/src/niepce/ui/dialogs/importdialog.cpp b/src/niepce/ui/dialogs/importdialog.cpp
index 1e2117f..0f423c1 100644
--- a/src/niepce/ui/dialogs/importdialog.cpp
+++ b/src/niepce/ui/dialogs/importdialog.cpp
@@ -18,17 +18,21 @@
*/
+#include <boost/bind.hpp>
+
#include <glibmm/i18n.h>
#include <gtkmm/button.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/combobox.h>
#include <gtkmm/filechooserdialog.h>
+#include <gtkmm/iconview.h>
#include <gtkmm/label.h>
#include <gtkmm/liststore.h>
#include <gtkmm/stock.h>
#include <gtkmm/builder.h>
#include "fwk/base/debug.hpp"
+#include "fwk/utils/pathutils.hpp"
#include "fwk/toolkit/configuration.hpp"
#include "fwk/toolkit/application.hpp"
#include "importdialog.hpp"
@@ -40,11 +44,11 @@ namespace ui {
ImportDialog::ImportDialog()
: fwk::Dialog(GLADEDIR"importdialog.ui", "importDialog"),
- m_date_tz_combo(NULL),
+ m_date_tz_combo(NULL),
m_ufraw_import_check(NULL),
m_rawstudio_import_check(NULL),
m_directory_name(NULL),
- m_folderList(NULL)
+ m_imagesList(NULL)
{
}
@@ -67,8 +71,10 @@ void ImportDialog::setup_widget()
_builder->get_widget("ufraw_import_check", m_ufraw_import_check);
_builder->get_widget("rawstudio_import_check", m_rawstudio_import_check);
_builder->get_widget("directory_name", m_directory_name);
- _builder->get_widget("folderList", m_folderList);
- m_folderListModel = m_folderListModelRecord.inject(*m_folderList);
+ _builder->get_widget("imagesList", m_imagesList);
+ _builder->get_widget("destinationFolder", m_destinationFolder);
+ m_imagesListModel = m_imagesListModelRecord.inject(*m_imagesList);
+ m_imagesList->set_model(m_imagesListModel);
m_is_setup = true;
}
@@ -82,7 +88,7 @@ void ImportDialog::do_select_directories()
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(_("Import"), Gtk::RESPONSE_OK);
- dialog.set_select_multiple(true);
+ dialog.set_select_multiple(false);
std::string last_import_location;
last_import_location = cfg.getValue("last_import_location", "");
if(!last_import_location.empty()) {
@@ -93,23 +99,28 @@ void ImportDialog::do_select_directories()
switch(result)
{
case Gtk::RESPONSE_OK:
- set_to_import(dialog.get_filenames());
-// m_directory_name->set_label(m_to_import);
+ set_to_import(dialog.get_filename());
break;
default:
break;
}
}
-void ImportDialog::set_to_import(const Glib::SListHandle<Glib::ustring> & l)
+void ImportDialog::set_to_import(const Glib::ustring & f)
{
- m_list_to_import = l;
- m_folderListModel->clear();
- for(std::list<std::string>::const_iterator i = m_list_to_import.begin();
- i != m_list_to_import.end(); ++i) {
+ m_folder_path_to_import = f;
+ m_destinationFolder->set_text(fwk::path_basename(f));
+ m_directory_name->set_text(f);
+//
+ m_imagesListModel->clear();
+ fwk::FileList::Ptr list_to_import
+ = fwk::FileList::getFilesFromDirectory(f,
+ boost::bind(&fwk::filter_xmp_out, _1));
+ for(std::list<std::string>::const_iterator i = list_to_import->begin();
+ i != list_to_import->end(); ++i) {
DBG_OUT("selected %s", i->c_str());
- Gtk::TreeIter iter = m_folderListModel->append();
- iter->set_value(m_folderListModelRecord.m_col1, *i);
+ Gtk::TreeIter iter = m_imagesListModel->append();
+ iter->set_value(m_imagesListModelRecord.m_col1, *i);
}
}
@@ -121,6 +132,7 @@ void ImportDialog::set_to_import(const Glib::SListHandle<Glib::ustring> & l)
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0))
indent-tabs-mode:nil
+ tab-width:4
fill-column:99
End:
*/
diff --git a/src/niepce/ui/dialogs/importdialog.hpp b/src/niepce/ui/dialogs/importdialog.hpp
index 84848fa..3b5ebbc 100644
--- a/src/niepce/ui/dialogs/importdialog.hpp
+++ b/src/niepce/ui/dialogs/importdialog.hpp
@@ -30,6 +30,7 @@
#include "fwk/toolkit/gtkutils.hpp"
#include "fwk/toolkit/dialog.hpp"
+#include "imageliststore.hpp"
namespace Gtk {
class Dialog;
@@ -50,23 +51,28 @@ public:
virtual void setup_widget();
- const std::list<std::string> & to_import() const
- { return m_list_to_import; }
- void set_to_import(const Glib::SListHandle<Glib::ustring> & l);
+// const std::list<std::string> & to_import() const
+// { return m_list_to_import; }
+ const Glib::ustring & path_to_import() const
+ { return m_folder_path_to_import; }
+ void set_to_import(const Glib::ustring & f);
private:
class ImportParam;
void do_select_directories();
- std::list<std::string> m_list_to_import;
+ Glib::ustring m_folder_path_to_import;
+// std::list<std::string> m_list_to_import;
+
Gtk::ComboBox *m_date_tz_combo;
Gtk::CheckButton *m_ufraw_import_check;
Gtk::CheckButton *m_rawstudio_import_check;
Gtk::Label *m_directory_name;
- Gtk::TreeView *m_folderList;
- fwk::TextModelRecord m_folderListModelRecord;
- Glib::RefPtr<Gtk::ListStore> m_folderListModel;
+ Gtk::Entry *m_destinationFolder;
+ Gtk::TreeView *m_imagesList;
+ fwk::TextModelRecord m_imagesListModelRecord;
+ Glib::RefPtr<Gtk::ListStore> m_imagesListModel;
};
}
@@ -77,6 +83,7 @@ private:
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0))
indent-tabs-mode:nil
+ tab-width:4
fill-column:80
End:
*/
diff --git a/src/niepce/ui/dialogs/importdialog.ui b/src/niepce/ui/dialogs/importdialog.ui
index 3230263..e6d7758 100644
--- a/src/niepce/ui/dialogs/importdialog.ui
+++ b/src/niepce/ui/dialogs/importdialog.ui
@@ -21,14 +21,15 @@
<property name="border_width">5</property>
<property name="title" translatable="yes">Import</property>
<property name="window_position">center-on-parent</property>
- <property name="default_width">300</property>
- <property name="default_height">300</property>
+ <property name="default_width">600</property>
+ <property name="default_height">600</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<placeholder/>
@@ -36,6 +37,7 @@
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkHBox" id="hbox1">
@@ -86,9 +88,9 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Folders</property>
+ <property name="label" translatable="yes">_Images to import</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">folderList</property>
+ <property name="mnemonic_widget">imagesList</property>
</object>
<packing>
<property name="expand">False</property>
@@ -103,10 +105,11 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="folderList">
+ <object class="GtkTreeView" id="imagesList">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
</object>
</child>
</object>
@@ -115,6 +118,39 @@
</packing>
</child>
<child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Destination _Folder</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkEntry" id="destinationFolder">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkExpander" id="expander1">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -122,6 +158,7 @@
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="ufraw_import_check">
<property name="label" translatable="yes">Import _UFRaw</property>
@@ -162,6 +199,7 @@
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkComboBox" id="date_tz_combo">
@@ -219,12 +257,12 @@
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="expand">False</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index 58dd392..195e62a 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -295,14 +295,12 @@ void NiepceWindow::on_action_file_import()
case 0:
{
// import
- const std::list<std::string> & to_import(import_dialog->to_import());
+ Glib::ustring to_import = import_dialog->path_to_import();
if(!to_import.empty()) {
- cfg.setValue("last_import_location", to_import.front());
+ cfg.setValue("last_import_location", import_dialog->path_to_import());
//DBG_OUT("%s", to_import.c_str());
- std::for_each(to_import.begin(), to_import.end(),
- boost::bind(&LibraryClient::importFromDirectory,
- m_libClient, _1, false));
+ m_libClient->importFromDirectory(to_import, false);
}
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]