ContainerWidget * MultiViewWidget::createContainer(QWidget *widget) { ContainerWidget *container = new ContainerWidget; connect(container, SIGNAL(splitHorizontal()), SLOT(splitHorizontal())); connect(container, SIGNAL(splitVertical()), SLOT(splitVertical())); connect(container, SIGNAL(closeView()), SLOT(removeView())); if (widget) { container->setViewWidget(widget); } // If we have a factory, then create the options widget too! else if (m_factory) { QWidget *optionsWidget = new QWidget; QVBoxLayout *v = new QVBoxLayout; optionsWidget->setLayout(v); v->addStretch(); foreach (const QString &name, m_factory->views()) { QPushButton *button = new QPushButton(name); button->setToolTip(tr("Create a new view")); connect(button, SIGNAL(clicked()), SLOT(createView())); QHBoxLayout *h = new QHBoxLayout; h->addStretch(); h->addWidget(button); h->addStretch(); v->addLayout(h); } v->addStretch(); container->layout()->addWidget(optionsWidget); } return container; }
bool MonthView::eventFilter(QObject *o, QEvent *e) { if ( e->type() == QEvent::KeyPress) { QKeyEvent* ke = static_cast<QKeyEvent*>(e); if (ke->key() == Qt::Key_Back) { emit closeView(); ke->accept(); return true; } } return QCalendarWidget::eventFilter(o, e); }
void AppointmentPicker::initMonth() { if ( !monthView ) { monthView = new MonthView(0, QCategoryFilter(), mSources); monthView->setHorizontalHeaderFormat(QCalendarWidget::SingleLetterDayNames); QSoftMenuBar::setLabel(monthView, Qt::Key_Back, QSoftMenuBar::Cancel); // TODO monthView->setMargin(0); views->addWidget( monthView ); connect( monthView, SIGNAL(activated(QDate)), this, SLOT(viewDay(QDate)) ); connect( monthView, SIGNAL(closeView()), this, SLOT(reject())); } }
void AlarmView::snoozeClicked() { mAlarmTimer.stop(); /* Snooze for some amount of time (configured in settings, say) */ int snoozeindex = mSnoozeChoices->currentIndex(); int snoozedelay = 60; // Make sure we set alarms on the minute by rounding QDateTime now = QDateTime::currentDateTime(); int seconds = now.time().second(); if (seconds >= 30) now = now.addSecs(60 - seconds); else now = now.addSecs(-seconds); switch(snoozeindex) { case 0: // 5 minutes snoozedelay = 300; break; case 1: // 10 minutes snoozedelay = 600; break; case 2: // 15 minutes snoozedelay = 900; break; case 3: // 30 minutes snoozedelay = 1800; break; case 4: // 1 hour snoozedelay = 3600; break; case 5: // 1 day snoozedelay = 24 * 60; break; case 6: // 1 week snoozedelay = 7 * 24 * 60; break; case 7: // 1 month hmm { QDateTime then = now.addMonths(1); snoozedelay = now.secsTo(then); } break; } QDateTime snoozeTime = now.addSecs(snoozedelay); Qtopia::addAlarm(snoozeTime, "Calendar", "alarm(QDateTime,int)", snoozeTime.secsTo(mStartTime) / 60); emit closeView(); }
void AppointmentPicker::initDay() { if ( !dayView ) { dayView = new DayView(0, QCategoryFilter(), mSources); views->addWidget( dayView ); int endTime = qMin(qMax(datebook->startTime + 8, 17), 24); dayView->setDaySpan( datebook->startTime, endTime ); QSoftMenuBar::setLabel(dayView, Qt::Key_Back, QSoftMenuBar::Back); connect( dayView, SIGNAL(showDetails()), this, SLOT(accept()) ); connect( dayView, SIGNAL(closeView()), this, SLOT(viewMonthAgain()) ); } }
void AlarmView::keyPressEvent( QKeyEvent * ke) { mAlarmTimer.stop(); switch (ke->key()) { case Qt::Key_Select: if (mModel && mAlarmList->currentIndex().isValid()) emit showAlarmDetails(selectedOccurrence()); break; case Qt::Key_Back: emit closeView(); break; default: QWidget::keyPressEvent(ke); } }
TestNSPlugin::TestNSPlugin() { m_loader = NSPluginLoader::instance(); // client area m_client = new QWidget( this, "m_client" ); setCentralWidget( m_client ); m_client->show(); m_layout = new QHBoxLayout( m_client ); // file menu KStdAction::openNew( this, SLOT(newView()), actionCollection()); KStdAction::close( this, SLOT(closeView()), actionCollection()); KStdAction::quit( kapp, SLOT(quit()), actionCollection()); createGUI( "testnspluginui.rc" ); }
void WatchVector::detachData() { PixelBox *f = static_cast<PixelBox*>(sender()); int idx = getIndexFromPixelBox(f); if (idx != -1) { m_nActiveMappings--; m_pData[idx] = NULL; m_qName[idx] = QString("NULL"); m_bNeedsUpdate = true; delMappingOptions(idx); } if (m_nActiveMappings == 0) { closeView(); } }
void TabbedWebView::setWebPage(WebPage* page) { if (m_page == page) { return; } if (m_page) { delete m_page; m_page = 0; } m_page = page; m_page->setWebView(this); m_page->setParent(this); setPage(m_page); connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(linkHovered(QString, QString, QString))); connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(closeView())); }
bool RearMirrorTools::mousePressEvent(int x, int y) { if (_windowed) { if (_closeIconRect.contains(x, y)) { _windowed = false; emit closeView(); return true; } /* Disabled for now https://worklist.net/19548 if (_resetIconRect.contains(x, y)) { emit resetView(); return true; } */ if (_headZoomIconRect.contains(x, y)) { _zoomLevel = HEAD; Application::getInstance()->bumpSettings(); return true; } if (_bodyZoomIconRect.contains(x, y)) { _zoomLevel = BODY; Application::getInstance()->bumpSettings(); return true; } if (_bounds.contains(x, y)) { _windowed = false; emit restoreView(); return true; } } if (_fullScreen) { if (_shrinkIconRect.contains(x, y)) { _fullScreen = false; emit shrinkView(); return true; } } return false; }
/** Constructor */ ProfileView::ProfileView(QWidget *parent) : QDialog(parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); connect( ui.photoLabel, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( imageCustomPopupMenu( QPoint ) ) ); connect( ui.profileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( profileCustomPopupMenu( QPoint ) ) ); connect( ui.fileTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( fileCustomPopupMenu( QPoint ) ) ); // // connect up the buttons. connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeView())); connect(ui.profileditButton, SIGNAL(clicked()), this, SLOT(profileEdit())); loadAvatar(); /* Hide platform specific features */ #ifdef Q_WS_WIN #endif }
bool RearMirrorTools::mousePressEvent(int x, int y) { if (_windowed) { if (_closeIconRect.contains(x, y)) { _windowed = false; emit closeView(); return true; } if (_resetIconRect.contains(x, y)) { emit resetView(); return true; } if (_headZoomIconRect.contains(x, y)) { _zoomLevel = HEAD; return true; } if (_bodyZoomIconRect.contains(x, y)) { _zoomLevel = BODY; return true; } if (_bounds.contains(x, y)) { _windowed = false; emit restoreView(); return true; } } if (_fullScreen) { if (_shrinkIconRect.contains(x, y)) { _fullScreen = false; emit shrinkView(); return true; } } return false; }
ContainerWidget::ContainerWidget(QWidget *p, Qt::WindowFlags f) : QWidget(p, f), m_viewWidget(NULL), m_label(new QLabel(" ", this)), m_active(false) { QHBoxLayout *h = new QHBoxLayout; h->setContentsMargins(0, 0, 0, 0); QVBoxLayout *v = new QVBoxLayout; v->setContentsMargins(0, 0, 0, 0); v->setSpacing(0); h->addWidget(m_label); h->addStretch(); QPushButton *button = new QPushButton(tr("Split Horizontal"), this); connect(button, SIGNAL(clicked()), SIGNAL(splitHorizontal())); h->addWidget(button); button = new QPushButton(tr("Split Vertical"), this); connect(button, SIGNAL(clicked()), SIGNAL(splitVertical())); h->addWidget(button); button = new QPushButton(tr("Close"), this); connect(button, SIGNAL(clicked()), SIGNAL(closeView())); h->addWidget(button); v->addLayout(h); setLayout(v); }
void ContactDetails::init( const QContact &entry ) { // If we redisplay the same entry, don't shift our view around too much bool sameEntry = (entry.uid() == ent.uid()); ent = entry; mLink.clear(); // We create tabs for each addressbook detail view plugin // We ask them if they want to be shown for this contact (or they can // just hide themselves in the init function) // they need to provide certain actions // and signals // maybe a view factory plugin // returns view plugins for list, details? // maybe string, maybe enum /* Create our members, if we haven't */ if ( !mModel ) { mModel = new QContactModel(this); connect(mModel, SIGNAL(modelReset()), this, SLOT(modelChanged())); mTabs = new QTabWidget(); mQuickTab = new ContactOverview(0); mDetailsTab = new ContactBrowser(0); #if defined(QTOPIA_TELEPHONY) mCallHistoryTab = new ContactCallHistoryList(0); #endif mMessageHistoryTab = new ContactMessageHistoryList(0); mTabs->addTab(mQuickTab, QIcon(":icon/contactdetails"), tr("Overview")); mTabs->addTab(mDetailsTab, QIcon(":icon/details"), tr("Details")); #if defined(QTOPIA_TELEPHONY) mTabs->addTab(mCallHistoryTab, QIcon(":icon/phone/calls"), tr("Calls")); #endif mTabs->addTab(mMessageHistoryTab, QIcon(":icon/email"), tr("Messages")); connect(mQuickTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated())); connect(mQuickTab, SIGNAL(closeView()), this, SIGNAL(closeView())); connect(mDetailsTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated())); connect(mDetailsTab, SIGNAL(closeView()), this, SIGNAL(closeView())); #if defined(QTOPIA_TELEPHONY) connect(mCallHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated())); connect(mCallHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView())); #endif connect(mMessageHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated())); connect(mMessageHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView())); connect(mQuickTab, SIGNAL(callContact()), this, SIGNAL(callContact())); connect(mQuickTab, SIGNAL(textContact()), this, SIGNAL(textContact())); connect(mQuickTab, SIGNAL(emailContact()), this, SIGNAL(emailContact())); connect(mQuickTab, SIGNAL(editContact()), this, SIGNAL(editContact())); connect(mDetailsTab, SIGNAL(highlighted(QString)), this, SIGNAL(highlighted(QString))); QVBoxLayout *v = new QVBoxLayout(); v->addWidget(mTabs); v->setMargin(0); setLayout(v); } modelChanged(); if (!sameEntry) mTabs->setCurrentIndex(0); mTabs->currentWidget()->setFocus(); }
bool AlarmView::updateAlarms() { bool playSound = false; QIcon aicon(":icon/audible"); QIcon sicon(":icon/silent"); mStandardModel->clear(); mAlarmCount = 0; QString localDT; QString tzDT; // Filter out occurrences that do not have an alarm for (int i=0; i < mModel->rowCount(); i++) { QOccurrence o = mModel->occurrence(i); QAppointment a = o.appointment(); if (a.hasAlarm() && (o.startInCurrentTZ() == mStartTime) && (o.alarmDelay() == mDelay)) { if (!playSound && (a.alarm() == QAppointment::Audible)) { playSound = true; } QStandardItem* item = new QStandardItem(); if (a.alarm() == QAppointment::Audible) item->setData(aicon, Qt::DecorationRole); else item->setData(sicon, Qt::DecorationRole); if (!a.description().isEmpty()) item->setData(a.description(), Qt::DisplayRole); else item->setData(tr("No description", "no description for appointment"), Qt::DisplayRole); QList< StringPair > subList; if (!a.location().isEmpty()) { subList.append(qMakePair(QString(), a.location())); } formatDateTime(o, true, localDT, tzDT); if (a.isAllDay()) { subList.append(qMakePair(tr("All day: "), localDT)); } else { subList.append(qMakePair(tr("Starts: "), localDT)); if (!tzDT.isEmpty()) subList.append(qMakePair(QString(""), tzDT)); formatDateTime(o, false, localDT, tzDT); subList.append(qMakePair(tr("Ends: "), localDT)); if (!tzDT.isEmpty()) subList.append(qMakePair(QString(""), tzDT)); } item->setData(QVariant::fromValue(subList), TwoLevelDelegate::SubLabelsRole); item->setData(i, TwoLevelDelegate::TwoLevelDelegateUserRole); mStandardModel->appendRow(item); } } int rowCount = mStandardModel->rowCount(); // Select the first item mAlarmList->setCurrentIndex(mStandardModel->index(0,0)); // XXX i18n boneheadedness. if (rowCount < 2) { setWindowTitle(tr("Reminder")); } else { setWindowTitle(tr("Reminders")); } mSnoozeButton->setFocus(); // If we actually got any matching alarms... if (rowCount > 0) { if (playSound) { Qtopia::soundAlarm(); mAlarmTimer.start(5000,this); } return true; } else { emit closeView(); return false; } }
void AlarmView::snoozeClicked() { mAlarmTimer.stop(); /* Snooze for some amount of time (configured in settings, say) */ int snoozeindex = mSnoozeChoices->currentIndex(); int snoozedelay = 60; // Make sure we set alarms on the minute by rounding QDateTime now = QDateTime::currentDateTime(); int seconds = now.time().second(); if (seconds >= 30) now = now.addSecs(60 - seconds); else now = now.addSecs(-seconds); switch(snoozeindex) { case 0: // 5 minutes snoozedelay = 300; break; case 1: // 10 minutes snoozedelay = 600; break; case 2: // 15 minutes snoozedelay = 900; break; case 3: // 30 minutes snoozedelay = 1800; break; case 4: // 1 hour snoozedelay = 3600; break; case 5: // 1 day snoozedelay = 24 * 60; break; case 6: // 1 week snoozedelay = 7 * 24 * 60; break; case 7: // 1 month hmm { QDateTime then = now.addMonths(1); snoozedelay = now.secsTo(then); } break; } QDateTime snoozeTime = now.addSecs(snoozedelay); /* Now store the snoozed alarm settings .. */ QSettings config("Trolltech","DateBook"); config.beginGroup("ActiveAlarms"); /* get a sequence number... if you snooze more than 4 billion times, you'll need a new alarm clock */ int index = config.value("SequenceNumber", 123).toInt(); config.setValue("SequenceNumber", index + 1); config.sync(); config.beginGroup(QString("AlarmID-%1").arg(index)); config.setValue("EventTime", mStartTime); config.setValue("AlarmDelta", mDelay); Qtopia::addAlarm(snoozeTime, "Calendar", "snooze(QDateTime,int)", index); emit closeView(); }
/*! Mimic the look of the text editor toolbar as defined in e.g. EditorView::EditorView */ EditorToolBar::EditorToolBar(QWidget *parent) : Utils::StyledBar(parent), m_editorList(new QComboBox(this)), m_closeButton(new QToolButton), m_lockButton(new QToolButton), m_goBackAction(new QAction(QIcon(QLatin1String(":/help/images/previous.png")), EditorManager::tr("Go Back"), parent)), m_goForwardAction(new QAction(QIcon(QLatin1String(":/help/images/next.png")), EditorManager::tr("Go Forward"), parent)), m_activeToolBar(0), m_toolBarPlaceholder(new QWidget), m_defaultToolBar(new QWidget(this)), m_isStandalone(false) { QHBoxLayout *toolBarLayout = new QHBoxLayout(this); toolBarLayout->setMargin(0); toolBarLayout->setSpacing(0); toolBarLayout->addWidget(m_defaultToolBar); m_toolBarPlaceholder->setLayout(toolBarLayout); m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_defaultToolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_activeToolBar = m_defaultToolBar; m_editorsListModel = EditorManager::instance()->openedEditorsModel(); connect(m_goBackAction, SIGNAL(triggered()), this, SIGNAL(goBackClicked())); connect(m_goForwardAction, SIGNAL(triggered()), this, SIGNAL(goForwardClicked())); m_editorList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_editorList->setMinimumContentsLength(20); m_editorList->setModel(m_editorsListModel); m_editorList->setMaxVisibleItems(40); m_editorList->setContextMenuPolicy(Qt::CustomContextMenu); m_lockButton->setAutoRaise(true); m_lockButton->setProperty("type", QLatin1String("dockbutton")); m_lockButton->setVisible(false); m_closeButton->setAutoRaise(true); m_closeButton->setIcon(QIcon(":/core/images/closebutton.png")); m_closeButton->setProperty("type", QLatin1String("dockbutton")); m_closeButton->setEnabled(false); m_toolBarPlaceholder->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_backButton = new QToolButton(this); m_backButton->setDefaultAction(m_goBackAction); m_forwardButton= new QToolButton(this); m_forwardButton->setDefaultAction(m_goForwardAction); QHBoxLayout *toplayout = new QHBoxLayout(this); toplayout->setSpacing(0); toplayout->setMargin(0); toplayout->addWidget(m_backButton); toplayout->addWidget(m_forwardButton); toplayout->addWidget(m_editorList); toplayout->addWidget(m_toolBarPlaceholder, 1); // Custom toolbar stretches toplayout->addWidget(m_lockButton); toplayout->addWidget(m_closeButton); setLayout(toplayout); // this signal is disconnected for standalone toolbars and replaced with // a private slot connection connect(m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int))); connect(m_editorList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint))); connect(m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeView()), Qt::QueuedConnection); ActionManager *am = ICore::instance()->actionManager(); connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); connect(am->command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); }
void WebWidget::closeEvent(QCloseEvent* event) { emit closeView(false); event->accept(); }
WatchGeoDataTree::WatchGeoDataTree(int inPrimitiveType, int outPrimitiveType, VertexBox *primitiveMap, VertexBox *vertexCount, QWidget *parent) : WatchView(parent) { /* Setup GUI */ setupUi(this); fMapping->setVisible(false); m_dataModel = new GeoShaderDataModel(inPrimitiveType, outPrimitiveType, primitiveMap, vertexCount, NULL, NULL, this); m_filterProxy = new GeoShaderDataSortFilterProxyModel(this); m_filterProxy->setSourceModel(m_dataModel); m_filterProxy->setDynamicSortFilter(true); connect(tbHideInactive, SIGNAL(toggled(bool)), m_filterProxy, SLOT(setHideInactive(bool))); connect(tbHideEmpty, SIGNAL(toggled(bool)), m_filterProxy, SLOT(setHideEmpty(bool))); tvGeoData->setModel(m_filterProxy); tvGeoData->setAllColumnsShowFocus(true); tvGeoData->setUniformRowHeights(true); connect(tvGeoData, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(newSelection(const QModelIndex &))); connect(m_dataModel, SIGNAL(dataDeleted(int)), this, SLOT(detachData(int))); connect(m_dataModel, SIGNAL(empty()), this, SLOT(closeView())); twGeoInfo->item(0, 0)->setText(QString(lookupEnum(inPrimitiveType))); twGeoInfo->item(1, 0)->setText( QString::number(m_dataModel->getNumInPrimitives())); twGeoInfo->item(0, 2)->setText(QString(lookupEnum(outPrimitiveType))); twGeoInfo->item(1, 2)->setText( QString::number(m_dataModel->getNumOutPrimitives())); if (GeoShaderDataModel::isBasicPrimitive(inPrimitiveType)) { twGeoInfo->hideColumn(1); } else { twGeoInfo->item(0, 1)->setText( lookupEnum( GeoShaderDataModel::getBasePrimitive(inPrimitiveType))); twGeoInfo->item(1, 1)->setText( QString::number(m_dataModel->getNumSubInPrimitives())); } twGeoInfo->resizeColumnsToContents(); twGeoInfo->resizeRowsToContents(); twGeoInfo->setSelectionBehavior(QAbstractItemView::SelectRows); // Add OpenGL view to window QGridLayout *gridLayout; gridLayout = new QGridLayout(fGLview); gridLayout->setSpacing(0); gridLayout->setMargin(0); m_qGLscatter = new GLScatter(this); gridLayout->addWidget(m_qGLscatter); slPointSize->setMinimum(1); slPointSize->setMaximum(1000); slPointSize->setValue(300); slPointSize->setTickInterval(50); m_scatterPositions = NULL; m_scatterColorsAndSizes = NULL; m_dataSelection = DATA_CURRENT; m_maxScatterDataElements = MAX(m_dataModel->getNumInPrimitives(), m_dataModel->getNumOutVertices()); m_scatterDataElements = 0; m_scatterPositions = new float[3 * m_maxScatterDataElements]; m_scatterColorsAndSizes = new float[3 * m_maxScatterDataElements]; m_scatterDataX = m_scatterPositions; clearData(m_scatterDataX, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountX = 0; m_scatterDataY = m_scatterPositions + 1; clearData(m_scatterDataY, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountY = 0; m_scatterDataZ = m_scatterPositions + 2; clearData(m_scatterDataZ, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountZ = 0; m_scatterDataRed = m_scatterColorsAndSizes; clearData(m_scatterDataRed, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountRed = 0; m_scatterDataGreen = m_scatterColorsAndSizes + 1; clearData(m_scatterDataGreen, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountGreen = 0; m_scatterDataBlue = m_scatterColorsAndSizes + 2; clearData(m_scatterDataBlue, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountBlue = 0; m_qGLscatter->setData(m_scatterPositions, m_scatterColorsAndSizes, 0); on_slPointSize_valueChanged(300); setupMappingUI(); updateGUI(); }
void emitCloseView(int id){ emit closeView(id); }