Example #1
0
void AddCalendarPage::saveClicked()
{
    m_manager->saveCollection(&m_collection);
    if (m_manager->error())
        QMessageBox::warning(this, "Failed!", QString("Failed to save calendar!\n(error code %1)").arg(m_manager->error()));
    else
        emit showPreviousPage();
}
void AddCalendarPage::saveClicked()
{
#if defined(Q_WS_MAEMO_5)
    m_collection.setMetaData("Name", m_nameEdit->text());
#endif

    m_manager->saveCollection(&m_collection);
    if (m_manager->error())
        QMessageBox::warning(this, "Failed!", QString("Failed to save calendar!\n(error code %1)").arg(m_manager->error()));
    else
        emit showPreviousPage();
}
void ofxUIPageManager::guiEvent(ofxUIEventArgs &e){
    string name = e.widget->getName();
    // Event listener for all gui pages
    if (e.widget->getKind() == OFX_UI_WIDGET_BUTTON) {
        ofxUIButton* w = (ofxUIButton*)e.widget;
        if (w->getValue()) {
            if(name == UI_SAVE_LABEL){
                // get the widget parent which will be a page (ofxUICanvas)
                ofxUICanvas* page = (ofxUICanvas*)e.widget->getParent();
                string pageName = page->getName();
                string path = getPath(pageName);
                ofLogNotice() << "ofxUIPageManager::saving " << path;
                page->saveSettings(path);
            }
            else if(name == "<" && w->getValue()){
                w->mouseReleased(0, 0, true);
                showPreviousPage();
            }
            else if(name == ">" && w->getValue()){
                w->mouseReleased(0, 0, true);
                showNextPage();
            }
        }
    }
    // Page manager specific
    else if(name == "bg r"){
        ofxUISlider *slider = (ofxUISlider *) e.widget;
        bgColour.r = slider->getScaledValue();
        updateAllPages();
    } else if(name == "bg g"){
        ofxUISlider *slider = (ofxUISlider *) e.widget;
        bgColour.g = slider->getScaledValue();
        updateAllPages();
    } else if(name == "bg b"){
        ofxUISlider *slider = (ofxUISlider *) e.widget;
        bgColour.b = slider->getScaledValue();
        updateAllPages();
    } else if(name == "bg a"){
        ofxUISlider *slider = (ofxUISlider *) e.widget;
        bgColour.a = slider->getScaledValue();
        updateAllPages();
    } else if (name == "show page list") {
        pageList->setVisible(isPageListVisible);
        updateAllPages();
    }
}
Example #4
0
LibraryCollectionLayer::LibraryCollectionLayer( QWidget* parent ) :
    GestureWidget(parent) , m_page(0)
{
    setupUi(this);

    items.append(collectionItem0);
    items.append(collectionItem1);
    items.append(collectionItem2);
    items.append(collectionItem3);

    connect(collectionItem0,        SIGNAL(tap(int)),           this, SLOT(changeCollection(int)));
    connect(collectionItem1,        SIGNAL(tap(int)),           this, SLOT(changeCollection(int)));
    connect(collectionItem2,        SIGNAL(tap(int)),           this, SLOT(changeCollection(int)));
    connect(collectionItem3,        SIGNAL(tap(int)),           this, SLOT(changeCollection(int)));
    connect(VerticalPagerPopup,     SIGNAL(nextPageReq()),      this, SLOT(showNextPage()));
    connect(VerticalPagerPopup,     SIGNAL(previousPageReq()),  this, SLOT(showPreviousPage()));
    connect(addNewCollection,       SIGNAL(clicked()),          this, SIGNAL(createCollection()));
}
void ofxUIPageManager::keyPressed(ofKeyEventArgs &e) {
	int key = e.key;
	switch (key) {
        case '[':
        case '-':
            showPreviousPage();
            break;
        case ']':
        case '+':
            showNextPage();
            break;
        case ' ':
            if (isVisible) hide();
            else show();
            break;
        default:
            break;
    }
}
void AddCalendarPage::cancelClicked()
{
    emit showPreviousPage();
}
Example #7
0
QTM_USE_NAMESPACE

CalendarDemo::CalendarDemo(QWidget *parent)
    :QMainWindow(parent),
    m_stackedWidget(0),
    m_monthPage(0),
    m_dayPage(0),
    m_eventEditPage(0),
    m_eventOccurrenceEditPage(0)
{
    m_stackedWidget = new QStackedWidget(this);

    m_dayPage = new DayPage(m_stackedWidget);
    m_monthPage = new MonthPage(m_stackedWidget);
    m_eventEditPage = new EventEditPage(m_stackedWidget);
    m_todoEditPage = new TodoEditPage(m_stackedWidget);
    m_journalEditPage = new JournalEditPage(m_stackedWidget);
    m_eventOccurrenceEditPage = new EventOccurrenceEditPage(m_stackedWidget);
    m_addCalendarPage = new AddCalendarPage(m_stackedWidget);
    m_editCalendarsPage = new EditCalendarsPage(m_stackedWidget);

    //qRegisterMetaType<QOrganizerManager>("QOrganizerManager");
    qRegisterMetaType<QOrganizerItem>("QOrganizerItem");
    qRegisterMetaType<QOrganizerItemId>("QOrganizerItemId");
    qRegisterMetaType<QOrganizerCollection>("QOrganizerCollection");
    qRegisterMetaType<QOrganizerAbstractRequest::State>("QOrganizerAbstractRequest::State");

    connect(m_monthPage, SIGNAL(showDayPage(QDate)), this, SLOT(activateDayPage()), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(showEditPage(const QOrganizerItem &)), this, SLOT(activateEditPage(const QOrganizerItem &)), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(addNewEvent()), this, SLOT(addNewEvent()), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(addNewTodo()), this, SLOT(addNewTodo()), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(managerChanged(QOrganizerManager*)), this, SLOT(changeManager(QOrganizerManager*)), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(managerChanged(QOrganizerManager*)), m_dayPage, SLOT(changeManager(QOrganizerManager*)), Qt::QueuedConnection);
    connect(m_monthPage, SIGNAL(currentDayChanged(QDate)), this, SLOT(updateSelectedDay(QDate)));
    connect(m_dayPage, SIGNAL(showMonthPage()), this, SLOT(activateMonthPage()), Qt::QueuedConnection);
    connect(m_dayPage, SIGNAL(showEditPage(const QOrganizerItem &)), this, SLOT(activateEditPage(const QOrganizerItem &)), Qt::QueuedConnection);
    connect(m_dayPage, SIGNAL(addNewEvent()), this, SLOT(addNewEvent()), Qt::QueuedConnection);
    connect(m_dayPage, SIGNAL(addNewTodo()), this, SLOT(addNewTodo()), Qt::QueuedConnection);
    connect(m_eventEditPage, SIGNAL(showDayPage()), this, SLOT(activateDayPage()), Qt::QueuedConnection);
    connect(m_todoEditPage, SIGNAL(showDayPage()), this, SLOT(activateDayPage()), Qt::QueuedConnection);
    connect(m_journalEditPage, SIGNAL(showDayPage()), this, SLOT(activateDayPage()), Qt::QueuedConnection);
    connect(m_eventOccurrenceEditPage, SIGNAL(showDayPage()), this, SLOT(activateDayPage()), Qt::QueuedConnection);
    connect(m_addCalendarPage, SIGNAL(showPreviousPage()), this, SLOT(activatePreviousPage()), Qt::QueuedConnection);
    connect(m_editCalendarsPage, SIGNAL(showAddCalendarPage(QOrganizerManager*,QOrganizerCollection*)), this, SLOT(editExistingCalendar(QOrganizerManager*,QOrganizerCollection*)), Qt::QueuedConnection);
    connect(m_editCalendarsPage, SIGNAL(showPreviousPage()), this, SLOT(activateMonthPage()), Qt::QueuedConnection);
    connect(m_editCalendarsPage, SIGNAL(addClicked()), this, SLOT(addCalendar()), Qt::QueuedConnection);

    // Connect to the save and remove request status change signals
    connect(&m_saveReq, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)),
            this, SLOT(saveReqStateChanged(QOrganizerAbstractRequest::State)));
    connect(&m_remReq, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)),
            this, SLOT(removeReqStateChanged(QOrganizerAbstractRequest::State)));

    m_monthPage->init();
    
    m_stackedWidget->addWidget(m_monthPage);
    m_stackedWidget->addWidget(m_dayPage);
    m_stackedWidget->addWidget(m_eventEditPage);
    m_stackedWidget->addWidget(m_todoEditPage);
    m_stackedWidget->addWidget(m_journalEditPage);
    m_stackedWidget->addWidget(m_eventOccurrenceEditPage);
    m_stackedWidget->addWidget(m_addCalendarPage);
    m_stackedWidget->addWidget(m_editCalendarsPage);
    m_stackedWidget->setCurrentIndex(0);

    setCentralWidget(m_stackedWidget);
    buildMenu();

    activateMonthPage();
}
void EditCalendarsPage::backClicked()
{
    emit showPreviousPage();
}