found one more window to gladeify; I think this was really the last one
This commit is contained in:
parent
fb8749e3ae
commit
72f0c75592
12 changed files with 330 additions and 244 deletions
|
@ -154,7 +154,6 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \
|
||||||
${TMP_DIR}/DialogWindow.o \
|
${TMP_DIR}/DialogWindow.o \
|
||||||
${TMP_DIR}/ScrolledWindow.o \
|
${TMP_DIR}/ScrolledWindow.o \
|
||||||
${TMP_DIR}/ScrolledNotebook.o \
|
${TMP_DIR}/ScrolledNotebook.o \
|
||||||
${TMP_DIR}/DateTimeChooserWindow.o \
|
|
||||||
${TMP_DIR}/RadioButtons.o \
|
${TMP_DIR}/RadioButtons.o \
|
||||||
${TMP_DIR}/MasterPanelBin.o \
|
${TMP_DIR}/MasterPanelBin.o \
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
#include "LiveSupport/Widgets/EntryBin.h"
|
#include "LiveSupport/Widgets/EntryBin.h"
|
||||||
#include "LiveSupport/Widgets/DialogWindow.h"
|
#include "LiveSupport/Widgets/DialogWindow.h"
|
||||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||||
#include "LiveSupport/Widgets/DateTimeChooserWindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
|
@ -418,19 +417,6 @@ class WidgetFactory :
|
||||||
Ptr<ResourceBundle>::Ref bundle,
|
Ptr<ResourceBundle>::Ref bundle,
|
||||||
int buttons = DialogWindow::okButton)
|
int buttons = DialogWindow::okButton)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a DateTimeChooserWindow.
|
|
||||||
* It lets the user select a date/time.
|
|
||||||
* It is the reponsibility of the caller to dispose of the created
|
|
||||||
* object properly.
|
|
||||||
*
|
|
||||||
* @param bundle localization for the button(s).
|
|
||||||
* @return the DateTimeChooserWindow object.
|
|
||||||
*/
|
|
||||||
DateTimeChooserWindow *
|
|
||||||
createDateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle)
|
|
||||||
throw ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,174 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2004 Media Development Loan Fund
|
|
||||||
|
|
||||||
This file is part of the Campcaster project.
|
|
||||||
http://campcaster.campware.org/
|
|
||||||
To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
|
|
||||||
Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Campcaster is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Campcaster; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
|
||||||
Version : $Revision$
|
|
||||||
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx $
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
|
||||||
#include "LiveSupport/Widgets/Colors.h"
|
|
||||||
#include "LiveSupport/Widgets/Button.h"
|
|
||||||
|
|
||||||
#include "LiveSupport/Widgets/DateTimeChooserWindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LiveSupport::Widgets;
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Constructor.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
DateTimeChooserWindow :: DateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle)
|
|
||||||
throw ()
|
|
||||||
: WhiteWindow(Colors::White,
|
|
||||||
WidgetFactory::getInstance()->getWhiteWindowCorners(),
|
|
||||||
WhiteWindow::hasNoTitle || WhiteWindow::isModal),
|
|
||||||
LocalizedObject(bundle)
|
|
||||||
{
|
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
|
||||||
|
|
||||||
Gtk::Label * hourLabel;
|
|
||||||
Gtk::Label * minuteLabel;
|
|
||||||
Button * cancelButton;
|
|
||||||
Button * okButton;
|
|
||||||
|
|
||||||
try {
|
|
||||||
set_title(*getResourceUstring("windowTitle"));
|
|
||||||
hourLabel = Gtk::manage(new Gtk::Label(
|
|
||||||
*getResourceUstring("hourLabel")));
|
|
||||||
minuteLabel = Gtk::manage(new Gtk::Label(
|
|
||||||
*getResourceUstring("minuteLabel")));
|
|
||||||
cancelButton = Gtk::manage(wf->createButton(
|
|
||||||
*getResourceUstring("cancelButtonLabel")));
|
|
||||||
okButton = Gtk::manage(wf->createButton(
|
|
||||||
*getResourceUstring("okButtonLabel")));
|
|
||||||
} catch (std::invalid_argument &e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
calendar = Gtk::manage(new Gtk::Calendar());
|
|
||||||
hourEntry = Gtk::manage(wf->createEntryBin());
|
|
||||||
minuteEntry = Gtk::manage(wf->createEntryBin());
|
|
||||||
|
|
||||||
cancelButton->signal_clicked().connect(sigc::mem_fun(*this,
|
|
||||||
&DateTimeChooserWindow::onCancelButtonClicked));
|
|
||||||
okButton->signal_clicked().connect(sigc::mem_fun(*this,
|
|
||||||
&DateTimeChooserWindow::onOkButtonClicked));
|
|
||||||
|
|
||||||
Gtk::ButtonBox * buttonBox = Gtk::manage(new Gtk::HButtonBox(
|
|
||||||
Gtk::BUTTONBOX_END, 5));
|
|
||||||
buttonBox->pack_start(*cancelButton);
|
|
||||||
buttonBox->pack_start(*okButton);
|
|
||||||
|
|
||||||
Gtk::Box * entryBox = Gtk::manage(new Gtk::HBox());
|
|
||||||
entryBox->pack_start(*hourLabel, Gtk::PACK_SHRINK, 5);
|
|
||||||
entryBox->pack_start(*hourEntry, Gtk::PACK_EXPAND_WIDGET, 5);
|
|
||||||
entryBox->pack_start(*minuteLabel, Gtk::PACK_SHRINK, 5);
|
|
||||||
entryBox->pack_start(*minuteEntry, Gtk::PACK_EXPAND_WIDGET, 5);
|
|
||||||
|
|
||||||
Gtk::Box * layout = Gtk::manage(new Gtk::VBox());
|
|
||||||
layout->pack_start(*calendar, Gtk::PACK_EXPAND_WIDGET, 5);
|
|
||||||
layout->pack_start(*entryBox, Gtk::PACK_SHRINK, 5);
|
|
||||||
layout->pack_start(*buttonBox, Gtk::PACK_SHRINK, 5);
|
|
||||||
|
|
||||||
set_default_size(200, 300);
|
|
||||||
|
|
||||||
add(*layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Event handler for the Cancel button clicked
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
DateTimeChooserWindow :: onCancelButtonClicked(void) throw ()
|
|
||||||
{
|
|
||||||
chosenDateTime.reset();
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Event handler for the OK button clicked.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
DateTimeChooserWindow :: onOkButtonClicked(void) throw ()
|
|
||||||
{
|
|
||||||
std::stringstream dateTime;
|
|
||||||
|
|
||||||
guint year;
|
|
||||||
guint month;
|
|
||||||
guint day;
|
|
||||||
calendar->get_date(year, month, day);
|
|
||||||
dateTime << std::setfill('0') << std::setw(4)
|
|
||||||
<< year
|
|
||||||
<< std::setfill('0') << std::setw(2)
|
|
||||||
<< month + 1
|
|
||||||
<< std::setfill('0') << std::setw(2)
|
|
||||||
<< day;
|
|
||||||
|
|
||||||
Glib::ustring hour = hourEntry ->get_text().substr(0,2);
|
|
||||||
Glib::ustring minute = minuteEntry->get_text().substr(0,2);
|
|
||||||
dateTime << "T"
|
|
||||||
<< std::setfill('0') << std::setw(2)
|
|
||||||
<< hour
|
|
||||||
<< std::setfill('0') << std::setw(2)
|
|
||||||
<< minute
|
|
||||||
<< "00";
|
|
||||||
|
|
||||||
chosenDateTime.reset(new ptime(from_iso_string(dateTime.str())));
|
|
||||||
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Show the window and return the button clicked.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
Ptr<const ptime>::Ref
|
|
||||||
DateTimeChooserWindow :: run(void) throw ()
|
|
||||||
{
|
|
||||||
show_all();
|
|
||||||
Gtk::Main::run(*this);
|
|
||||||
return chosenDateTime;
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
#include <unicode/resbund.h>
|
#include <unicode/resbund.h>
|
||||||
#include <gtkmm/entry.h>
|
#include <gtkmm/entry.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "LiveSupport/Widgets/Colors.h"
|
#include "LiveSupport/Widgets/Colors.h"
|
||||||
|
|
||||||
|
@ -697,17 +699,6 @@ WidgetFactory :: createDialogWindow(Ptr<const Glib::ustring>::Ref message,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Create a date/time chooser window.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
DateTimeChooserWindow *
|
|
||||||
WidgetFactory :: createDateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle)
|
|
||||||
throw ()
|
|
||||||
{
|
|
||||||
return new DateTimeChooserWindow(bundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Convert an integer to a string.
|
* Convert an integer to a string.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -276,6 +276,7 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
|
||||||
${TMP_DIR}/KeyboardShortcutContainer.o \
|
${TMP_DIR}/KeyboardShortcutContainer.o \
|
||||||
${TMP_DIR}/KeyboardShortcutList.o \
|
${TMP_DIR}/KeyboardShortcutList.o \
|
||||||
${TMP_DIR}/OptionsWindow.o \
|
${TMP_DIR}/OptionsWindow.o \
|
||||||
|
${TMP_DIR}/DateTimeChooserWindow.o \
|
||||||
${TMP_DIR}/BackupList.o \
|
${TMP_DIR}/BackupList.o \
|
||||||
${TMP_DIR}/BackupView.o \
|
${TMP_DIR}/BackupView.o \
|
||||||
${TMP_DIR}/ExportPlaylistWindow.o \
|
${TMP_DIR}/ExportPlaylistWindow.o \
|
||||||
|
|
|
@ -101,8 +101,7 @@ BackupView :: BackupView (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
constructCriteriaView();
|
constructCriteriaView();
|
||||||
constructBackupListView();
|
constructBackupListView();
|
||||||
|
|
||||||
dateTimeChooserWindow.reset(new DateTimeChooserWindow(
|
dateTimeChooserWindow.reset(new DateTimeChooserWindow(gLiveSupport));
|
||||||
gLiveSupport->getBundle("dateTimeChooserWindow") ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/LocalizedObject.h"
|
#include "LiveSupport/Core/LocalizedObject.h"
|
||||||
#include "LiveSupport/Core/TimeConversion.h"
|
#include "LiveSupport/Core/TimeConversion.h"
|
||||||
#include "LiveSupport/Widgets/DateTimeChooserWindow.h"
|
#include "DateTimeChooserWindow.h"
|
||||||
#include "AdvancedSearchEntry.h"
|
#include "AdvancedSearchEntry.h"
|
||||||
#include "BackupList.h"
|
#include "BackupList.h"
|
||||||
#include "GLiveSupport.h"
|
#include "GLiveSupport.h"
|
||||||
|
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the Campcaster project.
|
||||||
|
http://campcaster.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
Campcaster is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Campcaster is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Campcaster; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL: svn+ssh://fgerlits@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/widgets/src/DateTimeChooserWindow.cxx $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "DateTimeChooserWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the glade file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const Glib::ustring gladeFileName = "DateTimeChooserWindow.glade";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Constructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
DateTimeChooserWindow :: DateTimeChooserWindow(
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<ResourceBundle>::Ref
|
||||||
|
bundle = gLiveSupport->getBundle("dateTimeChooserWindow");
|
||||||
|
setBundle(bundle);
|
||||||
|
|
||||||
|
Glib::ustring gladeDir = gLiveSupport->getGladeDir();
|
||||||
|
Glib::RefPtr<Gnome::Glade::Xml>
|
||||||
|
glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName);
|
||||||
|
|
||||||
|
glade->get_widget("mainWindow1", mainWindow);
|
||||||
|
mainWindow->set_title(*getResourceUstring("windowTitle"));
|
||||||
|
|
||||||
|
Gtk::Label * hourLabel;
|
||||||
|
Gtk::Label * minuteLabel;
|
||||||
|
glade->get_widget("hourLabel1", hourLabel);
|
||||||
|
glade->get_widget("minuteLabel1", minuteLabel);
|
||||||
|
hourLabel->set_label(*getResourceUstring("hourLabel"));
|
||||||
|
minuteLabel->set_label(*getResourceUstring("minuteLabel"));
|
||||||
|
|
||||||
|
glade->get_widget("calendar1", calendar);
|
||||||
|
glade->get_widget("hourSpinButton1", hourEntry);
|
||||||
|
glade->get_widget("minuteSpinButton1", minuteEntry);
|
||||||
|
|
||||||
|
glade->get_widget("okButton1", okButton);
|
||||||
|
okButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&DateTimeChooserWindow::onOkButtonClicked));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the OK button clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DateTimeChooserWindow :: onOkButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
unsigned int year;
|
||||||
|
unsigned int month;
|
||||||
|
unsigned int day;
|
||||||
|
calendar->get_date(year, month, day);
|
||||||
|
++month; // Gtk+ months are 0-based, Boost months are 1-based
|
||||||
|
|
||||||
|
int hours = hourEntry->get_value_as_int();
|
||||||
|
int minutes = minuteEntry->get_value_as_int();
|
||||||
|
|
||||||
|
chosenDateTime.reset(new boost::posix_time::ptime(
|
||||||
|
boost::gregorian::date(year, month, day),
|
||||||
|
boost::posix_time::time_duration(hours, minutes, 0) ));
|
||||||
|
|
||||||
|
mainWindow->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Show the window and return the button clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<const ptime>::Ref
|
||||||
|
DateTimeChooserWindow :: run(void) throw ()
|
||||||
|
{
|
||||||
|
chosenDateTime.reset();
|
||||||
|
Gtk::Main::run(*mainWindow);
|
||||||
|
return chosenDateTime;
|
||||||
|
}
|
||||||
|
|
|
@ -40,23 +40,20 @@
|
||||||
#include "configure.h"
|
#include "configure.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm.h>
|
||||||
#include <gtkmm/label.h>
|
#include <libglademm.h>
|
||||||
#include <gtkmm/calendar.h>
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||||
#include <gtkmm/main.h>
|
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/LocalizedObject.h"
|
#include "LiveSupport/Core/LocalizedObject.h"
|
||||||
#include "LiveSupport/Widgets/EntryBin.h"
|
#include "GLiveSupport.h"
|
||||||
|
|
||||||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
namespace Widgets {
|
namespace GLiveSupport {
|
||||||
|
|
||||||
using namespace LiveSupport::Core;
|
using namespace LiveSupport::Core;
|
||||||
using namespace boost::posix_time;
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
@ -69,10 +66,6 @@ using namespace boost::posix_time;
|
||||||
/**
|
/**
|
||||||
* A dialog window for choosing a date/time.
|
* A dialog window for choosing a date/time.
|
||||||
*
|
*
|
||||||
* The constructor is called with a resource bundle. The resource bundle
|
|
||||||
* is expected to contain keys named cancelButtonLabel, okButtonLabel,
|
|
||||||
* hourLabel and minuteLabel.
|
|
||||||
*
|
|
||||||
* The return value of the run() method is a boost::posix_time::ptime value.
|
* The return value of the run() method is a boost::posix_time::ptime value.
|
||||||
* The DateTimeChooserWindow object is not destroyed when it returns from
|
* The DateTimeChooserWindow object is not destroyed when it returns from
|
||||||
* run(); it is the responsibility of the caller to delete it (or it can be
|
* run(); it is the responsibility of the caller to delete it (or it can be
|
||||||
|
@ -81,53 +74,60 @@ using namespace boost::posix_time;
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class DateTimeChooserWindow : public WhiteWindow,
|
class DateTimeChooserWindow : public LocalizedObject
|
||||||
public LocalizedObject
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main window for this class.
|
||||||
|
*/
|
||||||
|
Gtk::Dialog * mainWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The calendar where the date is chosen.
|
* The calendar where the date is chosen.
|
||||||
*/
|
*/
|
||||||
Gtk::Calendar * calendar;
|
Gtk::Calendar * calendar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry field for the hour.
|
* The entry field for hours.
|
||||||
*/
|
*/
|
||||||
EntryBin * hourEntry;
|
Gtk::SpinButton * hourEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry field for the minute.
|
* The entry field for minutes.
|
||||||
*/
|
*/
|
||||||
EntryBin * minuteEntry;
|
Gtk::SpinButton * minuteEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The return value; set to 0 if the user pressed Cancel.
|
* The OK button
|
||||||
*/
|
*/
|
||||||
Ptr<ptime>::Ref chosenDateTime;
|
Gtk::Button * okButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The return value; set to 0 if the user closed the window.
|
||||||
|
*/
|
||||||
|
Ptr<boost::posix_time::ptime>::Ref chosenDateTime;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
|
||||||
* The event handler for the Cancel button clicked.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
onCancelButtonClicked(void) throw ();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event handler for the OK button clicked.
|
* The event handler for the OK button clicked.
|
||||||
*/
|
*/
|
||||||
void
|
virtual void
|
||||||
onOkButtonClicked(void) throw ();
|
onOkButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param bundle a resource bundle containing the localized
|
* @param gLiveSupport the gLiveSupport object, containing
|
||||||
* button labels
|
* all the vital info.
|
||||||
*/
|
*/
|
||||||
DateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle) throw ();
|
DateTimeChooserWindow(Ptr<GLiveSupport>::Ref gLiveSupport)
|
||||||
|
throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A virtual destructor, as this class has virtual functions.
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
@ -142,7 +142,7 @@ class DateTimeChooserWindow : public WhiteWindow,
|
||||||
* The returned value may be a 0 pointer (if the user pressed Cancel),
|
* The returned value may be a 0 pointer (if the user pressed Cancel),
|
||||||
* and it may be not_a_date_time, if the user's selection is invalid.
|
* and it may be not_a_date_time, if the user's selection is invalid.
|
||||||
*/
|
*/
|
||||||
Ptr<const ptime>::Ref
|
Ptr<const boost::posix_time::ptime>::Ref
|
||||||
run(void) throw ();
|
run(void) throw ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -153,7 +153,7 @@ class DateTimeChooserWindow : public WhiteWindow,
|
||||||
/* ====================================================== function prototypes */
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
} // namespace Widgets
|
} // namespace GLiveSupport
|
||||||
} // namespace LiveSupport
|
} // namespace LiveSupport
|
||||||
|
|
||||||
#endif // DateTimeChooserWindow_h
|
#endif // DateTimeChooserWindow_h
|
|
@ -1413,6 +1413,17 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
updateRds(void) throw ();
|
updateRds(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the directory where the Glade files are.
|
||||||
|
*
|
||||||
|
* @return the directory where the Glade files are.
|
||||||
|
*/
|
||||||
|
Glib::ustring
|
||||||
|
getGladeDir(void) throw ()
|
||||||
|
{
|
||||||
|
return gladeDir;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
/* ================================================= external data structures */
|
||||||
|
|
|
@ -133,13 +133,8 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw ()
|
||||||
int seconds = secondEntry->get_value_as_int();
|
int seconds = secondEntry->get_value_as_int();
|
||||||
|
|
||||||
Ptr<boost::posix_time::ptime>::Ref dateTime(new boost::posix_time::ptime(
|
Ptr<boost::posix_time::ptime>::Ref dateTime(new boost::posix_time::ptime(
|
||||||
boost::gregorian::date(year,
|
boost::gregorian::date(year, month, day),
|
||||||
month,
|
boost::posix_time::time_duration(hours, minutes, seconds) ));
|
||||||
day),
|
|
||||||
boost::posix_time::time_duration(
|
|
||||||
hours,
|
|
||||||
minutes,
|
|
||||||
seconds) ));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gLiveSupport->schedulePlaylist(playlist, dateTime);
|
gLiveSupport->schedulePlaylist(playlist, dateTime);
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
|
<!--Generated with glade3 3.2.0 on Fri Aug 3 14:26:13 2007 by fgerlits@desktop-->
|
||||||
|
<glade-interface>
|
||||||
|
<widget class="GtkDialog" id="mainWindow1">
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="border_width">8</property>
|
||||||
|
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||||
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
|
<property name="has_separator">False</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<widget 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="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<widget 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="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCalendar" id="calendar1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox1">
|
||||||
|
<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="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<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="spacing">3</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="hourLabel1">
|
||||||
|
<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="label" translatable="yes">hours:</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSpinButton" id="hourSpinButton1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">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="adjustment">0 0 23 1 10 10</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox3">
|
||||||
|
<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="spacing">3</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="minuteLabel1">
|
||||||
|
<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="label" translatable="yes">minutes:</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSpinButton" id="minuteSpinButton1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">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="adjustment">0 0 59 1 10 10</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
|
<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="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="okButton1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">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="label" translatable="yes">gtk-ok</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="response_id">-5</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</glade-interface>
|
Loading…
Add table
Add a link
Reference in a new issue