[niepce: 2/14] UI skeleton



commit 91785b6468352a524dc586d57c4da0715e91cf9f
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Jan 13 15:35:23 2013 -0500

    UI skeleton

 .gitignore                |    4 +
 magellan/src/Makefile.am  |    4 +
 magellan/src/mgwindow.cpp |   65 +++++++-------
 magellan/src/mgwindow.hpp |   21 +----
 magellan/src/mgwindow.ui  |  228 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 270 insertions(+), 52 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ed19e7b..375dce8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,6 +53,10 @@ src/engine/library/test_opqueue
 src/niepce/niepce
 camerawire/src/camerawire
 camerawire/po/POTFILES
+camerawire/po/Makefile.in
+magellan/src/magellan
+magellan/po/POTFILES
+magellan/po/Makefile.in
 doc/Doxyfile
 doc/doxygen/html
 po/*.gmo
diff --git a/magellan/src/Makefile.am b/magellan/src/Makefile.am
index 9aff829..7e9f528 100644
--- a/magellan/src/Makefile.am
+++ b/magellan/src/Makefile.am
@@ -2,10 +2,14 @@
 
 AM_CPPFLAGS = -DCW_LOCALEDIR=\"${CW_LOCALEDIR}\"
 
+gladefiles = mgwindow.ui
+gladedir = @datarootdir@/niepce/glade/
+glade_DATA = $(gladefiles)
 
 bin_PROGRAMS = magellan
 
 INCLUDES = -DDATADIR=\"$(datadir)\" \
+       -DGLADEDIR=\"$(gladedir)\" \
        -I$(top_srcdir)/../src/ -I$(top_srcdir)/src  \
        @LIBGLIBMM_CFLAGS@ @LIBGTKMM_CFLAGS@
 
diff --git a/magellan/src/mgwindow.cpp b/magellan/src/mgwindow.cpp
index c2fa4a6..d958a30 100644
--- a/magellan/src/mgwindow.cpp
+++ b/magellan/src/mgwindow.cpp
@@ -23,6 +23,7 @@
 #include <gtkmm/stock.h>
 #include <gtkmm/window.h>
 
+#include "fwk/base/debug.hpp"
 #include "fwk/toolkit/application.hpp"
 #include "fwk/toolkit/undo.hpp"
 #include "mgwindow.hpp"
@@ -58,23 +59,17 @@ Gtk::Widget * MgWindow::buildWidget(const Glib::RefPtr<Gtk::UIManager> & manager
 
   Gtk::Widget* pMenuBar = pApp->uiManager()->get_widget("/MenuBar");
   m_vbox.pack_start(*pMenuBar, Gtk::PACK_SHRINK);
-  m_vbox.pack_start(m_hbox, true, true, 4);
 
-  m_camera_tree_model = Gtk::ListStore::create(m_camera_tree_record);
-  Gtk::TreeView *treeview = manage(new Gtk::TreeView(m_camera_tree_model));
-  Gtk::TreeViewColumn *column;
+  Glib::RefPtr<Gtk::Builder> bldr
+         = Gtk::Builder::create_from_file(GLADEDIR"mgwindow.ui",
+                                          "content_box");
+  Gtk::Box* content;
+  bldr->get_widget("content_box", content);
+  m_vbox.pack_start(*content, true, true, 8);
 
-  column = manage(new Gtk::TreeViewColumn(_("Camera")));
-  Gtk::CellRendererToggle *cell = manage(new Gtk::CellRendererToggle);
-  column->pack_start(*cell, false);
-  column->add_attribute(cell->property_active(), 
-                        m_camera_tree_record.m_persistent);
-  column->pack_start(m_camera_tree_record.m_icon, false);
-  column->pack_start(m_camera_tree_record.m_label);
-  treeview->append_column(*column);
-  m_hbox.pack_start(*treeview, false, true, 4);
-
-  reload_camera_list();
+  Gtk::Button* dload_btn;
+  bldr->get_widget("download_btn", dload_btn);
+  dload_btn->set_related_action(m_importAction);
 
   win.set_size_request(600, 400);
   win.show_all_children();
@@ -87,17 +82,18 @@ void MgWindow::init_actions()
     Glib::RefPtr<Gtk::Action> an_action;
 
     m_refActionGroup = Gtk::ActionGroup::create();
-               
+
     m_refActionGroup->add(Gtk::Action::create("MenuFile", _("_File")));
-    m_refActionGroup->add(Gtk::Action::create("Import", _("_Import...")),
-                          sigc::mem_fun(*this, 
-                                        &MgWindow::on_action_import));
+    m_importAction = Gtk::Action::create("Import", _("_Import"));
+    m_refActionGroup->add(m_importAction,
+                         sigc::mem_fun(*this,
+                                       &MgWindow::on_action_import));
     m_refActionGroup->add(Gtk::Action::create("Close", Gtk::Stock::CLOSE),
-                          sigc::mem_fun(gtkWindow(), 
-                                        &Gtk::Window::hide));                  
+                          sigc::mem_fun(gtkWindow(),
+                                        &Gtk::Window::hide));
     m_refActionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
-                          sigc::mem_fun(*Application::app(), 
-                                        &Application::quit));  
+                          sigc::mem_fun(*Application::app(),
+                                        &Application::quit));
 
     m_refActionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
 
@@ -110,16 +106,16 @@ void MgWindow::init_actions()
     m_refActionGroup->add(Gtk::Action::create("Paste", Gtk::Stock::PASTE));
     m_refActionGroup->add(Gtk::Action::create("Delete", Gtk::Stock::DELETE));
 
-    m_refActionGroup->add(Gtk::Action::create("Preferences", 
+    m_refActionGroup->add(Gtk::Action::create("Preferences",
                                               Gtk::Stock::PREFERENCES),
                           sigc::mem_fun(*this,
                                         &MgWindow::on_preferences));
 
     m_refActionGroup->add(Gtk::Action::create("MenuTools", _("_Tools")));
-    m_refActionGroup->add(Gtk::Action::create("ReloadCameras",
+    m_refActionGroup->add(Gtk::Action::create("RedetectDevices",
                                               Gtk::Stock::REFRESH),
                           Gtk::AccelKey("F5"),
-                          sigc::mem_fun(*this, &MgWindow::reload_camera_list));
+                          sigc::mem_fun(*this, &MgWindow::detect_devices));
     m_hide_tools_action = Gtk::ToggleAction::create("ToggleToolsVisible",
                                                     _("_Hide tools"));
     m_refActionGroup->add(m_hide_tools_action,
@@ -131,8 +127,8 @@ void MgWindow::init_actions()
                           sigc::mem_fun(*Application::app(),
                                         &Application::about));
 
-    Application::app()->uiManager()->insert_action_group(m_refActionGroup);            
-               
+    Application::app()->uiManager()->insert_action_group(m_refActionGroup);
+
     gtkWindow().add_accel_group(Application::app()
                                 ->uiManager()->get_accel_group());
 }
@@ -161,10 +157,10 @@ void MgWindow::init_ui(const Glib::RefPtr<Gtk::UIManager> & manager)
     "      <menuitem action='Preferences'/>"
     "    </menu>"
     "    <menu action='MenuTools'>"
-    "      <menuitem action='ReloadCameras' />"
-    "      <separator/>"        
+    "      <menuitem action='RedetectDevices' />"
+    "      <separator/>"
     "      <menuitem action='ToggleToolsVisible'/>"
-    "      <separator/>"        
+    "      <separator/>"
     "    </menu>"
     "    <menu action='MenuHelp'>"
     "      <menuitem action='Help'/>"
@@ -177,21 +173,24 @@ void MgWindow::init_ui(const Glib::RefPtr<Gtk::UIManager> & manager)
     "  </toolbar>"
     "</ui>";
   manager->add_ui_from_string(ui_info);
-} 
+}
 
 
 void MgWindow::on_action_import()
 {
+  DBG_OUT("import");
 }
 
 
 void MgWindow::on_preferences()
 {
+  DBG_OUT("prefs");
 }
 
 
-void MgWindow::reload_camera_list()
+void MgWindow::detect_devices()
 {
+  DBG_OUT("detect");
 }
 
 
diff --git a/magellan/src/mgwindow.hpp b/magellan/src/mgwindow.hpp
index ffed97e..c376236 100644
--- a/magellan/src/mgwindow.hpp
+++ b/magellan/src/mgwindow.hpp
@@ -42,34 +42,17 @@ protected:
   virtual Gtk::Widget * buildWidget(const Glib::RefPtr<Gtk::UIManager> & manager);
 
 private:
-  class CameraTreeRecord
-    : public Gtk::TreeModelColumnRecord
-  {
-  public:
-    CameraTreeRecord()
-      {
-        add(m_icon);
-        add(m_label);
-        add(m_persistent);
-      }
-
-    Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_icon;
-    Gtk::TreeModelColumn<std::string>        m_label;
-    Gtk::TreeModelColumn<bool>               m_persistent;
-  };
 
   void init_ui(const Glib::RefPtr<Gtk::UIManager> & manager);
   void init_actions();
   void on_action_import();
   void on_preferences();
 
-  void reload_camera_list();
+  void detect_devices();
 
-  CameraTreeRecord               m_camera_tree_record;
-  Glib::RefPtr<Gtk::ListStore>   m_camera_tree_model;
   Gtk::VBox                      m_vbox;
-  Gtk::HBox                      m_hbox;
   Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
+       Glib::RefPtr<Gtk::Action>      m_importAction;
 };
 
 }
diff --git a/magellan/src/mgwindow.ui b/magellan/src/mgwindow.ui
new file mode 100644
index 0000000..983c2a4
--- /dev/null
+++ b/magellan/src/mgwindow.ui
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="content_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkFrame" id="gps_device_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkBox" id="box3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">3</property>
+                    <child>
+                      <object class="GtkComboBox" id="model_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="port_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="erase_checkbtn">
+                        <property name="label" translatable="yes">_Erase after download</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;GPS Device&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="padding">8</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="format_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkBox" id="box2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">3</property>
+                    <child>
+                      <object class="GtkRadioButton" id="gpx_btn">
+                        <property name="label" translatable="yes">GPX</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="kml_btn">
+                        <property name="label" translatable="yes">KML</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">gpx_btn</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Format&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="padding">8</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="output_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkFileChooserButton" id="filechooserbutton1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">&lt;b&gt;Output&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="padding">8</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkButton" id="download_btn">
+                <property name="label" translatable="yes">Download</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">8</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="padding">8</property>
+            <property name="pack_type">end</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


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