ChooseCyclistDialog::ChooseCyclistDialog(const QDir &home, bool allowNew) : home(home) { setWindowTitle(tr("Choose an Athlete")); listWidget = new QListWidget(this); listWidget->setSelectionMode(QAbstractItemView::SingleSelection); QStringListIterator i(home.entryList(QDir::Dirs | QDir::NoDotAndDotDot)); while (i.hasNext()) { QString name = i.next(); QListWidgetItem *newone = new QListWidgetItem(name, listWidget); // only allow selection of cyclists which are not already open foreach (MainWindow *x, mainwindows) if (x->cyclist == name) newone->setFlags(newone->flags() & ~Qt::ItemIsEnabled); } if (allowNew) newButton = new QPushButton(tr("&New..."), this); okButton = new QPushButton(tr("&Open"), this); cancelButton = new QPushButton(tr("&Cancel"), this); okButton->setEnabled(false); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); if (allowNew) connect(newButton, SIGNAL(clicked()), this, SLOT(newClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(enableOk(QListWidgetItem*))); connect(listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept())); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget(okButton); if (allowNew) buttonLayout->addWidget(newButton); buttonLayout->addWidget(cancelButton); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(listWidget); mainLayout->addLayout(buttonLayout); }
TextStyleDialog::TextStyleDialog(QWidget* parent, Score* score) : QDialog(parent) { setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); cs = score; styles = cs->style()->textStyles(); tp->setScore(true, cs); textNames->clear(); for (int i = 0; i < styles.size(); ++i) { // const TextStyle& s = styles.at(i); if ( (styles.at(i).hidden()& TextStyle::Hidden::IN_EDITOR) == 0) { int count = textNames->count(); textNames->addItem(qApp->translate("MuseScore", styles.at(i).name().toLatin1().data())); textNames->item(count)->setData(Qt::UserRole, i); } } connect(bb, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*))); connect(textNames, SIGNAL(currentRowChanged(int)), SLOT(nameSelected(int))); connect(newButton, SIGNAL(clicked()), SLOT(newClicked())); current = -1; textNames->setCurrentItem(textNames->item(0)); }
MetaEditDialog::MetaEditDialog(Score* s, QWidget* parent) : QDialog(parent) { setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); score = s; dirty = false; level->setValue(score->mscVersion()); version->setText(score->mscoreVersion()); revision->setValue(score->mscoreRevision()); int idx = 0; QMapIterator<QString, QString> i(s->metaTags()); while (i.hasNext()) { i.next(); QLabel* label = new QLabel; label->setText(i.key()); QLineEdit* text = new QLineEdit(i.value(), 0); connect(text, SIGNAL(textChanged(const QString&)), SLOT(setDirty())); grid->addWidget(label, idx, 0); grid->addWidget(text, idx, 1); ++idx; } connect(newButton, SIGNAL(clicked()), SLOT(newClicked())); }
void CQTabWidget::slotBtnCopy() { mpBtnCopy->setFocus(); leave(); mIgnoreLeave = true; // CQCompartments and CQSpecies have copy options, use CModelExpansion, and do their own switching. if (QString(mPages[0]->metaObject()->className()) == "CQCompartment") { CQCompartment * pQCompartment = dynamic_cast< CQCompartment * >(mPages[0]); pQCompartment->copy(); } else if (QString(mPages[0]->metaObject()->className()) == "CQSpeciesDetail") { CQSpeciesDetail * pQSpeciesDetail = dynamic_cast< CQSpeciesDetail * >(mPages[0]); pQSpeciesDetail->copy(); } else if (QString(mPages[0]->metaObject()->className()) == "ReactionsWidget1") { ReactionsWidget1 * pReactionsWidget1 = dynamic_cast< ReactionsWidget1 * >(mPages[0]); pReactionsWidget1->copy(); } else { emit copyClicked(); emit newClicked(); } mIgnoreLeave = false; }
MetaEditDialog::MetaEditDialog(Score* s, QWidget* parent) : QDialog(parent) { setObjectName("MetaEditDialog"); setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); score = s; dirty = false; level->setValue(score->mscVersion()); version->setText(score->mscoreVersion()); revision->setValue(score->mscoreRevision()); filePath->setText(score->importedFilePath()); int idx = 0; QMapIterator<QString, QString> i(s->metaTags()); QGridLayout* grid = static_cast<QGridLayout*>(scrollWidget->layout()); while (i.hasNext()) { i.next(); QLabel* label = new QLabel; label->setText(i.key()); QLineEdit* text = new QLineEdit(i.value(), 0); connect(text, SIGNAL(textChanged(const QString&)), SLOT(setDirty())); grid->addWidget(label, idx, 0); grid->addWidget(text, idx, 1); ++idx; } connect(newButton, SIGNAL(clicked()), SLOT(newClicked())); MuseScore::restoreGeometry(this); }
KCMRulesList::KCMRulesList(QWidget* parent) : QWidget(parent) { setupUi(this); // connect both current/selected, so that current==selected (stupid QListBox :( ) connect(rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(activeChanged())); connect(rules_listbox, SIGNAL(itemSelectionChanged()), SLOT(activeChanged())); connect(new_button, SIGNAL(clicked()), SLOT(newClicked())); connect(modify_button, SIGNAL(clicked()), SLOT(modifyClicked())); connect(delete_button, SIGNAL(clicked()), SLOT(deleteClicked())); connect(moveup_button, SIGNAL(clicked()), SLOT(moveupClicked())); connect(movedown_button, SIGNAL(clicked()), SLOT(movedownClicked())); connect(export_button, SIGNAL(clicked()), SLOT(exportClicked())); connect(import_button, SIGNAL(clicked()), SLOT(importClicked())); connect(rules_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(modifyClicked())); load(); }
void ProjectManagerWindow::_createMenus() { // Create the main menu this->_fileMenu = menuBar()->addMenu( tr("&File") ); /* Then create some actions */ // New action QAction* aNew = new QAction(QIcon::fromTheme("document-new"), tr("&New project"), this); connect(aNew, SIGNAL(triggered()), this, SLOT(newClicked())); aNew->setShortcut(QKeySequence(tr("Ctrl+N"))); this->_fileMenu->addAction(aNew); // Exit action QAction* aExit = new QAction(QIcon::fromTheme("application-exit"), tr("&Exit"), this); connect(aExit, SIGNAL(triggered()), this, SLOT(quit())); aExit->setShortcut(QKeySequence(tr("Ctrl+Q"))); this->_fileMenu->addAction(aExit); // Now toolbar this->_toolbar = new QToolBar("Yaydr Tools"); this->_toolbar->addAction(aNew); this->addToolBar(Qt::LeftToolBarArea, this->_toolbar); }
TextStyleDialog::TextStyleDialog(QWidget* parent, Score* score) : QDialog(parent) { setObjectName("TextStyleDialog"); setupUi(this); setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); cs = score; buttonApplyToAllParts = bb->addButton(tr("Apply to all Parts"), QDialogButtonBox::ApplyRole); buttonApplyToAllParts->setEnabled(!cs->isMaster()); styles = cs->style()->textStyles(); tp->setScore(true, cs); textNames->clear(); for (int i = 0, n = styles.size(); i < n; ++i) { if ( (styles.at(i).hidden() & TextStyleHidden::IN_EDITOR) == 0) { int count = textNames->count(); textNames->addItem(qApp->translate("TextStyle", styles.at(i).name().toUtf8().data())); textNames->item(count)->setData(Qt::UserRole, i); } } connect(bb, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*))); connect(textNames, SIGNAL(currentRowChanged(int)), SLOT(nameSelected(int))); connect(newButton, SIGNAL(clicked()), SLOT(newClicked())); current = -1; textNames->setCurrentItem(textNames->item(0)); MuseScore::restoreGeometry(this); }
void CQTabWidget::slotBtnNew() { mpBtnNew->setFocus(); leaveProtected(); mIgnoreLeave = true; emit newClicked(); mIgnoreLeave = false; }
KSnapshot::KSnapshot(QWidget *parent, const char *name) : super(parent, name, false, QString::null, Ok|Cancel) { grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM ); Q_CHECK_PTR(grabber); grabber->move( -1000, -1000 ); grabber->installEventFilter( this ); #ifdef HAVE_X11_EXTENSIONS_SHAPE_H int tmp1, tmp2; //Check whether the extension is available haveXShape = XShapeQueryExtension( qt_xdisplay(), &tmp1, &tmp2 ); #endif QVBox *vbox = makeVBoxMainWidget(); mainWidget = new KSnapshotWidget( vbox, "mainWidget" ); Q_CHECK_PTR(mainWidget); mainWidget->btnSave->hide(); mainWidget->btnPrint->hide(); connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot())); connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) ); connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) ); grabber->show(); grabber->grabMouse( waitCursor ); snapshot = QPixmap::grabWindow( qt_xrootwin() ); updatePreview(); grabber->releaseMouse(); grabber->hide(); KConfig *conf=KGlobal::config(); conf->setGroup("GENERAL"); mainWidget->setDelay(conf->readNumEntry("delay",0)); mainWidget->setMode( conf->readNumEntry( "mode", 0 ) ); mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true)); connect( &grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); KAccel* accel = new KAccel(this); Q_CHECK_PTR(accel); accel->insert(KStdAccel::Print, this, SLOT(slotPrint())); accel->insert(KStdAccel::New, this, SLOT(slotGrab())); accel->insert( "Print2", Qt::Key_P, this, SLOT(slotPrint())); accel->insert( "New2", Qt::Key_N, this, SLOT(slotGrab())); accel->insert( "New3", Qt::Key_Space, this, SLOT(slotGrab())); mainWidget->btnNew->setFocus(); }
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget, QWidget * parent, Qt::WindowFlags f) : CopasiWidget(parent, NULL, f), mPages(), mObjectType(objectType), mIgnoreLeave(false) { setupUi(this); mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>"); mpTabWidget->addTab(pCopasiWidget, "Details"); mPages.push_back(pCopasiWidget); switch (mObjectType) { case ListViews::MODEL: mpBtnNew->hide(); mpBtnCopy->hide(); mpBtnDelete->hide(); break; case ListViews::MODELPARAMETERSET: mpBtnNew->setText("Apply"); mpBtnNew->setToolTip("Apply the current parameters to the model."); // The break statement is intentionally missing default: CQNotes* pNotes = new CQNotes(mpTabWidget); mPages.push_back(pNotes); mpTabWidget->addTab(pNotes, "Notes"); connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew())); connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy())); connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete())); connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy())); break; } CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget); mPages.push_back(pMIRIAMWidget); mpTabWidget->addTab(pMIRIAMWidget, "Annotation"); connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy())); CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget); mPages.push_back(pRDFTreeView); mpTabWidget->addTab(pRDFTreeView, "RDF Browser"); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle("BuildmLearn Toolkit"); showMaximized(); iNewProjectWidget = new NewProjectWidget(this); iNewProjectWidget->show(); iStackedWidget = new QStackedWidget(this); iBlankWidget = new QWidget(this); iInfoTemplateWidget = new InfoTemplate(this); iQuizTemplateWidget = new QuizTemplate(this); iStackedWidget->addWidget(iBlankWidget); iStackedWidget->addWidget(iInfoTemplateWidget); iStackedWidget->addWidget(iQuizTemplateWidget); iStackedWidget->setCurrentIndex(0); setCentralWidget(iStackedWidget); // Menu fileMenu = menuBar()->addMenu(tr("&File")); projectMenu = menuBar()->addMenu(tr("&Project")); helpMenu = menuBar()->addMenu(tr("&Help")); newAct = new QAction(tr("&New"), this); exitAct = new QAction(tr("&Exit"), this); buildAct = new QAction(tr("&Generate application"), this); howitworksAct = new QAction(tr("&How it works"), this); aboutAct = new QAction(tr("&About"), this); fileMenu->addAction(newAct); fileMenu->addAction(exitAct); projectMenu->addAction(buildAct); helpMenu->addAction(howitworksAct); helpMenu->addAction(aboutAct); connect(iNewProjectWidget, SIGNAL(startProject(int)), this, SLOT(startProject(int))); connect(aboutAct, SIGNAL(triggered()), this ,SLOT(aboutClicked())); connect(newAct, SIGNAL(triggered()), this ,SLOT(newClicked())); connect(howitworksAct, SIGNAL(triggered()), this ,SLOT(helpClicked())); connect(buildAct, SIGNAL(triggered()), this ,SLOT(generateClicked())); connect(exitAct, SIGNAL(triggered()), this ,SLOT(close())); }
void OSPlugin::connectDocumentSignals(OSDocument* osDocument) { bool test; test = connect( osDocument, SIGNAL(closeClicked()), this, SLOT(hideSender()) ); OS_ASSERT(test); //test = connect( osDocument, SIGNAL(exitClicked()), this, SLOT(quit()) ); //OS_ASSERT(test); test = connect( osDocument, SIGNAL(importClicked()), this, SLOT(importIdfForSender()) ); OS_ASSERT(test); test = connect( osDocument, SIGNAL(loadFileClicked()), this, SLOT(openForSender()) ); OS_ASSERT(test); test = connect( osDocument, SIGNAL(newClicked()), this, SLOT(newForSender()) ); OS_ASSERT(test); test = connect( osDocument, SIGNAL(helpClicked()), this, SLOT(showHelp()) ); OS_ASSERT(test); }
ChooseCyclistDialog::ChooseCyclistDialog(const QDir &home, bool allowNew) : home(home) { setWindowTitle(tr("Choose a Cyclist")); listWidget = new QListWidget(this); listWidget->setSelectionMode(QAbstractItemView::SingleSelection); QStringListIterator i(home.entryList(QDir::Dirs | QDir::NoDotAndDotDot)); while (i.hasNext()) { QString name = i.next(); new QListWidgetItem(name, listWidget); } if (allowNew) newButton = new QPushButton(tr("&New..."), this); okButton = new QPushButton(tr("&Open"), this); cancelButton = new QPushButton(tr("&Cancel"), this); okButton->setEnabled(false); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); if (allowNew) connect(newButton, SIGNAL(clicked()), this, SLOT(newClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(enableOk(QListWidgetItem*))); connect(listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept())); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget(okButton); if (allowNew) buttonLayout->addWidget(newButton); buttonLayout->addWidget(cancelButton); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(listWidget); mainLayout->addLayout(buttonLayout); }
StartupMenu::StartupMenu(QWidget *parent) : QMenuBar(parent) { // File menu m_fileMenu = new QMenu(tr("&File"),this); QAction * newAction = new QAction(tr("&New"), this); QAction * loadFileAction = new QAction(tr("&Open"), this); QAction * importAction = new QAction(tr("&Import IDF"), this); //QAction * importSDDAction = new QAction(tr("&Import SDD"), this); QAction * exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcuts(QKeySequence::Quit); connect(importAction, SIGNAL(triggered()), this, SIGNAL(importClicked())); //connect(importSDDAction, SIGNAL(triggered()), this, SIGNAL(importSDDClicked())); connect(loadFileAction, SIGNAL(triggered()), this, SIGNAL(loadFileClicked())); connect(newAction, SIGNAL(triggered()), this, SIGNAL(newClicked())); connect(exitAction, SIGNAL(triggered()),this,SIGNAL(exitClicked())); m_fileMenu->addAction(newAction); m_fileMenu->addAction(loadFileAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(importAction); //m_fileMenu->addAction(importSDDAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(exitAction); addMenu(m_fileMenu); // Help menu m_helpMenu = new QMenu(tr("&Help"),this); addMenu(m_helpMenu); QAction * helpAction = new QAction(tr("OpenStudio &Help"),this); connect(helpAction, SIGNAL(triggered()),this,SIGNAL(helpClicked())); m_helpMenu->addAction(helpAction); }
TextStyleDialog::TextStyleDialog(QWidget* parent, Score* score) : QDialog(parent) { setupUi(this); cs = score; styles = cs->style()->textStyles(); tp->setScore(true, cs); textNames->clear(); for (int i = 0; i < styles.size(); ++i) { const TextStyle& s = styles.at(i); textNames->addItem(qApp->translate("MuseScore", s.name().toAscii().data())); } connect(bb, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*))); connect(textNames, SIGNAL(currentRowChanged(int)), SLOT(nameSelected(int))); connect(newButton, SIGNAL(clicked()), SLOT(newClicked())); current = -1; textNames->setCurrentItem(textNames->item(0)); }
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget, QWidget * parent, Qt::WindowFlags f) : CopasiWidget(parent, NULL, f), mPages(), mObjectType(objectType), mIgnoreLeave(false) { setupUi(this); mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>"); mpTabWidget->addTab(pCopasiWidget, "Details"); mPages.push_back(pCopasiWidget); switch (mObjectType) { case ListViews::ObjectType::MODEL: mpBtnNew->hide(); mpBtnCopy->hide(); mpBtnDelete->hide(); break; case ListViews::ObjectType::MODELPARAMETERSET: mpBtnNew->setText("Apply"); mpBtnNew->setToolTip("Apply the current parameters to the model."); // The break statement is intentionally missing default: CQNotes* pNotes = new CQNotes(mpTabWidget); mPages.push_back(pNotes); mpTabWidget->addTab(pNotes, "Notes"); connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew())); connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy())); connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete())); connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy())); break; } CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget); mPages.push_back(pMIRIAMWidget); mpTabWidget->addTab(pMIRIAMWidget, "Annotation"); connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy())); CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget); mPages.push_back(pRDFTreeView); mpTabWidget->addTab(pRDFTreeView, "RDF Browser"); #ifdef COPASI_Provenance if ((FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Species") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Compartment") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Reaction") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Event") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Global Quantity")) { //FROM_UTF8(mpObject->getObjectName()) //mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget, mpUndoStack, metaObject()->, pWindow->getVersionHierarchy()->getPathFile(), pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel(), pWindow->getProvenanceParentOfCurrentVersion(), pWindow->getVersionHierarchy()->getParentOfCurrentModel()); mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget); mPathFile = pWindow->getVersionHierarchy()->getPathFile(); mVersionPathToCurrentModel = pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel(); mPages.push_back(mpEntityProvenanceDialog); mpTabWidget->addTab(mpEntityProvenanceDialog, "Provenance"); //connect(this, SIGNAL(activated()), this, SLOT(mpEntityProvenanceDialog->exec())); //connect(this, SIGNAL(),EntityProvenanceDialog ,SLOT(EntityProvenanceDialog->exec())); } #endif }
UserVariableOptionsWidget::UserVariableOptionsWidget(UserVariable* userVariable, QWidget *parent) : QWidget(parent) , userVariable(userVariable) { QGridLayout *layout = new QGridLayout(this); layout->setColumnStretch(1, 1); setLayout(layout); QLabel *nameLabel = new QLabel(i18n("Name:"), this); nameLabel->setAlignment(Qt::AlignRight); layout->addWidget(nameLabel, 0, 0); QHBoxLayout *nameLayout = new QHBoxLayout(); nameEdit = new QComboBox(this); nameEdit->setObjectName(QLatin1String("nameEdit")); nameEdit->setMinimumContentsLength(10); nameLabel->setBuddy(nameEdit); connect(nameEdit, SIGNAL(currentIndexChanged(QString)), this, SLOT(nameChanged())); nameLayout->addWidget(nameEdit); newButton = new QPushButton(i18n("New"), this); connect(newButton, SIGNAL(clicked()), this, SLOT(newClicked())); nameLayout->addWidget(newButton); deleteButton = new QPushButton(i18n("Delete"), this); deleteButton->setObjectName("DeleteButton"); connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked())); nameLayout->addWidget(deleteButton); layout->addLayout(nameLayout, 0, 1); QLabel *typeLabel = new QLabel(i18n("Format:"), this); typeLabel->setAlignment(Qt::AlignRight); layout->addWidget(typeLabel, 1, 0); typeEdit = new QComboBox(this); typeEdit->setObjectName(QLatin1String("typeEdit")); typeLabel->setBuddy(typeEdit); typeEdit->addItem(i18n("String"), QLatin1String("string")); typeEdit->addItem(i18n("Boolean"), QLatin1String("boolean")); typeEdit->addItem(i18n("Float"), QLatin1String("float")); typeEdit->addItem(i18n("Percentage"), QLatin1String("percentage")); typeEdit->addItem(i18n("Currency"), QLatin1String("currency")); typeEdit->addItem(i18n("Date"), QLatin1String("date")); typeEdit->addItem(i18n("Time"), QLatin1String("time")); typeEdit->addItem(i18n("Formula"), QLatin1String("formula")); typeEdit->addItem(i18n("Void"), QLatin1String("void")); typeEdit->setCurrentIndex(qMax(0, typeEdit->findData(variableManager()->userType(userVariable->name())))); connect(typeEdit, SIGNAL(currentIndexChanged(QString)), this, SLOT(typeChanged())); layout->addWidget(typeEdit, 1, 1); QLabel *valueLabel = new QLabel(i18n("Value:"), this); valueLabel->setAlignment(Qt::AlignRight); layout->addWidget(valueLabel, 2, 0); valueEdit = new QLineEdit(this); valueEdit->setObjectName(QLatin1String("valueEdit")); valueLabel->setBuddy(valueEdit); valueEdit->setText(variableManager()->value(userVariable->name())); connect(valueEdit, SIGNAL(textChanged(QString)), this, SLOT(valueChanged())); layout->addWidget(valueEdit, 2, 1); updateNameEdit(); }
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent) : DCOPObject("interface"), KDialogBase(parent, name, true, QString::null, Help|User1, User1, true, KStdGuiItem::quit() ) { grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM ); grabber->move( -1000, -1000 ); grabber->installEventFilter( this ); KStartupInfo::appStarted(); QVBox *vbox = makeVBoxMainWidget(); mainWidget = new KSnapshotWidget( vbox, "mainWidget" ); connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot())); connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) ); connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) ); connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) ); connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) ); grabber->show(); grabber->grabMouse( waitCursor ); if ( !grabCurrent ) snapshot = QPixmap::grabWindow( qt_xrootwin() ); else { mainWidget->setMode( WindowUnderCursor ); mainWidget->setIncludeDecorations( true ); performGrab(); } updatePreview(); grabber->releaseMouse(); grabber->hide(); KConfig *conf=KGlobal::config(); conf->setGroup("GENERAL"); mainWidget->setDelay(conf->readNumEntry("delay",0)); mainWidget->setMode( conf->readNumEntry( "mode", 0 ) ); mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true)); filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" )); // Make sure the name is not already being used while(KIO::NetAccess::exists( filename, false, this )) { autoincFilename(); } connect( &grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); connect( &updateTimer, SIGNAL( timeout() ), this, SLOT( updatePreview() ) ); QTimer::singleShot( 0, this, SLOT( updateCaption() ) ); KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false); QPushButton *helpButton = actionButton( Help ); helpButton->setPopup(helpMenu->menu()); KAccel* accel = new KAccel(this); accel->insert(KStdAccel::Quit, kapp, SLOT(quit())); accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user without showing the file dialog."), CTRL+SHIFT+Key_S, this, SLOT(slotSave())); accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs())); // accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs())); accel->insert( "SaveAs", i18n("Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user."), CTRL+Key_A, this, SLOT(slotSaveAs())); accel->insert(KStdAccel::Print, this, SLOT(slotPrint())); accel->insert(KStdAccel::New, this, SLOT(slotGrab())); accel->insert(KStdAccel::Copy, this, SLOT(slotCopy())); accel->insert( "Quit2", Key_Q, this, SLOT(slotSave())); accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs())); accel->insert( "Print2", Key_P, this, SLOT(slotPrint())); accel->insert( "New2", Key_N, this, SLOT(slotGrab())); accel->insert( "New3", Key_Space, this, SLOT(slotGrab())); setEscapeButton( User1 ); connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) ); mainWidget->btnNew->setFocus(); }
MainMenu::MainMenu(bool isIP, bool isPlugin, QWidget *parent) : QMenuBar(parent), m_isPlugin(isPlugin) { m_isIP = isIP; QAction * action = 0; bool isConnected = 0; // File menu m_fileMenu = new QMenu(tr("&File"),this); addMenu(m_fileMenu); // DLM: actions which result in this menu being deleted should be queued action = new QAction(tr("&New"), this); action->setShortcut(QKeySequence(QKeySequence::New)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(newClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); // DLM: actions which result in this menu being deleted should be queued action = new QAction(tr("&Open"), this); action->setShortcut(QKeySequence(QKeySequence::Open)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(loadFileClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); m_fileMenu->addSeparator(); m_revertToSavedAction = new QAction(tr("Revert to Saved"), this); m_revertToSavedAction->setDisabled(true); m_fileMenu->addAction(m_revertToSavedAction); isConnected = connect(m_revertToSavedAction, SIGNAL(triggered()), this, SIGNAL(revertFileClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("&Save"), this); action->setShortcut(QKeySequence(QKeySequence::Save)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(saveFileClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Save &As"), this); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(saveAsFileClicked())); OS_ASSERT(isConnected); m_fileMenu->addSeparator(); //formatMenu = editMenu->addMenu(tr("&Format")) QMenu * importMenu = m_fileMenu->addMenu(tr("Import")); action = new QAction(tr("IDF"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("gbXML"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importgbXMLClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("SDD"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importSDDClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); QMenu * exportMenu = m_fileMenu->addMenu(tr("Export")); action = new QAction(tr("IDF"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportClicked())); OS_ASSERT(isConnected); action = new QAction(tr("gbXML"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportgbXMLClicked())); OS_ASSERT(isConnected); action = new QAction(tr("SDD"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportSDDClicked())); OS_ASSERT(isConnected); action = new QAction(tr("&Load Library"), this); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(loadLibraryClicked())); OS_ASSERT(isConnected); if (!m_isPlugin){ m_fileMenu->addSeparator(); //m_fileMenu->addAction(action); //isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(showRubyConsoleClicked())); //OS_ASSERT(isConnected); m_fileMenu->addSeparator(); action = new QAction(tr("E&xit"), this); action->setShortcuts(QKeySequence::Quit); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(exitClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); } // Preferences menu m_preferencesMenu = new QMenu(tr("&Preferences"),this); addMenu(m_preferencesMenu); QMenu * unitsMenu = m_preferencesMenu->addMenu(tr("Units")); m_displaySIUnitsAction = new QAction(tr("Metric (&SI)"),this); unitsMenu->addAction(m_displaySIUnitsAction); isConnected = connect(m_displaySIUnitsAction, SIGNAL(triggered()),this,SLOT(displaySIUnitsClicked())); OS_ASSERT(isConnected); m_displayIPUnitsAction = new QAction(tr("English (&I-P)"),this); unitsMenu->addAction(m_displayIPUnitsAction); isConnected = connect(m_displayIPUnitsAction, SIGNAL(triggered()),this,SLOT(displayIPUnitsClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Change My Measures Directory"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(changeMyMeasuresDir())); OS_ASSERT(isConnected); action = new QAction(tr("Scan for Tools"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(scanForToolsClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Show Tools"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(showRunManagerPreferencesClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Change BCL Login Information"),this); //m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(changeBclLogin())); OS_ASSERT(isConnected); action = new QAction(tr("&Configure Internet Proxy"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(configureProxyClicked())); OS_ASSERT(isConnected); if(m_isIP){ m_displayIPUnitsAction->trigger(); } else{ m_displaySIUnitsAction->trigger(); } // Measure menu m_measureMenu = new QMenu(tr("Components && Measures"),this); addMenu(m_measureMenu); action = new QAction(tr("Apply Measure Now"),this); action->setShortcut(QKeySequence(QKeySequence(tr("Ctrl+M")))); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(applyMeasureClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Find Measures"),this); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(downloadMeasuresClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Find Components"),this); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(downloadComponentsClicked())); OS_ASSERT(isConnected); // Help menu m_helpMenu = new QMenu(tr("&Help"),this); addMenu(m_helpMenu); action = new QAction(tr("OpenStudio &Help"),this); m_helpMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(helpClicked())); OS_ASSERT(isConnected); action = new QAction(tr("&About"),this); m_helpMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(aboutClicked())); OS_ASSERT(isConnected); }
void MateriaPrimaDetail::setParam(const ParameterList& param) { formulaTitleLabel->hide(); formulaLabel->hide(); label1->hide(); label2->hide(); lineEdit1->hide(); lineEdit2->hide(); nomeEdit->clear(); tipoComboBox->setCurrentIndex(-1); precoEdit->clear(); if (param["mode"] != "new") { disconnect(pushButton, SIGNAL(clicked()), this, SLOT(newClicked())); connect(pushButton, SIGNAL(clicked()), this, SLOT(editClicked())); pushButton->setText("&Salvar"); query.prepare("UPDATE materiaprima SET nome = :nome, preco_por_kilo = :preco_por_kilo, tipo = :tipo WHERE cod_materiaprima = :cod"); query.bindValue(":cod", param["cod"].toULongLong()); QSqlQuery sql; sql.prepare("SELECT nome, tipo, preco_por_kilo FROM materia_prima WHERE cod_materiaprima=:cod_materia_prima"); sql.bindValue("cod_materia_prima", param["cod"].toULongLong()); if (!sql.exec()) { QMessageBox::warning(this, "Admin", QString::fromUtf8("Erro na consulta\1%1").arg(query.lastError().text())); } else { sql.last(); nomeEdit->setText(sql.value(0).toString()); tipoComboBox->setCurrentIndex(sql.value(1).toInt()); precoEdit->setText(sql.value(2).toString()); } if (param["mode"] == "view") { setWindowTitle(QString::fromUtf8("Visualizando registro [%1]").arg(sql.value(0).toString())); nomeEdit->setReadOnly(true); precoEdit->setReadOnly(true); pushButton->hide(); cancelButton->setText("Fe&char"); } else { setWindowTitle(QString::fromUtf8("Editando registro [%1]").arg(sql.value(0).toString())); } } else { setWindowTitle(QString::fromUtf8("Novo registro")); disconnect(pushButton, SIGNAL(clicked()), this, SLOT(editClicked())); connect(pushButton, SIGNAL(clicked()), this, SLOT(newClicked())); pushButton->setText("&Inserir"); query.prepare("INSERT INTO materiaprima (nome, preco_por_kilo, tipo) VALUES (:nome, :preco_por_kilo, :tipo)"); } }