Esempio n. 1
0
void NiepceWindow::on_action_edit_labels()
{
    DBG_OUT("edit labels");
    // get the labels.
    EditLabels::Ptr dlg(new EditLabels(getLibraryClient()));
    dlg->run_modal(shared_frame_ptr());
}
Esempio n. 2
0
void ImageListStore::on_lib_notification(const eng::LibNotification &ln)
{
    switch(ln.type) {
    case eng::Library::NotifyType::FOLDER_CONTENT_QUERIED:
    case eng::Library::NotifyType::KEYWORD_CONTENT_QUERIED:
    {
        eng::LibFile::ListPtr l 
            = boost::any_cast<eng::LibFile::ListPtr>(ln.param);
        DBG_OUT("received folder content file # %lu", l->size());
        // clear the map before the list.
        m_idmap.clear();
        clear();
        eng::LibFile::List::const_iterator iter = l->begin();
        for_each(l->begin(), l->end(),
                 [this](const eng::LibFile::Ptr & f) {
                     Gtk::TreeModel::iterator riter = append();
                     Gtk::TreeRow row = *riter;
                     Glib::RefPtr<Gdk::Pixbuf> icon = get_loading_icon();
                     row[m_columns.m_pix] = icon;
                     row[m_columns.m_libfile] = f;
                     row[m_columns.m_strip_thumb]
                         = fwk::gdkpixbuf_scale_to_fit(icon, 100);
                     m_idmap[f->id()] = riter;
                 });
        // at that point clear the cache because the icon view is populated.
        getLibraryClient()->thumbnailCache().request(l);
        break;
    }
    case eng::Library::NotifyType::METADATA_CHANGED:
    {
        eng::metadata_desc_t m = boost::any_cast<eng::metadata_desc_t>(ln.param);
        fwk::PropertyIndex prop = m.meta;
        DBG_OUT("metadata changed %s", eng::_propertyName(prop));
        // only interested in a few props
        if(is_property_interesting(prop)) {
            std::map<eng::library_id_t, Gtk::TreeIter>::const_iterator iter = m_idmap.find(m.id);
            if(iter != m_idmap.end()) {
                Gtk::TreeRow row = *(iter->second);
                //
                eng::LibFile::Ptr file = row[m_columns.m_libfile];
                file->setProperty(prop, boost::get<int>(m.value));
                row[m_columns.m_libfile] = file;
            }
        }
        break;
    }
    case eng::Library::NotifyType::XMP_NEEDS_UPDATE:
    {
        fwk::Configuration & cfg = fwk::Application::app()->config();
        int write_xmp = false;
        Glib::ustring xmp_pref;
        try {
            xmp_pref = cfg.getValue("write_xmp_automatically", "0");
            write_xmp = std::stoi(xmp_pref);
        }
        catch(const std::exception & e)
        {
            ERR_OUT("couldn't cast %s: %s", xmp_pref.c_str(),
                    e.what());
        }
        getLibraryClient()->processXmpUpdateQueue(write_xmp);
        break;
    }
    default:
        break;
    }
}
Esempio n. 3
0
void
NiepceWindow::_createModuleShell()
{
    DBG_ASSERT(static_cast<bool>(m_libClient), "libclient not initialized");
    DBG_ASSERT(m_widget, "widget not built");

    DBG_OUT("creating module shell");

    // main view
    m_moduleshell = ModuleShell::Ptr(
        new ModuleShell(getLibraryClient()));
    m_moduleshell->buildWidget();

    add(m_moduleshell);

    m_notifcenter->signal_lib_notification
        .connect(sigc::mem_fun(
                     *m_moduleshell->get_gridview(),
                     &GridViewModule::on_lib_notification));
    m_notifcenter->signal_lib_notification
        .connect(sigc::mem_fun(
                     *get_pointer(m_moduleshell->get_list_store()),
                     &ImageListStore::on_lib_notification));
    m_notifcenter->signal_lib_notification
        .connect(sigc::mem_fun(
                     *m_moduleshell->get_map_module(),
                     &mapm::MapModule::on_lib_notification));
    m_notifcenter->signal_thumbnail_notification
        .connect(sigc::mem_fun(
                     *get_pointer(m_moduleshell->get_list_store()),
                     &ImageListStore::on_tnail_notification));


    // workspace treeview
    auto workspace_actions = Gio::SimpleActionGroup::create();
    gtkWindow().insert_action_group("workspace", workspace_actions);
    m_workspacectrl = WorkspaceController::Ptr(new WorkspaceController(workspace_actions));
    m_workspacectrl->libtree_selection_changed.connect(
        sigc::mem_fun(*m_moduleshell, &ModuleShell::on_content_will_change));

    m_notifcenter->signal_lib_notification
        .connect(sigc::mem_fun(*m_workspacectrl,
                               &WorkspaceController::on_lib_notification));
    add(m_workspacectrl);

    m_hbox.set_border_width(4);
    m_hbox.set_wide_handle(true);
    m_hbox.pack1(*(m_workspacectrl->buildWidget()), Gtk::EXPAND);
    m_hbox.pack2(*(m_moduleshell->buildWidget()), Gtk::EXPAND);
    m_databinders.add_binder(new fwk::ConfigDataBinder<int>(m_hbox.property_position(),
                                                                  Application::app()->config(),
                                                                  "workspace_splitter"));

    static_cast<Gtk::Window*>(m_widget)->add(m_vbox);

    static_cast<Gtk::ApplicationWindow&>(gtkWindow()).set_show_menubar(true);
    m_vbox.pack_start(m_hbox);


    SelectionController::Ptr selection_controller = m_moduleshell->get_selection_controller();
    m_filmstrip = FilmStripController::Ptr(
        new FilmStripController(m_moduleshell->get_list_store(), *m_moduleshell));
    add(m_filmstrip);

    m_vbox.pack_start(*(m_filmstrip->buildWidget()), Gtk::PACK_SHRINK);

    // status bar
    m_vbox.pack_start(m_statusBar, Gtk::PACK_SHRINK);
    m_statusBar.push(Glib::ustring(_("Ready")));

    selection_controller->add_selectable(m_filmstrip);

    m_vbox.show_all_children();
    m_vbox.show();
}