bool RotateDlg::rotate(Rotation & map) { Dimension dim = map.size(); assert( dim == int(d_labels.size()) ); d_buttons.resize( Extension( dim, dim ) ); const int ncol = 2; const int nrow = (d_editAtomType)?3:2; d_cbs.assign( dim, 0 ); QVBoxLayout* top = new QVBoxLayout(this); top->setMargin( 10 ); QGridLayout* contents = new QGridLayout(); QHBoxLayout* buttons = new QHBoxLayout(); QLabel* l = new QLabel( d_colLabel.data(), this ); l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter ); l->setFrameStyle( QFrame::Panel ); l->setFrameShadow( QFrame::Sunken ); contents->addWidget( l, 0, 2, 1, dim + 1 - 2 + 1 ); l = new QLabel( d_rowLabel.data(), this ); l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter ); l->setFrameStyle( QFrame::Panel ); l->setFrameShadow( QFrame::Sunken ); contents->addWidget( l, nrow, 0, dim, 1 ); Dimension row; for( row = 0; row < dim; row++ ) { QString str; // Set row headers if( !d_labels[ row ].first.isEmpty() ) str.sprintf( "Dim. %s: %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row), d_labels[ row ].first.data() ); else str.sprintf( "Dim. %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row) ); l = new QLabel( str, this ); l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter ); l->setFrameStyle( QFrame::Panel ); l->setFrameShadow( QFrame::Sunken ); contents->addWidget( l, 1, row + ncol ); // Set column headers if( !d_labels[ row ].second.isEmpty() ) str.sprintf( "Dim. %s: %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row), d_labels[ row ].second.data() ); else str.sprintf( "Dim. %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row) ); l = new QLabel( str, this ); l->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); l->setFrameStyle( QFrame::Panel ); l->setFrameShadow( QFrame::Sunken ); contents->addWidget( l, row + nrow, 1 ); if( d_editAtomType ) { d_cbs[ row ] = new QComboBox( this ); for( int i = AtomType::None; i <= AtomType::Lr; i++ ) d_cbs[ row ]->addItem( AtomType::s_labels[ i ] ); d_cbs[ row ]->setCurrentIndex( d_clr[ row ].getIsoType() ); contents->addWidget( d_cbs[ row ], nrow - 1, row + ncol ); } for( Dimension col = 0; col < dim; col++ ) { QRadioButton* b = new QRadioButton( this ); b->setAutoExclusive( false ); //b->setToggleButton( true ); contents->addWidget( b, row + nrow, col + ncol, Qt::AlignHCenter ); d_buttons.setAt( row, col, b ); connect( b, SIGNAL( toggled(bool) ), this, SLOT( toggled(bool) ) ); } } // Toggle erst zuletzt, da vorher noch nicht alle Buttons existieren. for( row = 0; row < dim; row++ ) for( Dimension col = 0; col < dim; col++ ) { if( map[ row ] == col ) d_buttons.getAt( row, col )->setChecked( true ); } QPushButton* ok = new QPushButton( "&OK", this ); connect( ok, SIGNAL( clicked() ), SLOT( accept() ) ); buttons->addWidget( ok ); ok->setDefault( true ); QPushButton* cancel = new QPushButton( "&Cancel", this ); connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) ); buttons->addWidget( cancel ); top->addLayout( contents ); top->addLayout( buttons ); while( true ) { if( exec() == QDialog::Accepted ) { Rotation map2 = map; bool clrOk = true; for( int row = 0; row < dim; row++ ) { for( int col = 0; col < dim; col++ ) { if( d_buttons.getAt( row, col )->isChecked() ) { map2[ row ] = col; } } if( d_editAtomType ) { d_clr[ row ] = AtomType::Isotope( d_cbs[ row ]->currentIndex() ); if( d_clr[ row ].isNone() ) clrOk = false; } } if( !map2.isValid() ) { QMessageBox::critical( this, "Rotate dimensions", "Dimension assignments have to be unique!" ); }else if( !clrOk ) { QMessageBox::critical( this, "Rotate dimensions", "Atom types must not be empty!" ); }else { map = map2; return true; } }else return false; } }
void CellMLAnnotationViewMetadataEditDetailsWidget::updateGui(const Items &pItems, const QString &pErrorMsg, const bool &pLookupTerm, const int &pItemsVerticalScrollBarPosition, const bool &pRetranslate) { // Note: we are using certain layouts to dislay the contents of our view, // but this unfortunately results in some very bad flickering on OS X. // This can, however, be addressed using a stacked widget, so... // Prevent ourselves from being updated (to avoid any flickering) setUpdatesEnabled(false); // Create a widget which will contain our GUI QWidget *newMainWidget = new QWidget(this); QVBoxLayout *newMainLayout = new QVBoxLayout(newMainWidget); newMainLayout->setMargin(0); newMainWidget->setLayout(newMainLayout); // Create a form widget which will contain our qualifier and term fields QWidget *newFormWidget = new QWidget(newMainWidget); QFormLayout *newFormLayout = new QFormLayout(newFormWidget); newFormWidget->setLayout(newFormLayout); // Add our qualifier field // Create a widget which will contain both our qualifier value widget and a // button to look up the qualifier QWidget *qualifierWidget = new QWidget(newFormWidget); QHBoxLayout *qualifierWidgetLayout = new QHBoxLayout(qualifierWidget); qualifierWidgetLayout->setMargin(0); qualifierWidget->setLayout(qualifierWidgetLayout); // Create our qualifier value widget mQualifierValue = new QComboBox(qualifierWidget); mQualifierValue->addItems(CellMLSupport::CellMLFileRdfTriple::qualifiersAsStringList()); mQualifierValue->setCurrentIndex(mQualifierIndex); connect(mQualifierValue, SIGNAL(currentIndexChanged(int)), this, SLOT(qualifierChanged(const int &))); connect(mQualifierValue, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(qualifierChanged(const QString &))); // Create our qualifier lookup button widget mLookupQualifierButton = new QPushButton(qualifierWidget); // Note #1: ideally, we could assign a QAction to our QPushButton, but this // cannot be done, so... we assign a few properties by hand... // Note #2: to use a QToolButton would allow us to assign a QAction to it, // but a QToolButton doesn't look quite the same as a QPushButton // on some platforms, so... mLookupQualifierButton->setCheckable(true); mLookupQualifierButton->setChecked(mLookupQualifierButtonIsChecked); mLookupQualifierButton->setIcon(QIcon(":/oxygen/categories/applications-internet.png")); mLookupQualifierButton->setStatusTip(tr("Look up the qualifier")); mLookupQualifierButton->setToolTip(tr("Look Up")); mLookupQualifierButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(mLookupQualifierButton, SIGNAL(clicked()), this, SLOT(lookupQualifier())); // Add our QComboBox and QPushButton to our cmeta:id widget qualifierWidgetLayout->addWidget(mQualifierValue); qualifierWidgetLayout->addWidget(mLookupQualifierButton); // Add our qualifier widget to our main layout newFormLayout->addRow(Core::newLabel(tr("Qualifier:"), 1.0, true, newFormWidget), qualifierWidget); // Add our term field // Create a widget which will contain both our qualifier value widget and a // button to look up the qualifier QWidget *termWidget = new QWidget(newFormWidget); QHBoxLayout *termWidgetLayout = new QHBoxLayout(termWidget); termWidgetLayout->setMargin(0); termWidget->setLayout(termWidgetLayout); // Create our term value widget mTermValue = new QLineEdit(termWidget); mTermValue->setText(mTerm); // Note: we set the text to whatever term was previously being looked up and // this before tracking changes to the term since we don't want to // trigger a call to termChanged(). Indeed, we might come here as a // result of a retranslation so we shouldn't look up for the term and, // instead, we should call updateItemsGui() which we do at the end of // this procedure... connect(mTermValue, SIGNAL(textChanged(const QString &)), this, SLOT(termChanged(const QString &))); // Create our add term button widget mAddTermButton = new QPushButton(termWidget); mAddTermButton->setEnabled(false); mAddTermButton->setIcon(QIcon(":/oxygen/actions/list-add.png")); mAddTermButton->setStatusTip(tr("Add the term")); mAddTermButton->setToolTip(tr("Add")); mAddTermButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(mAddTermButton, SIGNAL(clicked()), this, SLOT(addTerm())); // Add our QComboBox and QPushButton to our cmeta:id widget termWidgetLayout->addWidget(mTermValue); termWidgetLayout->addWidget(mAddTermButton); // Add our term widget to our main layout newFormLayout->addRow(Core::newLabel(tr("Term:"), 1.0, true, newFormWidget), termWidget); // Reset the tab order from our parent's CellML list's tree view widget // Note: ideally, we would take advantage of Qt's signal/slot approach with // the signal being emitted here and the slot being implemented in // mParent, but this wouldn't work here since updateGui() gets called // as part of the creation of this metadata details widget, so... setTabOrder(qobject_cast<QWidget *>(mParent->cellmlList()->treeViewWidget()), mQualifierValue); setTabOrder(mQualifierValue, mLookupQualifierButton); setTabOrder(mLookupQualifierButton, mTermValue); setTabOrder(mTermValue, mAddTermButton); // Create a stacked widget (within a scroll area, so that only the items get // scrolled, not the whole metadata edit details widget) which will contain // a grid with the results of our terms lookup QScrollArea *newItemsScrollArea = new QScrollArea(newMainWidget); newItemsScrollArea->setFrameShape(QFrame::NoFrame); newItemsScrollArea->setWidgetResizable(true); // Add our 'internal' widgets to our new main widget newMainLayout->addWidget(newFormWidget); newMainLayout->addWidget(new Core::BorderedWidget(newItemsScrollArea, true, false, false, false)); // Keep track of the position of our items vertical scroll bar // Note: this is required to make sure that the position doesn't get reset // as a result of retranslating the GUI... connect(newItemsScrollArea->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(trackItemsVerticalScrollBarPosition(const int &))); // Add our new widget to our stacked widget mWidget->addWidget(newMainWidget); // Remove the contents of our old form layout if (mFormWidget) for (int i = 0, iMax = mFormLayout->count(); i < iMax; ++i) { QLayoutItem *item = mFormLayout->takeAt(0); delete item->widget(); delete item; } // Reset the widget of our old items scroll area and stop tracking the // position of its vertical scroll bar // Note: the resetting this will automatically delete our old grid widget... if (mItemsScrollArea) { mItemsScrollArea->setWidget(0); disconnect(mItemsScrollArea->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(trackItemsVerticalScrollBarPosition(const int &))); } // Get rid of our old main widget and layout (and its contents) if (mMainWidget) { mWidget->removeWidget(mMainWidget); for (int i = 0, iMax = mMainLayout->count(); i < iMax; ++i) { QLayoutItem *item = mMainLayout->takeAt(0); delete item->widget(); delete item; } delete mMainWidget; } // Keep track of our new main widgets and layouts mMainWidget = newMainWidget; mMainLayout = newMainLayout; mFormWidget = newFormWidget; mFormLayout = newFormLayout; mItemsScrollArea = newItemsScrollArea; mGridWidget = 0; // Note: this will be set by our mGridLayout = 0; // other updateGui() function... // Allow ourselves to be updated again setUpdatesEnabled(true); // Update our items GUI updateItemsGui(pItems, pErrorMsg, pLookupTerm); // Request for something to be looked up, if needed if (mLookupInformation) // Look up an 'old' qualifier, resource or resource id genericLookup(mInformation, mType, pRetranslate); // Set the position of our vertical scroll bar mItemsScrollArea->verticalScrollBar()->setValue(pItemsVerticalScrollBarPosition); }
void JabberEditAccountWidget::createOptionsTab(QTabWidget *tabWidget) { QWidget *optionsTab = new QWidget(this); tabWidget->addTab(optionsTab, tr("Options")); QVBoxLayout *layout = new QVBoxLayout(optionsTab); layout->setSpacing(6); layout->setMargin(9); QGroupBox *resource = new QGroupBox(tr("Resource"), this); QVBoxLayout *resourceLayout = new QVBoxLayout(resource); QHBoxLayout *resourceDetailsLayout = new QHBoxLayout(); resourceDetailsLayout->setSpacing(6); resourceDetailsLayout->setMargin(0); AutoResource = new QCheckBox(tr("Use hostname as a resource")); connect(AutoResource, SIGNAL(clicked()), this, SLOT(dataChanged())); connect(AutoResource, SIGNAL(toggled(bool)), SLOT(autoResourceToggled(bool))); resourceLayout->addWidget(AutoResource); ResourceLabel = new QLabel; ResourceLabel->setText(tr("Resource") + ':'); resourceDetailsLayout->addWidget(ResourceLabel); ResourceName = new QLineEdit; connect(ResourceName, SIGNAL(textEdited(QString)), this, SLOT(dataChanged())); resourceDetailsLayout->addWidget(ResourceName); PriorityLabel = new QLabel; PriorityLabel->setText(tr("Priority") + ':'); resourceDetailsLayout->addWidget(PriorityLabel); Priority = new QLineEdit; connect(Priority, SIGNAL(textEdited(QString)), this, SLOT(dataChanged())); Priority->setValidator(new QIntValidator(Priority)); resourceDetailsLayout->addWidget(Priority); resourceLayout->addLayout(resourceDetailsLayout); layout->addWidget(resource); QGroupBox *dataTransferProxy = new QGroupBox(tr("Data transfer proxy"), this); QHBoxLayout *dataTransferProxyLayout = new QHBoxLayout(dataTransferProxy); dataTransferProxyLayout->setSpacing(6); dataTransferProxyLayout->setMargin(0); DataTransferProxyLabel = new QLabel; DataTransferProxyLabel->setText(tr("Data transfer proxy") + ':'); dataTransferProxyLayout->addWidget(DataTransferProxyLabel); DataTransferProxy = new QLineEdit; dataTransferProxyLayout->addWidget(DataTransferProxy); layout->addWidget(dataTransferProxy); QGroupBox *notifications = new QGroupBox(tr("Notifications"), this); QVBoxLayout *notificationsLayout = new QVBoxLayout(notifications); SendTypingNotification = new QCheckBox(tr("Send composing events")); connect(SendTypingNotification, SIGNAL(clicked()), this, SLOT(dataChanged())); notificationsLayout->addWidget(SendTypingNotification); SendGoneNotification = new QCheckBox(tr("Send inactivity events (end/suspend conversation)")); SendGoneNotification->setEnabled(false); connect(SendGoneNotification, SIGNAL(clicked()), this, SLOT(dataChanged())); connect(SendTypingNotification, SIGNAL(toggled(bool)), SendGoneNotification, SLOT(setEnabled(bool))); notificationsLayout->addWidget(SendGoneNotification); layout->addWidget(notifications); layout->addStretch(100); }
void PathDeformControls::layoutForDesktop() { QGroupBox* mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Controls")); QGroupBox *radiusGroup = new QGroupBox(mainGroup); radiusGroup->setTitle(tr("Lens Radius")); QSlider *radiusSlider = new QSlider(Qt::Horizontal, radiusGroup); radiusSlider->setRange(15, 150); radiusSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *deformGroup = new QGroupBox(mainGroup); deformGroup->setTitle(tr("Deformation")); QSlider *deformSlider = new QSlider(Qt::Horizontal, deformGroup); deformSlider->setRange(-100, 100); deformSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *fontSizeGroup = new QGroupBox(mainGroup); fontSizeGroup->setTitle(tr("Font Size")); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, fontSizeGroup); fontSizeSlider->setRange(16, 200); fontSizeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *textGroup = new QGroupBox(mainGroup); textGroup->setTitle(tr("Text")); QLineEdit *textInput = new QLineEdit(textGroup); QPushButton *animateButton = new QPushButton(mainGroup); animateButton->setText(tr("Animated")); animateButton->setCheckable(true); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); mainGroup->setFixedWidth(180); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(radiusGroup); mainGroupLayout->addWidget(deformGroup); mainGroupLayout->addWidget(fontSizeGroup); mainGroupLayout->addWidget(textGroup); mainGroupLayout->addWidget(animateButton); mainGroupLayout->addStretch(1); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(showSourceButton); mainGroupLayout->addWidget(whatsThisButton); QVBoxLayout *radiusGroupLayout = new QVBoxLayout(radiusGroup); radiusGroupLayout->addWidget(radiusSlider); QVBoxLayout *deformGroupLayout = new QVBoxLayout(deformGroup); deformGroupLayout->addWidget(deformSlider); QVBoxLayout *fontSizeGroupLayout = new QVBoxLayout(fontSizeGroup); fontSizeGroupLayout->addWidget(fontSizeSlider); QVBoxLayout *textGroupLayout = new QVBoxLayout(textGroup); textGroupLayout->addWidget(textInput); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainGroup); mainLayout->setMargin(0); connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int))); connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int))); connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int))); connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool))); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(textInput, SIGNAL(textChanged(QString)), m_renderer, SLOT(setText(QString))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); animateButton->animateClick(); deformSlider->setValue(80); fontSizeSlider->setValue(120); radiusSlider->setValue(100); textInput->setText(tr("Qt")); }
Comments::Comments(QWidget *pParent, const char *name) : QWidget(pParent) { setObjectName(name); _source = Uninitialized; _sourceid = -1; _editable = true; _verboseCommentList = false; QVBoxLayout *vbox = new QVBoxLayout(this); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setMargin(0); hbox->setSpacing(7); _verbose = new XCheckBox(tr("Verbose Text"), this); _verbose->setObjectName("_verbose"); _verboseCommentList = _verbose->isChecked(); vbox->addWidget(_verbose); vbox->addLayout(hbox); QWidget *buttons = new QWidget(this); QVBoxLayout * buttonsLayout = new QVBoxLayout(buttons); buttonsLayout->setMargin(0); buttonsLayout->setSpacing(0); _comment = new XTreeWidget(this); _comment->setObjectName("_comment"); _comment->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); _comment->addColumn(tr("Date/Time"), _timeDateColumn, Qt::AlignCenter,true, "comment_date"); _comment->addColumn(tr("Type"), _itemColumn, Qt::AlignCenter,true, "type"); _comment->addColumn(tr("Source"), _itemColumn, Qt::AlignCenter,true, "comment_source"); _comment->addColumn(tr("User"), _userColumn, Qt::AlignCenter,true, "comment_user"); _comment->addColumn(tr("Comment"), -1, Qt::AlignLeft, true, "first"); _comment->addColumn(tr("Public"), _ynColumn, Qt::AlignLeft, false, "comment_public"); hbox->addWidget(_comment); _browser = new QTextBrowser(this); _browser->setObjectName("_browser"); _browser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); _browser->setOpenLinks(false); hbox->addWidget(_browser); _newComment = new QPushButton(tr("New"), buttons); _newComment->setObjectName("_newComment"); buttonsLayout->addWidget(_newComment); _viewComment = new QPushButton(tr("View"), buttons); _viewComment->setObjectName("_viewComment"); _viewComment->setEnabled(FALSE); buttonsLayout->addWidget(_viewComment); _editComment = new QPushButton(tr("Edit"), buttons); _editComment->setObjectName("_editComment"); _editComment->setEnabled(false); buttonsLayout->addWidget(_editComment); QSpacerItem *_buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); buttonsLayout->addItem(_buttonSpacer); buttons->setLayout(buttonsLayout); hbox->addWidget(buttons); _editmap = new QMultiMap<int, bool>(); _editmap2 = new QMultiMap<int, bool>(); connect(_newComment, SIGNAL(clicked()), this, SLOT( sNew())); connect(_viewComment, SIGNAL(clicked()), this, SLOT( sView())); connect(_editComment, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_comment, SIGNAL(valid(bool)), this, SLOT(sCheckButtonPriv(bool))); connect(_comment, SIGNAL(itemSelected(int)), _viewComment, SLOT(animateClick())); connect(_browser, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl))); connect(_verbose, SIGNAL(toggled(bool)), this, SLOT(setVerboseCommentList(bool))); setFocusProxy(_comment); setVerboseCommentList(_verboseCommentList); }
GopathBrowser::GopathBrowser(LiteApi::IApplication *app, QObject *parent) : QObject(parent), m_liteApp(app) { m_widget = new QWidget; m_toolBar = new QToolBar; m_toolBar->setIconSize(QSize(16,16)); m_syncEditor = new QAction(QIcon(":/images/synceditor.png"),tr("Sync Editor"),this); m_syncEditor->setCheckable(true); m_syncProject = new QAction(QIcon(":/images/syncproject.png"),tr("Sync Project"),this); m_syncProject->setCheckable(true); m_startPathLabel = new QLabel; m_toolBar->addAction(m_syncEditor); m_toolBar->addAction(m_syncProject); m_toolBar->addSeparator(); m_toolBar->addWidget(m_startPathLabel); m_pathTree = new QTreeView; m_pathTree->setHeaderHidden(true); m_model = new GopathModel(this); m_pathTree->setContextMenuPolicy(Qt::CustomContextMenu); m_pathTree->setModel(m_model); QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(0); layout->addWidget(m_toolBar); layout->addWidget(m_pathTree); m_widget->setLayout(layout); m_pathList = m_liteApp->settings()->value("golangtool/gopath").toStringList(); //connect(m_pathTree->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(pathIndexChanged(QModelIndex))); connect(m_pathTree,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(openPathIndex(QModelIndex))); LiteApi::IEnvManager* envManager = LiteApi::findExtensionObject<LiteApi::IEnvManager*>(m_liteApp,"LiteApi.IEnvManager"); connect(envManager,SIGNAL(currentEnvChanged(LiteApi::IEnv*)),this,SLOT(reloadEnv())); connect(m_liteApp->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*))); m_fileMenu = new QMenu(m_widget); m_folderMenu = new QMenu(m_widget); m_setStartAct = new QAction(tr("Set Activate Project"),this); m_openEditorAct = new QAction(tr("Open Editor"),this); m_newFileAct = new QAction(tr("New File"),this); m_newFileWizardAct = new QAction(tr("New File Wizard"),this); m_renameFileAct = new QAction(tr("Rename File"),this); m_removeFileAct = new QAction(tr("Remove File"),this); m_newFolderAct = new QAction(tr("New Folder"),this); m_renameFolderAct = new QAction(tr("Rename Folder"),this); m_removeFolderAct = new QAction(tr("Remove Folder"),this); m_openShellAct = new QAction(tr("Open Terminal Here"),this); m_openExplorerAct = new QAction(tr("Open Explorer Here"),this); m_fileMenu->addAction(m_openEditorAct); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_newFileAct); m_fileMenu->addAction(m_newFileWizardAct); m_fileMenu->addAction(m_renameFileAct); m_fileMenu->addAction(m_removeFileAct); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_openShellAct); m_fileMenu->addAction(m_openExplorerAct); m_folderMenu->addAction(m_setStartAct); m_folderMenu->addSeparator(); m_folderMenu->addAction(m_newFileAct); m_folderMenu->addAction(m_newFileWizardAct); m_folderMenu->addAction(m_newFolderAct); m_folderMenu->addAction(m_renameFolderAct); m_folderMenu->addAction(m_removeFolderAct); m_folderMenu->addSeparator(); m_folderMenu->addAction(m_openShellAct); m_folderMenu->addAction(m_openExplorerAct); connect(m_startPathLabel,SIGNAL(linkActivated(QString)),this,SLOT(expandStartPath(QString))); connect(m_syncEditor,SIGNAL(triggered(bool)),this,SLOT(syncEditor(bool))); connect(m_syncProject,SIGNAL(triggered(bool)),this,SLOT(syncProject(bool))); connect(m_setStartAct,SIGNAL(triggered()),this,SLOT(setActivate())); connect(m_openEditorAct,SIGNAL(triggered()),this,SLOT(openEditor())); connect(m_newFileAct,SIGNAL(triggered()),this,SLOT(newFile())); connect(m_newFileWizardAct,SIGNAL(triggered()),this,SLOT(newFileWizard())); connect(m_renameFileAct,SIGNAL(triggered()),this,SLOT(renameFile())); connect(m_removeFileAct,SIGNAL(triggered()),this,SLOT(removeFile())); connect(m_newFolderAct,SIGNAL(triggered()),this,SLOT(newFolder())); connect(m_renameFolderAct,SIGNAL(triggered()),this,SLOT(renameFolder())); connect(m_removeFolderAct,SIGNAL(triggered()),this,SLOT(removeFolder())); connect(m_openShellAct,SIGNAL(triggered()),this,SLOT(openShell())); connect(m_openExplorerAct,SIGNAL(triggered()),this,SLOT(openExplorer())); connect(m_pathTree,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(treeViewContextMenuRequested(QPoint))); bool b = m_liteApp->settings()->value("GolangTool/synceditor",true).toBool(); if (b) { m_syncEditor->toggle(); } b = m_liteApp->settings()->value("GolangTool/syncproject",false).toBool(); if (b) { m_syncProject->toggle(); } m_startPathLabel->setText("null project"); }
QueueManagerWidget::QueueManagerWidget(QueueManager* qman, QWidget* parent) : QWidget(parent), qman(qman) { QHBoxLayout* layout = new QHBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); QVBoxLayout* vbox = new QVBoxLayout(); vbox->setMargin(0); vbox->setSpacing(0); view = new QTreeView(this); view->setUniformRowHeights(true); toolbar = new QToolBar(this); toolbar->setOrientation(Qt::Vertical); toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); layout->addWidget(toolbar); search = new KLineEdit(this); search->setClickMessage(i18n("Search")); search->setClearButtonShown(true); search->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); connect(search, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString))); search->hide(); vbox->addWidget(search); vbox->addWidget(view); layout->addLayout(vbox); show_search = toolbar->addAction(KIcon("edit-find"), i18n("Show Search")); show_search->setToolTip(i18n("Show or hide the search bar")); show_search->setCheckable(true); connect(show_search, SIGNAL(toggled(bool)), this, SLOT(showSearch(bool))); move_top = toolbar->addAction(KIcon("go-top"), i18n("Move Top"), this, SLOT(moveTopClicked())); move_top->setToolTip(i18n("Move a torrent to the top of the queue")); move_up = toolbar->addAction(KIcon("go-up"), i18n("Move Up"), this, SLOT(moveUpClicked())); move_up->setToolTip(i18n("Move a torrent up in the queue")); move_down = toolbar->addAction(KIcon("go-down"), i18n("Move Down"), this, SLOT(moveDownClicked())); move_down->setToolTip(i18n("Move a torrent down in the queue")); move_bottom = toolbar->addAction(KIcon("go-bottom"), i18n("Move Bottom"), this, SLOT(moveBottomClicked())); move_bottom->setToolTip(i18n("Move a torrent to the bottom of the queue")); show_downloads = toolbar->addAction(KIcon("arrow-down"), i18n("Show Downloads")); show_downloads->setToolTip(i18n("Show all downloads")); show_downloads->setCheckable(true); connect(show_downloads, SIGNAL(toggled(bool)), this, SLOT(showDownloads(bool))); show_uploads = toolbar->addAction(KIcon("arrow-up"), i18n("Show Uploads")); show_uploads->setToolTip(i18n("Show all uploads")); show_uploads->setCheckable(true); connect(show_uploads, SIGNAL(toggled(bool)), this, SLOT(showUploads(bool))); show_not_queued = toolbar->addAction(KIcon("kt-queue-manager"), i18n("Show Not Queued")); show_not_queued->setToolTip(i18n("Show all not queued torrents")); show_not_queued->setCheckable(true); connect(show_not_queued, SIGNAL(toggled(bool)), this, SLOT(showNotQueued(bool))); model = new QueueManagerModel(qman, this); view->setModel(model); view->setRootIsDecorated(false); view->setAlternatingRowColors(true); view->setSelectionBehavior(QAbstractItemView::SelectRows); view->setSortingEnabled(false); view->setDragDropMode(QAbstractItemView::InternalMove); view->setDragEnabled(true); view->setAcceptDrops(true); view->setDropIndicatorShown(true); view->setAutoScroll(true); view->setSelectionMode(QAbstractItemView::ContiguousSelection); connect(view->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); updateButtons(); }
void SettingsController::projectConfigure() { if (Project::instance()->path().isEmpty()) { KMessageBox::error(mainWindowPtr(), i18n("Create software or OpenDocument translation project first.")); return; } if (KConfigDialog::showDialog("project_settings")) { if (!m_projectActionsView->model()) m_projectActionsView->setModel(new Kross::ActionCollectionModel(m_projectActionsView,Kross::Manager::self().actionCollection()->collection(Project::instance()->kind()))); return; } KConfigDialog *dialog = new KConfigDialog(m_mainWindowPtr, "project_settings", Project::instance()); dialog->setFaceType(KPageDialog::List); // Main QWidget *w = new QWidget(dialog); Ui_prefs_projectmain ui_prefs_projectmain; ui_prefs_projectmain.setupUi(w); dialog->addPage(w, i18nc("@title:tab","General"), "preferences-desktop-locale"); ui_prefs_projectmain.kcfg_LangCode->hide(); ui_prefs_projectmain.kcfg_PoBaseDir->hide(); ui_prefs_projectmain.kcfg_GlossaryTbx->hide(); Project& p=*(Project::instance()); ui_prefs_projectmain.LangCode->setModel(LanguageListModel::instance()->sortModel()); ui_prefs_projectmain.LangCode->setCurrentIndex(LanguageListModel::instance()->sortModelRowForLangCode(p.langCode())); connect(ui_prefs_projectmain.LangCode,SIGNAL(activated(int)), ui_prefs_projectmain.kcfg_LangCode,SLOT(setLangCode(int))); ui_prefs_projectmain.poBaseDir->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); ui_prefs_projectmain.glossaryTbx->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly); ui_prefs_projectmain.glossaryTbx->setFilter("*.tbx\n*.xml"); connect(ui_prefs_projectmain.poBaseDir,SIGNAL(textChanged(QString)), ui_prefs_projectmain.kcfg_PoBaseDir,SLOT(setText(QString))); connect(ui_prefs_projectmain.glossaryTbx,SIGNAL(textChanged(QString)), ui_prefs_projectmain.kcfg_GlossaryTbx,SLOT(setText(QString))); ui_prefs_projectmain.poBaseDir->setUrl(QUrl::fromLocalFile(p.poDir())); ui_prefs_projectmain.glossaryTbx->setUrl(QUrl::fromLocalFile(p.glossaryPath())); // RegExps w = new QWidget(dialog); Ui_project_advanced ui_project_advanced; ui_project_advanced.setupUi(w); ui_project_advanced.kcfg_PotBaseDir->hide(); ui_project_advanced.kcfg_BranchDir->hide(); ui_project_advanced.kcfg_AltDir->hide(); ui_project_advanced.potBaseDir->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); ui_project_advanced.branchDir->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); ui_project_advanced.altDir->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); connect(ui_project_advanced.potBaseDir,SIGNAL(textChanged(QString)), ui_project_advanced.kcfg_PotBaseDir,SLOT(setText(QString))); connect(ui_project_advanced.branchDir,SIGNAL(textChanged(QString)), ui_project_advanced.kcfg_BranchDir,SLOT(setText(QString))); connect(ui_project_advanced.altDir,SIGNAL(textChanged(QString)), ui_project_advanced.kcfg_AltDir,SLOT(setText(QString))); ui_project_advanced.potBaseDir->setUrl(QUrl::fromLocalFile(p.potDir())); ui_project_advanced.branchDir->setUrl(QUrl::fromLocalFile(p.branchDir())); ui_project_advanced.altDir->setUrl(QUrl::fromLocalFile(p.altTransDir())); dialog->addPage(w, i18nc("@title:tab","Advanced"), "applications-development-translation"); //Scripts w = new QWidget(dialog); QVBoxLayout* layout = new QVBoxLayout(w); layout->setSpacing(6); layout->setMargin(11); //m_projectActionsEditor=new Kross::ActionCollectionEditor(Kross::Manager::self().actionCollection()->collection(Project::instance()->projectID()),w); m_projectActionsView=new ScriptsView(w); layout->addWidget(m_projectActionsView); m_projectActionsView->setModel(new Kross::ActionCollectionModel(w,Kross::Manager::self().actionCollection()->collection(Project::instance()->kind()))); QHBoxLayout* btns = new QHBoxLayout(); layout->addLayout(btns); btns->addWidget(m_projectActionsView->createButton(w, "edit")); dialog->addPage(w, i18nc("@title:tab","Scripts"), "preferences-system-windows-actions"); w = new QWidget(dialog); Ui_prefs_project_local ui_prefs_project_local; ui_prefs_project_local.setupUi(w); dialog->addPage(w, Project::local(), i18nc("@title:tab","Personal"), "preferences-desktop-user"); connect(dialog, SIGNAL(settingsChanged(QString)),Project::instance(), SLOT(reinit())); connect(dialog, SIGNAL(settingsChanged(QString)),Project::instance(), SLOT(save()), Qt::QueuedConnection); connect(dialog, SIGNAL(settingsChanged(QString)),TM::DBFilesModel::instance(), SLOT( updateProjectTmIndex())); connect(dialog, SIGNAL(settingsChanged(QString)),this, SLOT(reflectProjectConfigChange())); dialog->show(); }
OutputPaneManager::OutputPaneManager(QWidget *parent) : QWidget(parent), m_titleLabel(new QLabel), m_manageButton(new OutputPaneManageButton), m_closeButton(new QToolButton), m_minMaxAction(0), m_minMaxButton(new QToolButton), m_nextAction(0), m_prevAction(0), m_outputWidgetPane(new QStackedWidget), m_opToolBarWidgets(new QStackedWidget), m_minimizeIcon(Utils::Icons::ARROW_DOWN.icon()), m_maximizeIcon(Utils::Icons::ARROW_UP.icon()), m_outputPaneHeightSetting(0) { setWindowTitle(tr("Output")); m_titleLabel->setContentsMargins(5, 0, 5, 0); m_clearAction = new QAction(this); m_clearAction->setIcon(Utils::Icons::CLEAN.icon()); m_clearAction->setText(tr("Clear")); connect(m_clearAction, &QAction::triggered, this, &OutputPaneManager::clearPage); m_nextAction = new QAction(this); m_nextAction->setIcon(Utils::Icons::NEXT.icon()); m_nextAction->setText(tr("Next Item")); connect(m_nextAction, &QAction::triggered, this, &OutputPaneManager::slotNext); m_prevAction = new QAction(this); m_prevAction->setIcon(Utils::Icons::PREV.icon()); m_prevAction->setText(tr("Previous Item")); connect(m_prevAction, &QAction::triggered, this, &OutputPaneManager::slotPrev); m_minMaxAction = new QAction(this); m_minMaxAction->setIcon(m_maximizeIcon); m_minMaxAction->setText(tr("Maximize Output Pane")); m_closeButton->setIcon(Icons::CLOSE_SPLIT_BOTTOM.icon()); connect(m_closeButton, &QAbstractButton::clicked, this, &OutputPaneManager::slotHide); connect(ICore::instance(), &ICore::saveSettingsRequested, this, &OutputPaneManager::saveSettings); QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->setSpacing(0); mainlayout->setMargin(0); m_toolBar = new StyledBar; QHBoxLayout *toolLayout = new QHBoxLayout(m_toolBar); toolLayout->setMargin(0); toolLayout->setSpacing(0); toolLayout->addWidget(m_titleLabel); toolLayout->addWidget(new StyledSeparator); m_clearButton = new QToolButton; toolLayout->addWidget(m_clearButton); m_prevToolButton = new QToolButton; toolLayout->addWidget(m_prevToolButton); m_nextToolButton = new QToolButton; toolLayout->addWidget(m_nextToolButton); toolLayout->addWidget(m_opToolBarWidgets); toolLayout->addWidget(m_minMaxButton); toolLayout->addWidget(m_closeButton); mainlayout->addWidget(m_toolBar); mainlayout->addWidget(m_outputWidgetPane, 10); mainlayout->addWidget(new FindToolBarPlaceHolder(this)); setLayout(mainlayout); m_buttonsWidget = new QWidget; m_buttonsWidget->setLayout(new QHBoxLayout); m_buttonsWidget->layout()->setContentsMargins(5,0,0,0); m_buttonsWidget->layout()->setSpacing( creatorTheme()->flag(Theme::FlatToolBars) ? 9 : 4); StatusBarManager::addStatusBarWidget(m_buttonsWidget, StatusBarManager::Second); ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); // Window->Output Panes ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES); mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); mpanes->appendGroup("Coreplugin.OutputPane.PanesGroup"); Command *cmd; cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear"); m_clearButton->setDefaultAction(cmd->action()); m_clearButton->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem"); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6"))); m_prevToolButton->setDefaultAction( ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::PREV_TOOLBAR.icon())); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem"); m_nextToolButton->setDefaultAction( ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::NEXT_TOOLBAR.icon())); cmd->setDefaultKeySequence(QKeySequence(tr("F6"))); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax"); cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Shift+9") : tr("Alt+Shift+9"))); cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); connect(m_minMaxAction, &QAction::triggered, this, &OutputPaneManager::toggleMaximized); m_minMaxButton->setDefaultAction(cmd->action()); mpanes->addSeparator("Coreplugin.OutputPane.ActionsGroup"); QFontMetrics titleFm = m_titleLabel->fontMetrics(); int minTitleWidth = 0; Utils::sort(g_outputPanes, [](const OutputPaneData &d1, const OutputPaneData &d2) { return d1.pane->priorityInStatusBar() > d2.pane->priorityInStatusBar(); }); const int n = g_outputPanes.size(); int shortcutNumber = 1; const Id baseId = "QtCreator.Pane."; for (int i = 0; i != n; ++i) { OutputPaneData &data = g_outputPanes[i]; IOutputPane *outPane = data.pane; const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this)); QTC_CHECK(idx == i); connect(outPane, &IOutputPane::showPage, this, [this, idx](int flags) { showPage(idx, flags); }); connect(outPane, &IOutputPane::hidePage, this, &OutputPaneManager::slotHide); connect(outPane, &IOutputPane::togglePage, this, [this, idx](int flags) { if (OutputPanePlaceHolder::isCurrentVisible() && currentIndex() == idx) slotHide(); else showPage(idx, flags); }); connect(outPane, &IOutputPane::navigateStateUpdate, this, [this, idx, outPane] { if (currentIndex() == idx) { m_prevAction->setEnabled(outPane->canNavigate() && outPane->canPrevious()); m_nextAction->setEnabled(outPane->canNavigate() && outPane->canNext()); } }); QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets); QHBoxLayout *toolButtonsLayout = new QHBoxLayout; toolButtonsLayout->setMargin(0); toolButtonsLayout->setSpacing(0); foreach (QWidget *toolButton, outPane->toolBarWidgets()) toolButtonsLayout->addWidget(toolButton); toolButtonsLayout->addStretch(5); toolButtonsContainer->setLayout(toolButtonsLayout); m_opToolBarWidgets->addWidget(toolButtonsContainer); minTitleWidth = qMax(minTitleWidth, titleFm.width(outPane->displayName())); QString suffix = outPane->displayName().simplified(); suffix.remove(QLatin1Char(' ')); data.id = baseId.withSuffix(suffix); data.action = new QAction(outPane->displayName(), this); Command *cmd = ActionManager::registerAction(data.action, data.id); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); cmd->setDefaultKeySequence(paneShortCut(shortcutNumber)); auto button = new OutputPaneToggleButton(shortcutNumber, outPane->displayName(), cmd->action()); data.button = button; connect(outPane, &IOutputPane::flashButton, button, [button] { button->flash(); }); connect(outPane, &IOutputPane::setBadgeNumber, button, &OutputPaneToggleButton::setIconBadgeNumber); ++shortcutNumber; m_buttonsWidget->layout()->addWidget(data.button); connect(data.button, &QAbstractButton::clicked, this, [this, i] { buttonTriggered(i); }); bool visible = outPane->priorityInStatusBar() != -1; data.button->setVisible(visible); data.buttonVisible = visible; connect(data.action, &QAction::triggered, this, [this, i] { shortcutTriggered(i); }); } m_titleLabel->setMinimumWidth(minTitleWidth + m_titleLabel->contentsMargins().left() + m_titleLabel->contentsMargins().right()); m_buttonsWidget->layout()->addWidget(m_manageButton); connect(m_manageButton, &QAbstractButton::clicked, this, &OutputPaneManager::popupMenu); readSettings(); }
//------------------------------------------------------------------------------ QWidget *FeedPropertiesDialog::createGeneralTab() { QWidget *tab = new QWidget(); QGridLayout *layoutGeneralGrid = new QGridLayout(); QLabel *labelTitleCapt = new QLabel(tr("Title:")); QLabel *labelHomepageCapt = new QLabel(tr("Homepage:")); QLabel *labelURLCapt = new QLabel(tr("Feed URL:")); QHBoxLayout *layoutGeneralTitle = new QHBoxLayout(); editTitle = new LineEdit(); ToolButton *loadTitleButton = new ToolButton(); loadTitleButton->setIcon(QIcon(":/images/updateFeed")); loadTitleButton->setIconSize(QSize(16, 16)); loadTitleButton->setToolTip(tr("Load Title")); loadTitleButton->setFocusPolicy(Qt::NoFocus); QMenu *selectIconMenu = new QMenu(); selectIconMenu->addAction(tr("Load Favicon")); selectIconMenu->addSeparator(); selectIconMenu->addAction(tr("Select Icon...")); selectIconButton_ = new QToolButton(this); selectIconButton_->setIconSize(QSize(16, 16)); selectIconButton_->setToolTip(tr("Select Icon")); selectIconButton_->setFocusPolicy(Qt::NoFocus); selectIconButton_->setPopupMode(QToolButton::MenuButtonPopup); selectIconButton_->setMenu(selectIconMenu); layoutGeneralTitle->addWidget(editTitle, 1); layoutGeneralTitle->addWidget(loadTitleButton); layoutGeneralTitle->addWidget(selectIconButton_); editURL = new LineEdit(); disableUpdate_ = new QCheckBox(tr("Disable update")); disableUpdate_->setChecked(false); updateEnable_ = new QCheckBox(tr("Automatically update every")); updateInterval_ = new QSpinBox(); updateInterval_->setEnabled(false); updateInterval_->setRange(1, 9999); connect(updateEnable_, SIGNAL(toggled(bool)), updateInterval_, SLOT(setEnabled(bool))); updateIntervalType_ = new QComboBox(this); updateIntervalType_->setEnabled(false); QStringList intervalTypeList; intervalTypeList << tr("seconds") << tr("minutes") << tr("hours"); updateIntervalType_->addItems(intervalTypeList); connect(updateEnable_, SIGNAL(toggled(bool)), updateIntervalType_, SLOT(setEnabled(bool))); QHBoxLayout *updateFeedsLayout = new QHBoxLayout(); updateFeedsLayout->setMargin(0); updateFeedsLayout->addWidget(updateEnable_); updateFeedsLayout->addWidget(updateInterval_); updateFeedsLayout->addWidget(updateIntervalType_); updateFeedsLayout->addStretch(); connect(disableUpdate_, SIGNAL(toggled(bool)), updateEnable_, SLOT(setDisabled(bool))); connect(disableUpdate_, SIGNAL(toggled(bool)), updateInterval_, SLOT(setDisabled(bool))); connect(disableUpdate_, SIGNAL(toggled(bool)), updateIntervalType_, SLOT(setDisabled(bool))); starredOn_ = new QCheckBox(tr("Starred")); displayOnStartup = new QCheckBox(tr("Display in new tab on startup")); duplicateNewsMode_ = new QCheckBox(tr("Automatically delete duplicate news")); QHBoxLayout *layoutGeneralHomepage = new QHBoxLayout(); labelHomepage = new QLabel(); labelHomepage->setOpenExternalLinks(true); layoutGeneralHomepage->addWidget(labelHomepageCapt); layoutGeneralHomepage->addWidget(labelHomepage, 1); layoutGeneralGrid->addWidget(labelTitleCapt, 0, 0); layoutGeneralGrid->addLayout(layoutGeneralTitle, 0 ,1); layoutGeneralGrid->addWidget(labelURLCapt, 1, 0); layoutGeneralGrid->addWidget(editURL, 1, 1); QVBoxLayout *tabLayout = new QVBoxLayout(tab); tabLayout->setMargin(10); tabLayout->setSpacing(5); tabLayout->addLayout(layoutGeneralGrid); tabLayout->addLayout(layoutGeneralHomepage); tabLayout->addSpacing(15); tabLayout->addWidget(disableUpdate_); tabLayout->addLayout(updateFeedsLayout); tabLayout->addSpacing(15); tabLayout->addWidget(starredOn_); tabLayout->addWidget(displayOnStartup); tabLayout->addWidget(duplicateNewsMode_); tabLayout->addStretch(); connect(loadTitleButton, SIGNAL(clicked()), this, SLOT(setDefaultTitle())); connect(selectIconButton_, SIGNAL(clicked()), this, SLOT(selectIcon())); connect(selectIconMenu->actions().at(0), SIGNAL(triggered()), this, SLOT(loadDefaultIcon())); connect(selectIconMenu->actions().at(2), SIGNAL(triggered()), this, SLOT(selectIcon())); if (!isFeed_) { loadTitleButton->hide(); selectIconButton_->hide(); labelURLCapt->hide(); editURL->hide(); labelHomepageCapt->hide(); labelHomepage->hide(); starredOn_->hide(); duplicateNewsMode_->hide(); } return tab; }
FindApiWidget::FindApiWidget(LiteApi::IApplication *app, QWidget *parent) : QWidget(parent), m_liteApp(app) { m_findEdit = new FindApiEdit; m_findEdit->setPlaceholderText(tr("Search")); m_chaseWidget = new ChaseWidget; m_chaseWidget->setMinimumSize(QSize(16,16)); m_chaseWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); m_listView = new QListView; m_model = new QStandardItemModel(this); m_listView->setModel(m_model); m_listView->setEditTriggers(QListView::NoEditTriggers); QToolButton *findBtn = new QToolButton; findBtn->setPopupMode(QToolButton::MenuButtonPopup); findBtn->setText(tr("Find")); QHBoxLayout *findLayout = new QHBoxLayout; findLayout->setMargin(2); findLayout->addWidget(m_findEdit); findLayout->addWidget(findBtn); findLayout->addWidget(m_chaseWidget); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(1); mainLayout->setSpacing(1); mainLayout->addLayout(findLayout); mainLayout->addWidget(m_listView); this->setLayout(mainLayout); m_findThread = new FindApiThread(this); m_findThread->setFileName(m_liteApp->storagePath()+"/golangapi.txt"); connect(m_findThread,SIGNAL(findApiOut(QString,QString,QStringList)),this,SLOT(findApiOut(QString,QString,QStringList))); connect(m_findThread,SIGNAL(finished()),this,SLOT(findApiFinished())); //connect(m_findThread,SIGNAL(terminated()),this,SLOT(findApiTerminated())); //connect(findBtn,SIGNAL(clicked()),this,SLOT(findApi())); connect(m_findEdit,SIGNAL(returnPressed()),this,SLOT(findApi())); connect(m_findEdit,SIGNAL(rightButtonClicked()),m_findThread,SLOT(terminate())); connect(m_listView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(doubleClickedApi(QModelIndex))); m_rebuildThread = new ProcessEx(this); m_findAct = new QAction("Search",this); m_caseCheckAct = new QAction("Match case",this); m_caseCheckAct->setCheckable(true); m_rebuildAct = new QAction(tr("Rebuild database"),this); QMenu *menu = new QMenu(tr("Find"),findBtn); menu->addAction(m_caseCheckAct); menu->addSeparator(); menu->addAction(m_rebuildAct); findBtn->setMenu(menu); findBtn->setDefaultAction(m_findAct); connect(m_findAct,SIGNAL(triggered()),this,SLOT(findApi())); connect(m_rebuildAct,SIGNAL(triggered()),this,SLOT(rebuildApiData())); m_caseCheckAct->setChecked(m_liteApp->settings()->value("goapisearch/match_case",true).toBool()); }
void QvisLegacyStreamlinePlotWindow::CreateWindowContents() { QGridLayout *mainLayout = new QGridLayout(topLayout, 5, 2, 10, "mainLayout"); // Create the step length text field. mainLayout->addWidget(new QLabel(tr("Step length"), central, "stepLengthLabel"),0,0); stepLength = new QLineEdit(central, "stepLength"); connect(stepLength, SIGNAL(returnPressed()), this, SLOT(stepLengthProcessText())); mainLayout->addWidget(stepLength, 0,1); // Create the maximum time text field. mainLayout->addWidget(new QLabel(tr("Maximum steps"), central, "maxTimeLabel"),1,0); maxTime = new QLineEdit(central, "maxTime"); connect(maxTime, SIGNAL(returnPressed()), this, SLOT(maxTimeProcessText())); mainLayout->addWidget(maxTime, 1,1); // // Create a tab widget so we can split source type and appearance. // QTabWidget *tabs = new QTabWidget(central, "tabs"); mainLayout->addMultiCellWidget(tabs, 2,2,0,1); // // Create a tab for the streamline source widgets. // QGroupBox *topPageSource = new QGroupBox(central, "topPageSource"); topPageSource->setFrameStyle(QFrame::NoFrame); tabs->addTab(topPageSource, tr("Streamline source")); QVBoxLayout *topSourceLayout = new QVBoxLayout(topPageSource); topSourceLayout->setMargin(10); topSourceLayout->setSpacing(5); // Create the source type combo box. QHBoxLayout *hLayout = new QHBoxLayout(topSourceLayout); hLayout->addWidget(new QLabel(tr("Source type"), topPageSource, "sourceTypeLabel")); sourceType = new QComboBox(topPageSource, "sourceType"); sourceType->insertItem(tr("Point")); sourceType->insertItem(tr("Line")); sourceType->insertItem(tr("Plane")); sourceType->insertItem(tr("Sphere")); sourceType->insertItem(tr("Box")); connect(sourceType, SIGNAL(activated(int)), this, SLOT(sourceTypeChanged(int))); hLayout->addWidget(sourceType, 10); topSourceLayout->addSpacing(5); // Create a group box for the source attributes. QGroupBox *pageSource = new QGroupBox(topPageSource, "pageSource"); sourceAtts = pageSource; sourceAtts->setTitle(tr("Point")); topSourceLayout->addWidget(pageSource); topSourceLayout->addStretch(5); QVBoxLayout *svLayout = new QVBoxLayout(pageSource, 10, 2); svLayout->addSpacing(10); QGridLayout *sLayout = new QGridLayout(svLayout, 16, 2); // sLayout->setMargin(10); sLayout->setSpacing(5); // Create the widgets that specify a point source. pointSource = new QLineEdit(pageSource, "pointSource"); connect(pointSource, SIGNAL(returnPressed()), this, SLOT(pointSourceProcessText())); pointSourceLabel = new QLabel(pointSource, tr("Location"), pageSource, "pointSourceLabel"); sLayout->addWidget(pointSourceLabel, 3, 0); sLayout->addWidget(pointSource, 3,1); // Create the widgets that specify a line source. lineStart = new QLineEdit(pageSource, "lineStart"); connect(lineStart, SIGNAL(returnPressed()), this, SLOT(lineStartProcessText())); lineStartLabel = new QLabel(lineStart, tr("Start"), pageSource, "lineStartLabel"); sLayout->addWidget(lineStartLabel,4,0); sLayout->addWidget(lineStart, 4,1); lineEnd = new QLineEdit(pageSource, "lineEnd"); connect(lineEnd, SIGNAL(returnPressed()), this, SLOT(lineEndProcessText())); lineEndLabel = new QLabel(lineEnd, tr("End"), pageSource, "lineEndLabel"); sLayout->addWidget(lineEndLabel,5,0); sLayout->addWidget(lineEnd, 5,1); // Create the widgets that specify a plane source. planeOrigin = new QLineEdit(pageSource, "planeOrigin"); connect(planeOrigin, SIGNAL(returnPressed()), this, SLOT(planeOriginProcessText())); planeOriginLabel = new QLabel(planeOrigin, tr("Origin"), pageSource, "planeOriginLabel"); sLayout->addWidget(planeOriginLabel,6,0); sLayout->addWidget(planeOrigin, 6,1); planeNormal = new QLineEdit(pageSource, "planeNormal"); connect(planeNormal, SIGNAL(returnPressed()), this, SLOT(planeNormalProcessText())); planeNormalLabel = new QLabel(planeNormal, tr("Normal"), pageSource, "planeNormalLabel"); sLayout->addWidget(planeNormalLabel,7,0); sLayout->addWidget(planeNormal, 7,1); planeUpAxis = new QLineEdit(pageSource, "planeUpAxis"); connect(planeUpAxis, SIGNAL(returnPressed()), this, SLOT(planeUpAxisProcessText())); planeUpAxisLabel = new QLabel(planeUpAxis, tr("Up axis"), pageSource, "planeUpAxisLabel"); sLayout->addWidget(planeUpAxisLabel,8,0); sLayout->addWidget(planeUpAxis, 8,1); planeRadius = new QLineEdit(pageSource, "planeRadius"); connect(planeRadius, SIGNAL(returnPressed()), this, SLOT(planeRadiusProcessText())); planeRadiusLabel = new QLabel(planeRadius, tr("Radius"), pageSource, "planeRadiusLabel"); sLayout->addWidget(planeRadiusLabel,9,0); sLayout->addWidget(planeRadius, 9,1); // Create the widgets that specify a sphere source. sphereOrigin = new QLineEdit(pageSource, "sphereOrigin"); connect(sphereOrigin, SIGNAL(returnPressed()), this, SLOT(sphereOriginProcessText())); sphereOriginLabel = new QLabel(sphereOrigin, tr("Origin"), pageSource, "sphereOriginLabel"); sLayout->addWidget(sphereOriginLabel,10,0); sLayout->addWidget(sphereOrigin, 10,1); sphereRadius = new QLineEdit(pageSource, "sphereRadius"); connect(sphereRadius, SIGNAL(returnPressed()), this, SLOT(sphereRadiusProcessText())); sphereRadiusLabel = new QLabel(sphereRadius, tr("Radius"), pageSource, "sphereRadiusLabel"); sLayout->addWidget(sphereRadiusLabel,11,0); sLayout->addWidget(sphereRadius, 11,1); // Create the widgets that specify a box source useWholeBox = new QCheckBox(tr("Whole data set"), pageSource, "useWholeBox"); connect(useWholeBox, SIGNAL(toggled(bool)), this, SLOT(useWholeBoxChanged(bool))); sLayout->addWidget(useWholeBox, 12, 0); boxExtents[0] = new QLineEdit(pageSource, "boxExtents[0]"); connect(boxExtents[0], SIGNAL(returnPressed()), this, SLOT(boxExtentsProcessText())); boxExtentsLabel[0] = new QLabel(boxExtents[0], tr("X Extents"), pageSource, "boxExtentsLabel[0]"); sLayout->addWidget(boxExtentsLabel[0], 13, 0); sLayout->addWidget(boxExtents[0], 13, 1); boxExtents[1] = new QLineEdit(pageSource, "boxExtents[1]"); connect(boxExtents[1], SIGNAL(returnPressed()), this, SLOT(boxExtentsProcessText())); boxExtentsLabel[1] = new QLabel(boxExtents[1], tr("Y Extents"), pageSource, "boxExtentsLabel[1]"); sLayout->addWidget(boxExtentsLabel[1], 14, 0); sLayout->addWidget(boxExtents[1], 14, 1); boxExtents[2] = new QLineEdit(pageSource, "boxExtents[2]"); connect(boxExtents[2], SIGNAL(returnPressed()), this, SLOT(boxExtentsProcessText())); boxExtentsLabel[2] = new QLabel(boxExtents[2], tr("Z Extents"), pageSource, "boxExtentsLabel[2]"); sLayout->addWidget(boxExtentsLabel[2], 15, 0); sLayout->addWidget(boxExtents[2], 15, 1); // // Create appearance-related widgets. // QGroupBox *pageAppearance = new QGroupBox(central, "pageAppearance"); pageAppearance->setFrameStyle(QFrame::NoFrame); tabs->addTab(pageAppearance, tr("Appearance")); QGridLayout *aLayout = new QGridLayout(pageAppearance, 7, 2); aLayout->setMargin(10); aLayout->setSpacing(5); // Create widgets that help determine the appearance of the streamlines. displayMethod = new QComboBox(pageAppearance, "displayMethod"); displayMethod->insertItem(tr("Lines"), 0); displayMethod->insertItem(tr("Tubes"), 1); displayMethod->insertItem(tr("Ribbons"), 2); connect(displayMethod, SIGNAL(activated(int)), this, SLOT(displayMethodChanged(int))); aLayout->addWidget(new QLabel(displayMethod, tr("Display as"), pageAppearance, "displayMethodLabel"), 0,0); aLayout->addWidget(displayMethod, 0,1); showStart = new QCheckBox(tr("Show start"), pageAppearance, "showStart"); connect(showStart, SIGNAL(toggled(bool)), this, SLOT(showStartChanged(bool))); aLayout->addWidget(showStart, 1,1); radius = new QLineEdit(pageAppearance, "radius"); connect(radius, SIGNAL(returnPressed()), this, SLOT(radiusProcessText())); radiusLabel = new QLabel(radius, tr("Radius"), pageAppearance, "radiusLabel"); QToolTip::add(radiusLabel, tr("Radius used for tubes and ribbons.")); aLayout->addWidget(radiusLabel,2,0); aLayout->addWidget(radius, 2,1); lineWidth = new QvisLineWidthWidget(0, pageAppearance, "lineWidth"); connect(lineWidth, SIGNAL(lineWidthChanged(int)), this, SLOT(lineWidthChanged(int))); lineWidthLabel = new QLabel(lineWidth, tr("Line width"), pageAppearance, "lineWidthLabel"); aLayout->addWidget(lineWidthLabel,3,0); aLayout->addWidget(lineWidth, 3,1); coloringMethod = new QComboBox(pageAppearance, "coloringMethod"); coloringMethod->insertItem(tr("Solid"),0); coloringMethod->insertItem(tr("Speed"),1); coloringMethod->insertItem(tr("Vorticity magnitude"),2); connect(coloringMethod, SIGNAL(activated(int)), this, SLOT(coloringMethodChanged(int))); aLayout->addWidget(new QLabel(coloringMethod, tr("Color by"), pageAppearance, "colorbylabel"), 4,0); aLayout->addWidget(coloringMethod, 4,1); colorTableName = new QvisColorTableButton(pageAppearance, "colorTableName"); connect(colorTableName, SIGNAL(selectedColorTable(bool, const QString&)), this, SLOT(colorTableNameChanged(bool, const QString&))); colorTableNameLabel = new QLabel(colorTableName, tr("Color table"), pageAppearance, "colorTableNameLabel"); aLayout->addWidget(colorTableNameLabel,5,0); aLayout->addWidget(colorTableName, 5,1, Qt::AlignLeft); singleColor = new QvisColorButton(pageAppearance, "singleColor"); connect(singleColor, SIGNAL(selectedColor(const QColor&)), this, SLOT(singleColorChanged(const QColor&))); singleColorLabel = new QLabel(singleColor, tr("Single color"), pageAppearance, "singleColorLabel"); aLayout->addWidget(singleColorLabel,6,0); aLayout->addWidget(singleColor, 6,1, Qt::AlignLeft); // // Create the widget that lets the user set the point density. // mainLayout->addWidget(new QLabel(tr("Point density"), central, "pointDensityLabel"),3,0); pointDensity = new QSpinBox(1, 30, 1, central, "pointDensity"); connect(pointDensity, SIGNAL(valueChanged(int)), this, SLOT(pointDensityChanged(int))); mainLayout->addWidget(pointDensity, 3,1); //Create the direction of integration. mainLayout->addWidget(new QLabel(tr("Streamline direction"), central, "streamlineDirectionLabel"),4,0); directionType = new QComboBox(central, "directionType"); directionType->insertItem(tr("Forward")); directionType->insertItem(tr("Backward")); directionType->insertItem(tr("Both")); connect(directionType, SIGNAL(activated(int)), this, SLOT(directionTypeChanged(int))); mainLayout->addWidget(directionType, 4,1); legendFlag = new QCheckBox(tr("Legend"), central, "legendFlag"); connect(legendFlag, SIGNAL(toggled(bool)), this, SLOT(legendFlagChanged(bool))); mainLayout->addWidget(legendFlag, 5,0); lightingFlag = new QCheckBox(tr("Lighting"), central, "lightingFlag"); connect(lightingFlag, SIGNAL(toggled(bool)), this, SLOT(lightingFlagChanged(bool))); mainLayout->addWidget(lightingFlag, 5,1); }
BalloonMsg::BalloonMsg(void *param, const QString &_text, QStringList &btn, QWidget *parent, const QRect *rcParent, bool bModal, bool bAutoHide, unsigned bwidth, const QString &box_msg, bool *bChecked) : QDialog(parent, "ballon", bModal, (bAutoHide ? WType_Popup : WType_TopLevel | WStyle_StaysOnTop) | WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool | WDestructiveClose | WX11BypassWM) { m_param = param; m_parent = parent; m_width = bwidth; m_bAutoHide = bAutoHide; m_bYes = false; m_bChecked = bChecked; bool bTailDown = true; setPalette(QToolTip::palette()); text = _text; QFrame *frm = new QFrame(this); frm->setPalette(palette()); QVBoxLayout *vlay = new QVBoxLayout(frm); vlay->setMargin(0); m_check = NULL; if (!box_msg.isEmpty()){ m_check = new QCheckBox(box_msg, frm); vlay->addWidget(m_check); if (m_bChecked) m_check->setChecked(*m_bChecked); } QHBoxLayout *lay = new QHBoxLayout(vlay); lay->setSpacing(5); lay->addStretch(); unsigned id = 0; bool bFirst = true; for (QStringList::Iterator it = btn.begin(); it != btn.end(); ++it, id++){ BalloonButton *b = new BalloonButton(*it, frm, id); connect(b, SIGNAL(action(int)), this, SLOT(action(int))); lay->addWidget(b); if (bFirst){ b->setDefault(true); bFirst = false; } } setButtonsPict(this); lay->addStretch(); int wndWidth = frm->minimumSizeHint().width(); int hButton = frm->minimumSizeHint().height(); int txtWidth = bwidth; QRect rc; if (rcParent){ rc = *rcParent; }else{ QPoint p = parent->mapToGlobal(parent->rect().topLeft()); rc = QRect(p.x(), p.y(), parent->width(), parent->height()); } if (rc.width() > txtWidth) txtWidth = rc.width(); QSimpleRichText richText(_text, font(), "", QStyleSheet::defaultSheet(), QMimeSourceFactory::defaultFactory(), -1, Qt::blue, false); richText.setWidth(wndWidth); richText.adjustSize(); QSize s(richText.widthUsed(), richText.height()); QSize sMin = frm->minimumSizeHint(); if (s.width() < sMin.width()) s.setWidth(sMin.width()); int BALLOON_SHADOW = BALLOON_SHADOW_DEF; #ifdef WIN32 /* FIXME */ /* if ((GetClassLong(winId(), GCL_STYLE) & CS_DROPSHADOW) && style().inherits("QWindowsXPStyle")) BALLOON_SHADOW = 0; */ #endif resize(s.width() + BALLOON_R * 2 + BALLOON_SHADOW, s.height() + BALLOON_R * 2 + BALLOON_TAIL + BALLOON_SHADOW + hButton + BALLOON_MARGIN); mask = QBitmap(width(), height()); int w = width() - BALLOON_SHADOW; int tailX = w / 2; int posX = rc.left() + rc.width() / 2 + BALLOON_TAIL_WIDTH - tailX; if (posX <= 0) posX = 1; QRect rcScreen = screenGeometry(); if (posX + width() >= rcScreen.width()) posX = rcScreen.width() - 1 - width(); int tx = posX + tailX - BALLOON_TAIL_WIDTH; if (tx < rc.left()) tx = rc.left(); if (tx > rc.left() + rc.width()) tx = rc.left() + rc.width(); tailX = tx + BALLOON_TAIL_WIDTH - posX; if (tailX < BALLOON_R) tailX = BALLOON_R; if (tailX > width() - BALLOON_R - BALLOON_TAIL_WIDTH) tailX = width() - BALLOON_R - BALLOON_TAIL_WIDTH; if (rc.top() <= height() + 2){ bTailDown = false; move(posX, rc.top() + rc.height() + 1); }else{ move(posX, rc.top() - height() - 1); } int pos = 0; int h = height() - BALLOON_SHADOW - BALLOON_TAIL; if (!bTailDown) pos += BALLOON_TAIL; textRect.setRect(BALLOON_R, pos + BALLOON_R, w - BALLOON_R * 2, h); frm->resize(s.width(), hButton); frm->move(BALLOON_R, pos + h - BALLOON_R - hButton); QPainter p; p.begin(&mask); #ifdef WIN32 QColor bg(255, 255, 255); QColor fg(0, 0, 0); #else QColor bg(0, 0, 0); QColor fg(255, 255, 255); #endif p.fillRect(0, 0, width(), height(), bg); p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, fg); p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, fg); p.fillRect(BALLOON_SHADOW, pos + BALLOON_R + BALLOON_SHADOW, w, h - BALLOON_R * 2, fg); p.fillRect(BALLOON_R + BALLOON_SHADOW, pos + BALLOON_SHADOW, w - BALLOON_R * 2, h, fg); p.setBrush(fg); p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2); QPointArray arr(3); arr.setPoint(0, tailX, bTailDown ? h : pos); arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h : pos); arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0); p.drawPolygon(arr); arr.setPoint(0, tailX + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW); arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW); arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH + BALLOON_SHADOW, bTailDown ? height() : BALLOON_SHADOW); p.drawPolygon(arr); p.end(); setMask(mask); qApp->syncX(); QPixmap pict = QPixmap::grabWindow(QApplication::desktop()->winId(), x(), y(), width(), height()); intensity(pict, -0.50f); p.begin(&pict); p.setBrush(colorGroup().background()); p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2); p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2); arr.setPoint(0, tailX, bTailDown ? h - 1 : pos + 1); arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h - 1 : pos + 1); arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0); p.drawPolygon(arr); p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, colorGroup().background()); p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, colorGroup().background()); p.drawLine(0, pos + BALLOON_R, 0, pos + h - BALLOON_R); p.drawLine(w - 1, pos + BALLOON_R, w - 1, pos + h - BALLOON_R); if (bTailDown){ p.drawLine(BALLOON_R, 0, w - BALLOON_R, 0); p.drawLine(BALLOON_R, h - 1, tailX, h - 1); p.drawLine(tailX + BALLOON_TAIL_WIDTH, h - 1, w - BALLOON_R, h - 1); }else{ p.drawLine(BALLOON_R, pos + h - 1, w - BALLOON_R, pos + h - 1); p.drawLine(BALLOON_R, pos, tailX, pos); p.drawLine(tailX + BALLOON_TAIL_WIDTH, pos, w - BALLOON_R, pos); } p.end(); setBackgroundPixmap(pict); setAutoMask(true); if (!bAutoHide) setFocusPolicy(NoFocus); QWidget *top = NULL; if (parent) top = parent->topLevelWidget(); if (top){ raiseWindow(top); top->installEventFilter(this); } }
CubeWidget::CubeWidget(const QString &name, int pos) : ModuleWidget(name, pos) { m_active = false; m_varsCount = 0; m_cube = Kernel::instance()->getCube(); // OpenGL format QGLFormat fmt; fmt.setDepth(true); fmt.setAlpha(true); // drawer m_drawer = new CubeGLDrawer(fmt); m_gm = GUIManager::instance(); // changing one term in drawer connect(m_drawer, SIGNAL(cubeChanged(int, OutputValue &)), m_gm, SLOT(setTerm(int, OutputValue &))); // minimizing formula from drawer connect(m_drawer, SIGNAL(minRequested()), m_gm, SLOT(minimizeFormula())); // creating new formula connect(m_gm, SIGNAL(formulaChanged()), m_drawer, SLOT(reloadCube())); connect(m_gm, SIGNAL(formulaChanged()), this, SLOT(updateData())); connect(m_gm, SIGNAL(minimalFormulaChanged()), this, SLOT(updateData())); connect(m_gm, SIGNAL(minimalFormulaChanged()), m_drawer, SLOT(reloadCube())); // request for minimizing cube connect(m_gm, SIGNAL(formulaMinimized()), m_drawer, SLOT(minimizeCube())); // request for invalidating cube connect(m_gm, SIGNAL(formulaInvalidated()), m_drawer, SLOT(invalidateCube())); connect(m_gm, SIGNAL(formulaInvalidated()), this, SLOT(invalidateData())); // formula representation changed connect(m_gm, SIGNAL(repreChanged(bool)), this, SLOT(setRepre(bool))); // setting drawer activity connect(this, SIGNAL(activated(bool)), m_drawer, SLOT(setActivity(bool))); QHBoxLayout *glLayout = new QHBoxLayout; glLayout->setMargin(0); glLayout->addWidget(m_drawer); BorderWidget *borderWidget = new BorderWidget; borderWidget->setLayout(glLayout); BorderWidget *error1Widget = new BorderWidget(tr("No logic function for Cube.")); BorderWidget *error2Widget = new BorderWidget(tr("Too many variables (max 3 variables).")); m_stack = new QStackedLayout; m_stack->addWidget(borderWidget); m_stack->addWidget(error1Widget); m_stack->addWidget(error2Widget); m_stack->setCurrentIndex(1); // terms m_termsModel = new TermsModel; m_termsView = new QTableView; m_termsView->setModel(m_termsModel); m_termsView->setShowGrid(false); m_termsView->horizontalHeader()->hide(); m_termsView->setMaximumWidth(SIDEBAR_SIZE); m_mintermsStr = tr("Minterms"); m_maxtermsStr = tr("Maxterms"); m_termsLabel = new QLabel(m_gm->isSoP()? m_mintermsStr: m_maxtermsStr); m_termsLabel->setContentsMargins(3, 5, 5, 0); m_termsLabel->setBuddy(m_termsView); // covers m_coversModel = new CoversModel; m_coversView = new QTableView; m_coversView->setModel(m_coversModel); m_coversView->setShowGrid(false); m_coversView->horizontalHeader()->hide(); m_coversView->verticalHeader()->hide(); m_coversView->setMaximumWidth(SIDEBAR_SIZE); m_coversCheckBox = new QCheckBox(tr("Show covers")); m_coversCheckBox->setChecked(Constants::CUBE_COVERS_DEFAULT); m_drawer->showCovers(Constants::CUBE_COVERS_DEFAULT); connect(m_coversCheckBox, SIGNAL(toggled(bool)), this, SLOT(enableCovers(bool))); connect(m_coversCheckBox, SIGNAL(toggled(bool)), m_drawer, SLOT(showCovers(bool))); connect(m_drawer, SIGNAL(showingCoversChanged(bool)), m_coversCheckBox, SLOT(setChecked(bool))); connect(m_termsView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectTerms(QItemSelection, QItemSelection))); connect(m_coversView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectCovers(QItemSelection, QItemSelection))); #if CUBE_TEXTURES // covers tour m_tourPos = -1; QGroupBox *tourGroupBox = new QGroupBox(tr("Covers tour")); m_tourStartStr = tr("Start tour"); m_tourStopStr = tr("Stop tour"); m_tourBtn = new QPushButton(m_tourStartStr); m_tourBtn->setEnabled(false); m_tourPrevBtn = new QPushButton(tr("Prev")); m_tourPrevBtn->setEnabled(false); m_tourNextBtn = new QPushButton(tr("Next")); m_tourNextBtn->setEnabled(false); QHBoxLayout *tourShiftLayout = new QHBoxLayout; tourShiftLayout->setMargin(0); tourShiftLayout->addWidget(m_tourPrevBtn); tourShiftLayout->addWidget(m_tourNextBtn); QVBoxLayout *tourMainLayout = new QVBoxLayout; tourMainLayout->setMargin(0); tourMainLayout->addWidget(m_tourBtn); tourMainLayout->addLayout(tourShiftLayout); tourGroupBox->setLayout(tourMainLayout); // tour connections with drawer connect(m_tourBtn, SIGNAL(clicked()), m_drawer, SLOT(toggleMin())); connect(m_tourNextBtn, SIGNAL(clicked()), m_drawer, SLOT(nextMin())); connect(m_tourPrevBtn, SIGNAL(clicked()), m_drawer, SLOT(prevMin())); connect(m_drawer, SIGNAL(minStarted(int)), this, SLOT(startTour(int))); connect(m_drawer, SIGNAL(minStopped()), this, SLOT(stopTour())); connect(m_drawer, SIGNAL(minShifted(int)), this, SLOT(shiftTour(int))); #endif // espresso EspressoWidget *espressoWidget = new EspressoWidget(CubeGLDrawer::MAX_N); QVBoxLayout *sideLayout = new QVBoxLayout; sideLayout->addWidget(m_termsLabel); sideLayout->addWidget(m_termsView); sideLayout->addWidget(m_coversCheckBox); sideLayout->addWidget(m_coversView); #if CUBE_TEXTURES sideLayout->addWidget(tourGroupBox); #endif sideLayout->addWidget(espressoWidget); sideLayout->setStretchFactor(m_termsView, 5); sideLayout->setStretchFactor(m_coversView, 3); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->setMargin(0); //mainLayout->addWidget(borderWidget); mainLayout->addLayout(m_stack); mainLayout->addLayout(sideLayout); setLayout(mainLayout); setFocusPolicy(Qt::StrongFocus); }
void ShutDownFrame::initUI() { m_btnsList = new QList<RoundItemButton *>; m_shutdownButton = new RoundItemButton(tr("Shut down")); m_shutdownButton->setAutoExclusive(true); m_shutdownButton->setObjectName("ShutDownButton"); m_restartButton = new RoundItemButton(tr("Restart")); m_restartButton->setAutoExclusive(true); m_restartButton->setObjectName("RestartButton"); m_suspendButton = new RoundItemButton(tr("Suspend")); m_suspendButton->setAutoExclusive(true); m_suspendButton->setObjectName("SuspendButton"); m_lockButton = new RoundItemButton(tr("Lock")); m_lockButton->setAutoExclusive(true); m_lockButton->setObjectName("LockButton"); m_logoutButton = new RoundItemButton(tr("Log out")); m_logoutButton->setAutoExclusive(true); m_logoutButton->setObjectName("LogoutButton"); m_switchUserBtn = new RoundItemButton(tr("Switch user")); m_switchUserBtn->setAutoExclusive(true); m_switchUserBtn->setObjectName("SwitchUserButton"); QLabel *tipsIcon = new QLabel; tipsIcon->setPixmap(QPixmap(":/img/waring.png")); m_tipsLabel = new QLabel; m_tipsLabel->setAlignment(Qt::AlignCenter); m_tipsLabel->setStyleSheet("color:white;" "font-size:14px;"); QHBoxLayout *tipsLayout = new QHBoxLayout; tipsLayout->addStretch(); tipsLayout->addWidget(tipsIcon); tipsLayout->addWidget(m_tipsLabel); tipsLayout->addStretch(); m_tipsWidget = new QWidget; m_tipsWidget->hide(); m_tipsWidget->setLayout(tipsLayout); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->setMargin(0); buttonLayout->setSpacing(10); buttonLayout->addStretch(); buttonLayout->addWidget(m_shutdownButton); buttonLayout->addWidget(m_restartButton); buttonLayout->addWidget(m_suspendButton); buttonLayout->addWidget(m_lockButton); buttonLayout->addWidget(m_switchUserBtn); buttonLayout->addWidget(m_logoutButton); buttonLayout->addStretch(0); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); mainLayout->addStretch(); mainLayout->addLayout(buttonLayout); mainLayout->addWidget(m_tipsWidget); mainLayout->addStretch(); setFocusPolicy(Qt::StrongFocus); setLayout(mainLayout); updateStyle(":/skin/shutdown.qss", this); m_btnsList->append(m_shutdownButton); m_btnsList->append(m_restartButton); m_btnsList->append(m_suspendButton); m_btnsList->append(m_lockButton); m_btnsList->append(m_switchUserBtn); m_btnsList->append(m_logoutButton); m_currentSelectedBtn = m_shutdownButton; m_currentSelectedBtn->updateState(RoundItemButton::Default); //// Inhibit to shutdown inhibitShutdown(); QTimer* checkTooltip = new QTimer(this); checkTooltip->setInterval(5*60*1000); checkTooltip->start(); connect(checkTooltip, &QTimer::timeout, this, &ShutDownFrame::inhibitShutdown); }
void plotWindow::setupPlotWindow() { plot = new QGraphicsView(this); plot->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing); plot->setScene(&plotdata); QWidget *centralWidget = new QWidget; QVBoxLayout *centralLayout = new QVBoxLayout; QHBoxLayout *topContainerLayout = new QHBoxLayout; QGridLayout *topLayout = new QGridLayout; centralWidget->setLayout(centralLayout); const int margin = centralLayout->margin(); centralLayout->setMargin(0); centralLayout->addLayout(topContainerLayout); centralLayout->addWidget(plot); topContainerLayout->setMargin(margin); topContainerLayout->addLayout(topLayout); topContainerLayout->addStretch(); QLabel *matfileLabel = new QLabel("MAT file"); QLabel *xvarLabel = new QLabel("X Coordinate"); QLabel *yvarLabel = new QLabel("Y Coordinate"); QLabel *ptlabelLabel = new QLabel("LABEL"); QLabel *dimLabel = new QLabel("DIM"); matfile = new QLineEdit; matfile->setReadOnly(true); QAction *matfileAct = new QAction(QIcon(":/res/images/cr16-action-fileopen.png"), tr("&Open"), this); QToolButton *matfileButton = new QToolButton(); matfileButton->setDefaultAction(matfileAct); connect(matfileAct, SIGNAL(triggered()), this, SLOT(open())); xvar = new QComboBox; yvar = new QComboBox; ptlabel = new QSpinBox; dim = new QSpinBox; plotSelect = new QListWidget; plotSelect->setSelectionMode(QAbstractItemView::SingleSelection); QVBoxLayout *dockLayout = new QVBoxLayout; QHBoxLayout *buttonsLayout = new QHBoxLayout; QWidget *dockWidget = new QWidget; QAction *removePlotAct = new QAction(QIcon(":/res/images/cr16-action-eraser.png"), "Remove Selected", this); QToolButton *removePlotButton = new QToolButton; removePlotButton->setDefaultAction(removePlotAct); connect(removePlotAct, SIGNAL(triggered()), this, SLOT(removePlot())); QAction *colorizePlotAct = new QAction(QIcon(":/res/images/cr16-action-colorize.png"), "Change Color", this); QToolButton *colorizePlotButton = new QToolButton; colorizePlotButton->setDefaultAction(colorizePlotAct); connect(colorizePlotAct, SIGNAL(triggered()), this, SLOT(colorizePlot())); dockWidget->setLayout(dockLayout); dockLayout->setMargin(0); dockLayout->addSpacing(margin); dockLayout->addLayout(buttonsLayout); dockLayout->addWidget(plotSelect); buttonsLayout->addWidget(removePlotButton); buttonsLayout->addWidget(colorizePlotButton); QAction *addPlotAct = new QAction(QIcon(":/res/images/cr16-action-add.png"), tr("Add Plot"), this); QToolButton *addPlotButton = new QToolButton(); addPlotButton->setDefaultAction(addPlotAct); connect(addPlotAct, SIGNAL(triggered()), this, SLOT(addPlot())); QAction *clearAllPlotAct = new QAction(QIcon(":/res/images/cr16-action-remove.png"), tr("Clear All"), this); QToolButton *clearAllPlotButton = new QToolButton(); clearAllPlotButton->setDefaultAction(clearAllPlotAct); connect(clearAllPlotAct, SIGNAL(triggered()), this, SLOT(clearPlot())); QAction *printAct = new QAction(QIcon(":/res/images/cr16-action-fileprint.png"), tr("Print"), this); QToolButton *printButton = new QToolButton(); printButton->setDefaultAction(printAct); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); QAction *exportSvgAct = new QAction(QIcon(":/res/images/cr16-action-svg-export.png"), tr("Export to SVG"), this); QToolButton *exportSvgButton = new QToolButton(); exportSvgButton->setDefaultAction( exportSvgAct ); connect( exportSvgAct, SIGNAL(triggered()), this, SLOT(exportSvg()) ); QComboBox* xyLog = new QComboBox; xyLog->insertItem(0, "Linear"); xyLog->insertItem(1, "SemiLogX"); xyLog->insertItem(2, "SemiLogY"); xyLog->insertItem(3, "LogLog"); xyLog->setCurrentIndex(0); connect( xyLog, SIGNAL(currentIndexChanged(int)), &plotdata, SLOT(setAxes(int)) ); this->addWidget(dockWidget); this->addWidget(centralWidget); topLayout->addWidget(matfileLabel, 0, 0); topLayout->addWidget(xvarLabel, 0, 2); topLayout->addWidget(yvarLabel, 0, 3); topLayout->addWidget(ptlabelLabel, 0, 4); topLayout->addWidget(dimLabel, 0, 5); topLayout->addWidget(matfile, 1, 0); topLayout->addWidget(matfileButton, 1, 1); topLayout->addWidget(xvar, 1, 2); topLayout->addWidget(yvar, 1, 3); topLayout->addWidget(ptlabel, 1, 4); topLayout->addWidget(dim, 1, 5); topLayout->addWidget(addPlotButton, 1, 6); topLayout->addWidget(clearAllPlotButton, 1, 7); topLayout->addWidget(printButton, 1, 8); topLayout->addWidget(exportSvgButton, 1, 9 ); topLayout->addWidget(xyLog, 2, 0 ); plot->setMinimumSize(plot->mapFromScene(plotdata.sceneRect()).boundingRect().size()*1.1 + QSize(2*plot->frameWidth(), 2*plot->frameWidth())); }
ViewerHostProfileSelectorWithWin::ViewerHostProfileSelectorWithWin(QWidget *parent) : QDialog(parent) { setWindowModality(Qt::ApplicationModal); waitingOnUser = false; QVBoxLayout *topLayout = new QVBoxLayout(this); topLayout->setMargin(0); QGridLayout *layout = new QGridLayout; topLayout->addLayout(layout); layout->setMargin(10); layout->setSpacing(5); layout->setRowStretch(0, 100); layout->setRowStretch(1, 0); layout->setRowStretch(2, 0); layout->setRowStretch(3, 0); layout->setColumnStretch(0, 0); layout->setColumnStretch(1, 100); layout->setColumnStretch(2, 0); layout->setColumnStretch(3, 100); profiles = new QListWidget(this); profiles->setMinimumHeight(100); layout->addWidget(profiles, 0,0, 1,4); connect(profiles, SIGNAL(itemSelectionChanged()), this, SLOT(newProfileSelected())); connect(profiles, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept())); numProcsLabel = new QLabel(tr("Num procs"), this); numProcs = new QSpinBox(this); numProcs->setMinimum(1); numProcs->setMaximum(99999); layout->addWidget(numProcsLabel, 1,0); layout->addWidget(numProcs, 1,1); numNodesLabel = new QLabel(tr("Num nodes"), this); numNodes = new QSpinBox(this); numNodes->setMinimum(1); numNodes->setMaximum(99999); layout->addWidget(numNodesLabel, 1,2); layout->addWidget(numNodes, 1,3); bankNameLabel = new QLabel(tr("Bank"), this); bankName = new QLineEdit(this); layout->addWidget(bankNameLabel, 2,0); layout->addWidget(bankName, 2,1); timeLimitLabel = new QLabel(tr("Time limit"), this); timeLimit = new QLineEdit(this); layout->addWidget(timeLimitLabel, 2,2); layout->addWidget(timeLimit, 2,3); machinefileLabel = new QLabel(tr("Machine file"), this); machinefile = new QLineEdit(this); layout->addWidget(machinefileLabel, 3,0); layout->addWidget(machinefile, 3,1, 1,3); QHBoxLayout *buttonLayout = new QHBoxLayout; topLayout->addLayout(buttonLayout); buttonLayout->setMargin(10); okayButton = new QPushButton(tr("OK"), this); buttonLayout->addWidget(okayButton, 0); connect(okayButton, SIGNAL(clicked()), this, SLOT(accept())); buttonLayout->addStretch(100); cancelButton = new QPushButton(tr("Cancel"), this); buttonLayout->addWidget(cancelButton, 0); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); }
FunctionViewer::FunctionViewer(QWidget *parent, Qt::WFlags flags) #endif : QSplitter(parent) , m_xshHandle(0) , m_frameHandle(0) , m_objectHandle(0) , m_fxHandle(0) , m_columnHandle(0) , m_curve(0) , m_selection(new FunctionSelection()) , m_sceneHandle(0) { setObjectName("FunctionEditor"); // Prepare local timeline m_localFrame.setFrame(0); setFocusPolicy(Qt::NoFocus); m_treeView = new FunctionTreeView(this); m_functionGraph = new FunctionPanel(this); m_numericalColumns = new FunctionSheet(); m_toolbar = new FunctionToolbar; m_segmentViewer = new FunctionSegmentViewer(this, m_numericalColumns, m_functionGraph); QWidget *leftPanel = new QWidget(); QWidget *rightPanel = new QWidget(); //---- m_treeView->resize(150, m_treeView->size().height()); m_treeView->setMinimumWidth(0); FunctionTreeModel *ftModel = dynamic_cast<FunctionTreeModel *>(m_treeView->model()); m_functionGraph->setModel(ftModel); m_numericalColumns->setModel(ftModel); m_functionGraph->setSelection(getSelection()); m_numericalColumns->setSelection(getSelection()); m_numericalColumns->setViewer(this); m_toolbar->setSelection(m_selection); m_toolbar->setFocusPolicy(Qt::NoFocus); m_toolbar->setFrameHandle( &m_localFrame); // The function editor adopts an internal timeline m_functionGraph->setFrameHandle( &m_localFrame); // synchronized among its various sub-widgets. m_numericalColumns->setFrameHandle( &m_localFrame); // In case an external m_frameHandle is specified, // it synchronizes with that, too. //---- layout m_leftLayout = new QVBoxLayout(); m_leftLayout->setMargin(0); m_leftLayout->setSpacing(0); { m_leftLayout->addWidget(m_toolbar); if (Preferences::instance()->isShowXSheetToolbarEnabled() && Preferences::instance()->isExpandFunctionHeaderEnabled()) { m_leftLayout->addSpacing(66); } else m_leftLayout->addSpacing(36); m_leftLayout->addWidget(m_numericalColumns); } leftPanel->setLayout(m_leftLayout); addWidget(leftPanel); QVBoxLayout *rightLayout = new QVBoxLayout(); rightLayout->setMargin(0); rightLayout->setSpacing(5); { rightLayout->addWidget(m_segmentViewer, 0); rightLayout->addWidget(m_treeView, 1); } rightPanel->setLayout(rightLayout); addWidget(rightPanel); //--- set the splitter's default size setSizes(QList<int>() << 500 << 200); setStretchFactor(0, 5); setStretchFactor(1, 2); //---- signal-slot connections bool ret = true; ret = ret && connect(m_toolbar, SIGNAL(numericalColumnToggled()), this, SLOT(toggleMode())); ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()), m_functionGraph, SLOT(update())); ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()), m_numericalColumns, SLOT(updateAll())); ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_treeView, SLOT(update())); ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_functionGraph, SLOT(update())); ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_numericalColumns, SLOT(updateAll())); ret = ret && connect(ftModel, SIGNAL(curveSelected(TDoubleParam *)), this, SLOT(onCurveSelected(TDoubleParam *))); ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_segmentViewer, SLOT(onCurveChanged())); ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), this, SLOT(onCurveChanged(bool))); ret = ret && connect(&m_localFrame, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); ret = ret && connect(getSelection(), SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); ret = ret && connect(m_functionGraph, SIGNAL(keyframeSelected(double)), m_toolbar, SLOT(setFrame(double))); ret = ret && connect(m_treeView, SIGNAL(switchCurrentObject(TStageObject *)), this, SLOT(doSwitchCurrentObject(TStageObject *))); ret = ret && connect(m_treeView, SIGNAL(switchCurrentFx(TFx *)), this, SLOT(doSwitchCurrentFx(TFx *))); ret = ret && connect(ftModel, SIGNAL(currentChannelChanged(FunctionTreeModel::Channel *)), m_numericalColumns, SLOT(onCurrentChannelChanged(FunctionTreeModel::Channel *))); assert(ret); m_functionGraph->hide(); }
/*! * Конструктор класса DaemonUi. */ DaemonUi::DaemonUi(QWidget *parent) : QDialog(parent, Qt::Tool) , m_core(0) , m_feeds(0) , m_plugins(0) , m_pool(0) , m_storage(0) { Path::init(LS("schatd2")); m_settings = new Settings(Path::data() + LS("/schatd2.conf"), this); loadTranslation(); m_toolBar = new QToolBar(this); m_toolBar->setIconSize(QSize(22, 22)); m_toolBar->setStyleSheet(LS("QToolBar{margin:0px;border:0px;}")); m_menu = new QMenu(); createActions(); createButtons(); m_controlGroup = new QGroupBox(this); QHBoxLayout *controlGroupLay = new QHBoxLayout(m_controlGroup); controlGroupLay->addWidget(m_toolBar); controlGroupLay->setMargin(2); controlGroupLay->setSpacing(0); // Отображение статуса m_statusLabel = new QLabel(this); m_ledLabel = new QLabel(this); m_statusGroup = new QGroupBox(this); QHBoxLayout *statusGroupLay = new QHBoxLayout(m_statusGroup); statusGroupLay->setMargin(2); statusGroupLay->setSpacing(0); statusGroupLay->addWidget(m_statusLabel); statusGroupLay->addStretch(); statusGroupLay->addWidget(m_ledLabel); QHBoxLayout *controlLay = new QHBoxLayout; controlLay->addWidget(m_controlGroup); controlLay->addWidget(m_statusGroup); m_siteBtn = new QToolButton(this); m_siteBtn->setStyleSheet(LS("QToolButton{color:#0066cc;background:none;border:none} QToolButton:hover{text-decoration:underline}")); m_siteBtn->setText("schat.me"); m_siteBtn->setFocusPolicy(Qt::NoFocus); m_siteBtn->setCursor(Qt::PointingHandCursor); m_siteBtn->setIcon(QIcon(":/images/globe-blue.png")); m_siteBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); // Кнопки внизу окна QHBoxLayout *bottomLay = new QHBoxLayout; bottomLay->addWidget(m_siteBtn); bottomLay->addStretch(); bottomLay->addWidget(m_hideButton); bottomLay->addWidget(m_quitButton); // Все основные виджеты QVBoxLayout *bodyLay = new QVBoxLayout; bodyLay->setMargin(6); bodyLay->setSpacing(6); bodyLay->addLayout(controlLay); bodyLay->addLayout(bottomLay); // Надпись вверху окна m_aboutLabel = new QLabel(QString( "<html><body style='color:#333;margin:6px;'>" "<h4 style='margin-bottom:0px;'>Simple Chat Daemon %1</h4>" "<p style='margin-left:16px;margin-top:5px;'>Copyright © 2008-%2 Alexander Sedov <<a href='mailto:[email protected]' style='color:#0066cc;'>[email protected]</a>></p>" "</body></html>").arg(SCHAT_VERSION).arg(QDateTime::currentDateTime().toString("yyyy")), this); m_aboutLabel->setStyleSheet("background:#fff; border:4px solid #fff;"); m_aboutLabel->setOpenExternalLinks(true); QFrame *line2 = new QFrame(this); line2->setFrameShape(QFrame::HLine); line2->setFrameShadow(QFrame::Sunken); // End QVBoxLayout *mainLay = new QVBoxLayout(this); mainLay->setMargin(0); mainLay->setSpacing(0); mainLay->addWidget(m_aboutLabel); mainLay->addWidget(line2); mainLay->addLayout(bodyLay); createTray(); setState(Unknown); setWindowIcon(QIcon(":/images/schat16-green.png")); retranslateUi(); QTimer::singleShot(0, this, SLOT(init())); connect(m_siteBtn, SIGNAL(clicked()), SLOT(openSite())); }
DataWindow::DataWindow(Information *info, int ind) { index = ind; xindex = STARTING_XPIN_INDEX; yindex = STARTING_YPIN_INDEX; ui = new Ui::DataWindow; ui->setupUi(this); widgetState = WIDGET_OPENED; widgetOpenAnimation = new QPropertyAnimation(ui->actionsContainerWidget, "maximumWidth", this); widgetOpenAnimation->setDuration(WIDGET_ANIMATION_TIME); widgetOpenAnimation->setEasingCurve(QEasingCurve::OutCubic); widgetCloseAnimation = new QPropertyAnimation(ui->actionsContainerWidget, "maximumWidth", this); widgetCloseAnimation->setDuration(WIDGET_ANIMATION_TIME); widgetCloseAnimation->setEasingCurve(QEasingCurve::OutCubic); windowOpenAnimation = new QPropertyAnimation(this, "geometry", this); windowOpenAnimation->setDuration(WIDGET_ANIMATION_TIME); windowOpenAnimation->setEasingCurve(QEasingCurve::OutCubic); windowCloseAnimation = new QPropertyAnimation(this, "geometry", this); windowCloseAnimation->setDuration(WIDGET_ANIMATION_TIME); windowCloseAnimation->setEasingCurve(QEasingCurve::OutCubic); openAnimation = new QParallelAnimationGroup(this); openAnimation->addAnimation(widgetOpenAnimation); openAnimation->addAnimation(windowOpenAnimation); connect(openAnimation, SIGNAL(finished()), this, SLOT(animationFinished())); closeAnimation = new QParallelAnimationGroup(this); closeAnimation->addAnimation(widgetCloseAnimation); closeAnimation->addAnimation(windowCloseAnimation); connect(closeAnimation, SIGNAL(finished()), this, SLOT(animationFinished())); connect(ui->retractionButton, SIGNAL(released()), this, SLOT(startAnimation())); setWindowTitle(tr("Data fill window: data") + QString::number(ind+1)); information = info; selectorSide = COLUMN_SELECTION; dataTable = new DataTable(info, STARTING_ROW_COUNT, STARTING_COLUMN_COUNT, ROW_HEIGHT, COLUMN_WIDTH); columnSelector = new ColumnSelectorWidget(STARTING_COLUMN_COUNT, STARTING_XPIN_INDEX, STARTING_YPIN_INDEX, STARTING_SELECTOR_INDEX); columnActionsWidget = new ColumnActionsWidget(dataTable, info, STARTING_COLUMN_COUNT); rowSelector = new RowSelectorWidget(STARTING_ROW_COUNT); rowActionsWidget = new RowActionsWidget(STARTING_ROW_COUNT); QHBoxLayout *columnSelectorLayout = new QHBoxLayout(); columnSelectorLayout->setMargin(0); columnSelectorLayout->setSpacing(0); columnSelectorSpacer = new QWidget(); columnSelector->setFixedHeight(COLUMN_SELECTOR_HEIGHT); columnSelectorLayout->addWidget(columnSelectorSpacer); columnSelectorLayout->addWidget(columnSelector); columnSelectorLayout->addStretch(); ui->tableLayout->addLayout(columnSelectorLayout); QVBoxLayout *rowSelectorLayout = new QVBoxLayout(); rowSelectorLayout->setMargin(0); rowSelectorLayout->setSpacing(0); rowSelectorSpacer = new QWidget(); rowSelector->setFixedWidth(ROW_SELECTOR_WIDTH); rowSelectorLayout->addWidget(rowSelectorSpacer); rowSelectorLayout->addWidget(rowSelector); rowSelectorLayout->addStretch(); QHBoxLayout *secondLayout = new QHBoxLayout(); secondLayout->setMargin(0); secondLayout->setSpacing(0); secondLayout->addLayout(rowSelectorLayout); secondLayout->addWidget(dataTable); ui->tableLayout->addLayout(secondLayout); ui->tableLayout->addStretch(); updateSelectorsSize(); connect(dataTable, SIGNAL(newPosCorrections()), this, SLOT(updateSelectorsSize())); connect(dataTable, SIGNAL(newColumnCount(int)), this, SLOT(updateSelectorsSize())); connect(dataTable, SIGNAL(newRowCount(int)), this, SLOT(updateSelectorsSize())); columnSelector->updateSelectorsPos(); rowSelector->updateSelectorsPos(); ui->actionsLayout->addWidget(columnActionsWidget); ui->actionsLayout->addWidget(rowActionsWidget); rowActionsWidget->hide(); csvHandler = new CSVhandler(this); connect(csvHandler, SIGNAL(dataFromCSV(QList<QStringList>)), dataTable, SLOT(addData(QList<QStringList>))); connect(ui->open, SIGNAL(released()), this, SLOT(openData())); connect(ui->save, SIGNAL(released()), this, SLOT(saveData())); connect(columnSelector, SIGNAL(newSelectorPos(bool,int)), columnActionsWidget, SLOT(setSelectorPos(bool,int))); connect(columnSelector, SIGNAL(askForSelector()), rowSelector, SLOT(askedForSelector())); connect(columnSelector, SIGNAL(askForSelector()), this, SLOT(selectorInColumnSelection())); connect(columnSelector, SIGNAL(newSelectorPos(bool,int)), this, SLOT(selectorPosChanged(bool,int))); connect(columnSelector, SIGNAL(newXIndex(int)), this, SLOT(dataChanged())); connect(columnSelector, SIGNAL(newYIndex(int)), this, SLOT(dataChanged())); connect(rowSelector, SIGNAL(askForSelector()), this, SLOT(selectorInRowSelection())); connect(rowSelector, SIGNAL(askForSelector()), columnSelector, SLOT(askedForSelector())); connect(rowSelector, SIGNAL(newIndex(bool,int)), this, SLOT(selectorPosChanged(bool,int))); connect(rowSelector, SIGNAL(newIndex(bool,int)), rowActionsWidget, SLOT(setSelectorPos(bool,int))); connect(rowActionsWidget, SIGNAL(insertRowClicked(int)), dataTable, SLOT(insertRow(int))); connect(rowActionsWidget, SIGNAL(removeRowClicked(int)), dataTable, SLOT(removeRow(int))); connect(columnActionsWidget, SIGNAL(insertColumnClicked(int)), dataTable, SLOT(insertColumn(int))); connect(columnActionsWidget, SIGNAL(removeColumnClicked(int)), dataTable, SLOT(removeColumn(int))); connect(dataTable, SIGNAL(newColumnCount(int)), columnSelector, SLOT(setColumnCount(int))); connect(dataTable, SIGNAL(newColumnCount(int)), columnActionsWidget, SLOT(setColumnCount(int))); connect(dataTable, SIGNAL(newRowCount(int)), rowSelector, SLOT(setRowCount(int))); connect(dataTable, SIGNAL(newRowCount(int)), rowActionsWidget, SLOT(setRowCount(int))); connect(dataTable, SIGNAL(valEdited(int,int)), this, SLOT(cellValChanged(int,int))); connect(dataTable, SIGNAL(newColumnName(int)), this, SLOT(columnNameChanged(int))); connect(dataTable, SIGNAL(columnMoved(int,int,int)), this, SLOT(columnMoved(int,int,int))); connect(ui->cartesian, SIGNAL(toggled(bool)), columnSelector, SLOT(setCoordinateSystem(bool))); connect(ui->cartesian, SIGNAL(toggled(bool)), this, SLOT(remakeDataList())); //connect to row actions widget connect(ui->addModel, SIGNAL(released()), this, SLOT(addModel())); connect(ui->polar, SIGNAL(toggled(bool)), this, SLOT(coordinateSystemChanged(bool))); connect(ui->help, SIGNAL(released()), this, SIGNAL(showHelpWindow())); }
void acEXRTool::Init(const QString & title, const QString & productName) { Q_UNUSED(productName) // Set the dialog title: setWindowTitle(title); resize(300,150); // Set window flags (minimize / maximize / close buttons): Qt::WindowFlags flags = windowFlags(); flags &= ~Qt::WindowContextHelpButtonHint; flags |= Qt::WindowStaysOnTopHint; setWindowFlags(flags); // layout components: QHBoxLayout* pMainLayout = new QHBoxLayout; QVBoxLayout* pVerticalLayout = new QVBoxLayout; //Add exposure, defog, kneelow, kneehigh slider widget QHBoxLayout* exposureLayout = new QHBoxLayout; QLabel *exposureLabel = new QLabel(this); exposureLabel->setText("Exposure:"); exrExposureBox = new QDoubleSpinBox; exrExposureBox->setValue(DEFAULT_EXPOSURE); exrExposureBox->setDecimals(3); exrExposureBox->setRange(-10, 10); exrExposureBox->setSingleStep(0.125); exposureLayout->addWidget(exposureLabel); exposureLayout->addWidget(exrExposureBox); QHBoxLayout* defogLayout = new QHBoxLayout; QLabel *defogLabel = new QLabel(this); defogLabel->setText("Defog:"); exrDefogBox = new QDoubleSpinBox; exrDefogBox->setDecimals(3); exrDefogBox->setRange(0, 0.01); exrDefogBox->setValue(DEFAULT_DEFOG); exrDefogBox->setSingleStep(0.001); defogLayout->addWidget(defogLabel); defogLayout->addWidget(exrDefogBox); QHBoxLayout* klLayout = new QHBoxLayout; QLabel *klLabel = new QLabel(this); klLabel->setText("Knee Low:"); exrKneeLowBox = new QDoubleSpinBox; exrKneeLowBox->setDecimals(3); exrKneeLowBox->setRange(-3, 3); exrKneeLowBox->setValue(DEFAULT_KNEELOW); exrKneeLowBox->setSingleStep(0.125); klLayout->addWidget(klLabel); klLayout->addWidget(exrKneeLowBox); QHBoxLayout* khLayout = new QHBoxLayout; QLabel *khLabel = new QLabel(this); khLabel->setText("Knee High:"); exrKneeHighBox = new QDoubleSpinBox; exrKneeHighBox->setDecimals(3); exrKneeHighBox->setRange(3.5, 7.5); exrKneeHighBox->setValue(DEFAULT_KNEEHIGH); exrKneeHighBox->setSingleStep(0.125); khLayout->addWidget(khLabel); khLayout->addWidget(exrKneeHighBox); QHBoxLayout* gammaLayout = new QHBoxLayout; QLabel *gammaLabel = new QLabel(this); gammaLabel->setText("Gamma:"); exrGammaBox = new QDoubleSpinBox; exrGammaBox->setDecimals(1); exrGammaBox->setRange(1.0, 2.6); exrGammaBox->setValue(DEFAULT_GAMMA); exrGammaBox->setSingleStep(0.2); gammaLayout->addWidget(gammaLabel); gammaLayout->addWidget(exrGammaBox); // Buttons m_PBClose = new QPushButton("Close"); connect(m_PBClose, SIGNAL(pressed()), this, SLOT(onClose())); // Left Vertical Layout: pVerticalLayout->addLayout(exposureLayout); pVerticalLayout->addLayout(defogLayout); pVerticalLayout->addLayout(klLayout); pVerticalLayout->addLayout(khLayout); pVerticalLayout->addLayout(gammaLayout); pVerticalLayout->addWidget(m_PBClose, 0, Qt::AlignCenter | Qt::AlignBottom); pVerticalLayout->setMargin(10); // Main Horizontal Layout: pMainLayout->addLayout(pVerticalLayout); pMainLayout->setMargin(0); // Activate: setLayout(pMainLayout); }
QgsVectorLayerProperties::QgsVectorLayerProperties( QgsVectorLayer *lyr, QWidget * parent, Qt::WFlags fl ) : QDialog( parent, fl ) , layer( lyr ) , mMetadataFilled( false ) , mRendererDialog( 0 ) { setupUi( this ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) ); connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) ); connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) ); connect( btnUseNewSymbology, SIGNAL( clicked() ), this, SLOT( useNewSymbology() ) ); QVBoxLayout *layout; if ( layer->hasGeometryType() ) { // Create the Labeling dialog tab layout = new QVBoxLayout( labelingFrame ); layout->setMargin( 0 ); labelingDialog = new QgsLabelingGui( QgisApp::instance()->palLabeling(), layer, QgisApp::instance()->mapCanvas(), labelingFrame ); layout->addWidget( labelingDialog ); labelingFrame->setLayout( layout ); // Create the Labeling (deprecated) dialog tab layout = new QVBoxLayout( labelOptionsFrame ); layout->setMargin( 0 ); labelDialog = new QgsLabelDialog( layer->label(), labelOptionsFrame ); layout->addWidget( labelDialog ); labelOptionsFrame->setLayout( layout ); connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) ); } else { labelingDialog = 0; labelDialog = 0; tabWidget->setTabEnabled( 1, false ); // hide labeling item tabWidget->setTabEnabled( 2, false ); // hide labeling (deprecated) item } // Create the Actions dialog tab QVBoxLayout *actionLayout = new QVBoxLayout( actionOptionsFrame ); actionLayout->setMargin( 0 ); const QgsFieldMap &fields = layer->pendingFields(); actionDialog = new QgsAttributeActionDialog( layer->actions(), fields, actionOptionsFrame ); actionLayout->addWidget( actionDialog ); // Create the menu for the save style button to choose the output format mSaveAsMenu = new QMenu( pbnSaveStyleAs ); mSaveAsMenu->addAction( tr( "QGIS Layer Style File" ) ); mSaveAsMenu->addAction( tr( "SLD File" ) ); QObject::connect( mSaveAsMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( saveStyleAsMenuTriggered( QAction * ) ) ); mFieldsPropertiesDialog = new QgsFieldsProperties( layer, mFieldsFrame ); mFieldsFrame->setLayout( new QVBoxLayout( mFieldsFrame ) ); mFieldsFrame->layout()->addWidget( mFieldsPropertiesDialog ); reset(); if ( layer->dataProvider() )//enable spatial index button group if supported by provider { int capabilities = layer->dataProvider()->capabilities(); if ( !( capabilities&QgsVectorDataProvider::CreateSpatialIndex ) ) { pbnIndex->setEnabled( false ); } if ( capabilities & QgsVectorDataProvider::SetEncoding ) { cboProviderEncoding->addItems( QgsVectorDataProvider::availableEncodings() ); QString enc = layer->dataProvider()->encoding(); int encindex = cboProviderEncoding->findText( enc ); if ( encindex < 0 ) { cboProviderEncoding->insertItem( 0, enc ); encindex = 0; } cboProviderEncoding->setCurrentIndex( encindex ); } else { // currently only encoding can be set in this group, so hide it completely grpProviderOptions->hide(); } } leSpatialRefSys->setText( layer->crs().authid() + " - " + layer->crs().description() ); leSpatialRefSys->setCursorPosition( 0 ); connect( sliderTransparency, SIGNAL( valueChanged( int ) ), this, SLOT( sliderTransparency_valueChanged( int ) ) ); //insert existing join info const QList< QgsVectorJoinInfo >& joins = layer->vectorJoins(); for ( int i = 0; i < joins.size(); ++i ) { addJoinToTreeWidget( joins[i] ); } diagramPropertiesDialog = new QgsDiagramProperties( layer, mDiagramFrame ); mDiagramFrame->setLayout( new QVBoxLayout( mDiagramFrame ) ); mDiagramFrame->layout()->addWidget( diagramPropertiesDialog ); //layer title and abstract if ( layer ) { mLayerTitleLineEdit->setText( layer->title() ); mLayerAbstractTextEdit->setPlainText( layer->abstract() ); } QSettings settings; restoreGeometry( settings.value( "/Windows/VectorLayerProperties/geometry" ).toByteArray() ); int tabIndex = settings.value( "/Windows/VectorLayerProperties/row", 0 ).toInt(); // if the last used tab is not enabled display the first enabled one if ( !tabWidget->isTabEnabled( tabIndex ) ) { tabIndex = 0; for ( int i = 0; i < tabWidget->count(); i++ ) { if ( tabWidget->isTabEnabled( i ) ) { tabIndex = i; break; } } } tabWidget->setCurrentIndex( tabIndex ); setWindowTitle( tr( "Layer Properties - %1" ).arg( layer->name() ) ); } // QgsVectorLayerProperties ctor
void EffectWidgetPrivate::autogenerateUi() { Q_Q(EffectWidget); QVBoxLayout *mainLayout = new QVBoxLayout(q); mainLayout->setMargin(0); const QList<Phonon::EffectParameter> parameters = effect->parameters(); for (int i = 0; i < parameters.count(); ++i) { const EffectParameter ¶ = parameters.at(i); QVariant value = effect->parameterValue(para); QHBoxLayout *pLayout = new QHBoxLayout; mainLayout->addLayout(pLayout); QLabel *label = new QLabel(q); pLayout->addWidget(label); label->setText(para.name()); #ifndef QT_NO_TOOLTIP label->setToolTip(para.description()); #endif QWidget *control = 0; switch (int(para.type())) { case QVariant::String: { QComboBox *cb = new QComboBox(q); control = cb; if (value.type() == QVariant::Int) { //value just defines the item index for (int i = 0; i < para.possibleValues().count(); ++i) { cb->addItem(para.possibleValues().at(i).toString()); } cb->setCurrentIndex(value.toInt()); QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int))); } else { for (int i = 0; i < para.possibleValues().count(); ++i) { const QVariant &item = para.possibleValues().at(i); cb->addItem(item.toString()); if (item == value) { cb->setCurrentIndex(cb->count() - 1); } } QObject::connect(cb, SIGNAL(currentIndexChanged(QString)), q, SLOT(_k_setStringParameter(QString))); } } break; case QVariant::Bool: { QCheckBox *cb = new QCheckBox(q); control = cb; cb->setChecked(value.toBool()); QObject::connect(cb, SIGNAL(toggled(bool)), q, SLOT(_k_setToggleParameter(bool))); } break; case QVariant::Int: { QSpinBox *sb = new QSpinBox(q); control = sb; bool minValueOk = false; bool maxValueOk = false; const int minValue = para.minimumValue().toInt(&minValueOk); const int maxValue = para.maximumValue().toInt(&maxValueOk); sb->setRange(minValueOk ? minValue : DEFAULT_MIN_INT, maxValueOk ? maxValue : DEFAULT_MAX_INT); sb->setValue(value.toInt()); QObject::connect(sb, SIGNAL(valueChanged(int)), q, SLOT(_k_setIntParameter(int))); } break; case QMetaType::Float: case QVariant::Double: { const qreal minValue = para.minimumValue().canConvert(QVariant::Double) ? para.minimumValue().toReal() : DEFAULT_MIN; const qreal maxValue = para.maximumValue().canConvert(QVariant::Double) ? para.maximumValue().toReal() : DEFAULT_MAX; if (minValue == -1. && maxValue == 1.) { //Special case values between -1 and 1.0 to use a slider for improved usability QSlider *slider = new QSlider(Qt::Horizontal, q); control = slider; slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE); slider->setValue(int(SLIDER_RANGE * value.toReal())); slider->setTickPosition(QSlider::TicksBelow); slider->setTickInterval(TICKINTERVAL); QObject::connect(slider, SIGNAL(valueChanged(int)), q, SLOT(_k_setSliderParameter(int))); } else { double step = 0.1; if (qAbs(maxValue - minValue) > 50) step = 1.0; QDoubleSpinBox *sb = new QDoubleSpinBox(q); control = sb; sb->setRange(minValue, maxValue); sb->setValue(value.toDouble()); sb->setSingleStep(step); QObject::connect(sb, SIGNAL(valueChanged(double)), q, SLOT(_k_setDoubleParameter(double))); } } break; default: break; } if (control) { #ifndef QT_NO_TOOLTIP control->setToolTip(para.description()); #endif #ifndef QT_NO_SHORTCUT label->setBuddy(control); #endif pLayout->addWidget(control); parameterForObject.insert(control, para); } } }
/** * Sets up the dialog. */ void UMLOperationDialog::setupDialog() { QFrame *frame = new QFrame(this); setMainWidget(frame); int margin = fontMetrics().height(); QVBoxLayout * topLayout = new QVBoxLayout(frame); m_pGenGB = new QGroupBox(i18n("General Properties"), frame); QGridLayout * genLayout = new QGridLayout(m_pGenGB); genLayout->setColumnStretch(1, 1); genLayout->setColumnStretch(3, 1); genLayout->addItem(new QSpacerItem(200, 0), 0, 1); genLayout->addItem(new QSpacerItem(200, 0), 0, 3); genLayout->setMargin(margin); genLayout->setSpacing(10); Dialog_Utils::makeLabeledEditField(genLayout, 0, m_pNameL, i18nc("operation name", "&Name:"), m_pNameLE, m_operation->name()); m_datatypeWidget = new UMLDatatypeWidget(m_operation); m_datatypeWidget->addToLayout(genLayout, 0, 2); m_stereotypeWidget = new UMLStereotypeWidget(m_operation); m_stereotypeWidget->addToLayout(genLayout, 1); m_pAbstractCB = new QCheckBox(i18n("&Abstract operation"), m_pGenGB); m_pAbstractCB->setChecked(m_operation->isAbstract()); genLayout->addWidget(m_pAbstractCB, 2, 0); m_pStaticCB = new QCheckBox(i18n("Classifier &scope (\"static\")"), m_pGenGB); m_pStaticCB->setChecked(m_operation->isStatic()); genLayout->addWidget(m_pStaticCB, 2, 1); m_pQueryCB = new QCheckBox(i18n("&Query (\"const\")"), m_pGenGB); m_pQueryCB->setChecked(m_operation->getConst()); genLayout->addWidget(m_pQueryCB, 2, 2); m_visibilityEnumWidget = new VisibilityEnumWidget(m_operation, this); m_docWidget = new DocumentationWidget(m_operation, this); m_pParmsGB = new QGroupBox(i18n("Parameters"), frame); QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB); parmsLayout->setMargin(margin); parmsLayout->setSpacing(10); // horizontal box contains the list box and the move up/down buttons QHBoxLayout* parmsHBoxLayout = new QHBoxLayout(); m_pParmsLW = new QListWidget(m_pParmsGB); m_pParmsLW->setContextMenuPolicy(Qt::CustomContextMenu); // the move up/down buttons (another vertical box) QVBoxLayout* buttonLayout = new QVBoxLayout(); m_pUpButton = new QToolButton(m_pParmsGB); m_pUpButton->setArrowType(Qt::UpArrow); m_pUpButton->setEnabled(false); buttonLayout->addWidget(m_pUpButton); m_pDownButton = new QToolButton(m_pParmsGB); m_pDownButton->setArrowType(Qt::DownArrow); m_pDownButton->setEnabled(false); buttonLayout->addWidget(m_pDownButton); #if QT_VERSION >= 0x050000 QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pParmsGB); QPushButton* newParam = buttonBox->addButton(i18n("Ne&w Parameter..."), QDialogButtonBox::ActionRole); connect(newParam, SIGNAL(clicked()), this, SLOT(slotNewParameter())); m_pDeleteButton = buttonBox->addButton(i18n("&Delete"), QDialogButtonBox::ActionRole); connect(m_pDeleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteParameter())); m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), QDialogButtonBox::ActionRole); connect(m_pPropertiesButton, SIGNAL(clicked()), this, SLOT(slotParameterProperties())); #else KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pParmsGB); buttonBox->addButton(i18n("Ne&w Parameter..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewParameter())); m_pDeleteButton = buttonBox->addButton(i18n("&Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDeleteParameter())); m_pPropertiesButton = buttonBox->addButton(i18n("&Properties"), KDialogButtonBox::ActionRole, this, SLOT(slotParameterProperties())); #endif parmsHBoxLayout->addWidget(m_pParmsLW); parmsHBoxLayout->addLayout(buttonLayout); parmsLayout->addLayout(parmsHBoxLayout); parmsLayout->addWidget(buttonBox); topLayout->addWidget(m_pGenGB); topLayout->addWidget(m_visibilityEnumWidget); topLayout->addWidget(m_docWidget); topLayout->addWidget(m_pParmsGB); m_pDeleteButton->setEnabled(false); m_pPropertiesButton->setEnabled(false); m_pUpButton->setEnabled(false); m_pDownButton->setEnabled(false); // fill in parm list box UMLAttributeList list = m_operation->getParmList(); foreach (UMLAttribute* pAtt, list) { m_pParmsLW->addItem(pAtt->toString(Uml::SignatureType::SigNoVis)); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle("QML Easing Curve Editor"); SplineEditor *splineEditor = new SplineEditor(this); QWidget *mainWidget = new QWidget(this); setCentralWidget(mainWidget); QHBoxLayout *hboxLayout = new QHBoxLayout(mainWidget); QVBoxLayout *vboxLayout = new QVBoxLayout(); mainWidget->setLayout(hboxLayout); hboxLayout->addLayout(vboxLayout); QWidget *propertyWidget = new QWidget(this); ui_properties.setupUi(propertyWidget); ui_properties.spinBox->setMinimum(50); ui_properties.spinBox->setMaximum(10000); ui_properties.spinBox->setValue(500); hboxLayout->addWidget(propertyWidget); m_placeholder = new QWidget(this); m_placeholder->setFixedSize(quickView.size()); vboxLayout->addWidget(splineEditor); vboxLayout->addWidget(m_placeholder); ui_properties.plainTextEdit->setPlainText(splineEditor->generateCode()); connect(splineEditor, SIGNAL(easingCurveCodeChanged(QString)), ui_properties.plainTextEdit, SLOT(setPlainText(QString))); quickView.rootContext()->setContextProperty(QLatin1String("spinBox"), ui_properties.spinBox); foreach (const QString &name, splineEditor->presetNames()) ui_properties.comboBox->addItem(name); connect(ui_properties.comboBox, SIGNAL(currentIndexChanged(QString)), splineEditor, SLOT(setPreset(QString))); splineEditor->setPreset(ui_properties.comboBox->currentText()); QVBoxLayout *groupBoxLayout = new QVBoxLayout(ui_properties.groupBox); groupBoxLayout->setMargin(0); ui_properties.groupBox->setLayout(groupBoxLayout); groupBoxLayout->addWidget(splineEditor->pointListWidget()); m_splineEditor = splineEditor; connect(ui_properties.plainTextEdit, SIGNAL(textChanged()), this, SLOT(textEditTextChanged())); QDialog* importDialog = new QDialog(this); ui_import.setupUi(importDialog); ui_import.inInfluenceEdit->setValidator(new QDoubleValidator(this)); ui_import.inSlopeEdit->setValidator(new QDoubleValidator(this)); ui_import.outInfluenceEdit->setValidator(new QDoubleValidator(this)); ui_import.outSlopeEdit->setValidator(new QDoubleValidator(this)); connect(ui_properties.importButton, SIGNAL(clicked()), importDialog, SLOT(show())); connect(importDialog, SIGNAL(finished(int)), this, SLOT(importData(int))); connect(this, SIGNAL(close()), this, SLOT(doClose())); initQml(); }
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent) : QWidget(parent), m_qmakeRunConfiguration(qmakeRunConfiguration) { QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); vboxTopLayout->setMargin(0); QHBoxLayout *hl = new QHBoxLayout(); hl->addStretch(); m_disabledIcon = new QLabel(this); m_disabledIcon->setPixmap(QPixmap(QLatin1String(Core::Constants::ICON_WARNING))); hl->addWidget(m_disabledIcon); m_disabledReason = new QLabel(this); m_disabledReason->setVisible(false); hl->addWidget(m_disabledReason); hl->addStretch(); vboxTopLayout->addLayout(hl); m_detailsContainer = new DetailsWidget(this); m_detailsContainer->setState(DetailsWidget::NoSummary); vboxTopLayout->addWidget(m_detailsContainer); QWidget *detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); m_executableLineLabel = new QLabel(m_qmakeRunConfiguration->executable(), this); m_executableLineLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); toplayout->addRow(tr("Executable:"), m_executableLineLabel); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); m_argumentsLineEdit = new QLineEdit(qmakeRunConfiguration->rawCommandLineArguments(), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new PathChooser(this); m_workingDirectoryEdit->setExpectedKind(PathChooser::Directory); m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qmake.WorkingDir.History")); m_workingDirectoryEdit->setPath(m_qmakeRunConfiguration->baseWorkingDirectory()); m_workingDirectoryEdit->setBaseFileName(m_qmakeRunConfiguration->target()->project()->projectDirectory()); EnvironmentAspect *aspect = qmakeRunConfiguration->extraAspect<EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(this); resetButton->setToolTip(tr("Reset to default")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->setMargin(0); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); toplayout->addRow(tr("Working directory:"), boxlayout); QHBoxLayout *innerBox = new QHBoxLayout(); m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); m_useTerminalCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console); innerBox->addWidget(m_useTerminalCheck); m_useQvfbCheck = new QCheckBox(tr("Run on QVFb"), this); m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer.")); m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console); m_useQvfbCheck->setVisible(false); innerBox->addWidget(m_useQvfbCheck); innerBox->addStretch(); toplayout->addRow(QString(), innerBox); if (HostOsInfo::isMacHost()) { m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this); m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix()); toplayout->addRow(QString(), m_usingDyldImageSuffix); connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)), this, SLOT(usingDyldImageSuffixToggled(bool))); } runConfigurationEnabledChange(); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(workDirectoryEdited())); connect(resetButton, SIGNAL(clicked()), this, SLOT(workingDirectoryReseted())); connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(argumentsEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); connect(m_useQvfbCheck, SIGNAL(toggled(bool)), this, SLOT(qvfbToggled(bool))); connect(qmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); connect(qmakeRunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)), this, SLOT(commandLineArgumentsChanged(QString))); connect(qmakeRunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::ApplicationLauncher::Mode)), this, SLOT(runModeChanged(ProjectExplorer::ApplicationLauncher::Mode))); connect(qmakeRunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)), this, SLOT(usingDyldImageSuffixChanged(bool))); connect(qmakeRunConfiguration, SIGNAL(effectiveTargetInformationChanged()), this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection); connect(qmakeRunConfiguration, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); Core::VariableChooser::addSupportForChildWidgets(this, m_qmakeRunConfiguration->macroExpander()); }
FileDescriptorWidget::FileDescriptorWidget(QWidget* parent) : QWidget(parent), mpFileDescriptor(NULL), mReadOnly(true), mModified(false), mpTreeWidget(NULL), mpFileBrowser(NULL), mpGcpGroup(NULL), mpGcpTree(NULL) { // Item tree widget QStringList columnNames; columnNames.append("Item"); columnNames.append("Value"); mpTreeWidget = new CustomTreeWidget(this); mpTreeWidget->setColumnCount(columnNames.count()); mpTreeWidget->setHeaderLabels(columnNames); mpTreeWidget->setRootIsDecorated(true); mpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); mpTreeWidget->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true); mpTreeWidget->setSortingEnabled(false); QHeaderView* pHeader = mpTreeWidget->header(); if (pHeader != NULL) { pHeader->setSortIndicatorShown(false); pHeader->setMovable(false); pHeader->setStretchLastSection(true); pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); pHeader->resizeSection(0, 150); } // Band file browser mpFileBrowser = new FileBrowser(mpTreeWidget); mpFileBrowser->setBrowseCaption("Select Band File"); mpFileBrowser->hide(); // GCP group box mpGcpGroup = new QGroupBox("Ground Control Points (GCP)", this); // GCP tree widget columnNames.clear(); columnNames.append("Name"); columnNames.append("Column"); columnNames.append("Row"); columnNames.append("Latitude"); columnNames.append("Longitude"); mpGcpTree = new CustomTreeWidget(mpGcpGroup); mpGcpTree->setColumnCount(columnNames.count()); mpGcpTree->setHeaderLabels(columnNames); mpGcpTree->setRootIsDecorated(false); mpGcpTree->setSelectionMode(QAbstractItemView::SingleSelection); mpGcpTree->setGridlinesShown(Qt::Horizontal | Qt::Vertical, true); mpGcpTree->setSortingEnabled(true); pHeader = mpGcpTree->header(); if (pHeader != NULL) { pHeader->setSortIndicatorShown(true); pHeader->setMovable(false); pHeader->setStretchLastSection(false); pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); pHeader->resizeSection(0, 75); pHeader->resizeSection(1, 75); pHeader->resizeSection(2, 75); } // Layout QVBoxLayout* pGcpLayout = new QVBoxLayout(mpGcpGroup); pGcpLayout->setMargin(10); pGcpLayout->setSpacing(10); pGcpLayout->addWidget(mpGcpTree, 10); QVBoxLayout* pLayout = new QVBoxLayout(this); pLayout->setMargin(0); pLayout->setSpacing(10); pLayout->addWidget(mpTreeWidget); pLayout->addWidget(mpGcpGroup); // Connections VERIFYNR(connect(mpTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(descriptorItemChanged(QTreeWidgetItem*, int)))); }
TempoDialog::TempoDialog(QWidget *parent, RosegardenDocument *doc, bool timeEditable): QDialog(parent), m_doc(doc), m_tempoTime(0) { setModal(true); setWindowTitle(tr("Insert Tempo Change")); setObjectName("MinorDialog"); QWidget* vbox = dynamic_cast<QWidget*>(this); QVBoxLayout *vboxLayout = new QVBoxLayout; vbox->setLayout(vboxLayout); // group box for tempo QGroupBox *frame = new QGroupBox(tr("Tempo"), vbox); frame->setContentsMargins(5, 5, 5, 5); QGridLayout *layout = new QGridLayout; layout->setSpacing(5); vboxLayout->addWidget(frame); // Set tempo layout->addWidget(new QLabel(tr("New tempo:"), frame), 0, 1); m_tempoValueSpinBox = new QDoubleSpinBox(frame); m_tempoValueSpinBox->setDecimals(3); m_tempoValueSpinBox->setMaximum(1000); m_tempoValueSpinBox->setMinimum(1); m_tempoValueSpinBox->setSingleStep(1); m_tempoValueSpinBox->setValue(120); // will set properly below layout->addWidget(m_tempoValueSpinBox, 0, 2); connect(m_tempoValueSpinBox, SIGNAL(valueChanged(double)), SLOT(slotTempoChanged(double))); m_tempoTap= new QPushButton(tr("Tap"), frame); layout->addWidget(m_tempoTap, 0, 3); connect(m_tempoTap, SIGNAL(clicked()), SLOT(slotTapClicked())); m_tempoConstant = new QRadioButton(tr("Tempo is fixed until the following tempo change"), frame); m_tempoRampToNext = new QRadioButton(tr("Tempo ramps to the following tempo"), frame); m_tempoRampToTarget = new QRadioButton(tr("Tempo ramps to:"), frame); // m_tempoTargetCheckBox = new QCheckBox(tr("Ramping to:"), frame); m_tempoTargetSpinBox = new QDoubleSpinBox(frame); m_tempoTargetSpinBox->setDecimals(3); m_tempoTargetSpinBox->setMaximum(1000); m_tempoTargetSpinBox->setMinimum(1); m_tempoTargetSpinBox->setSingleStep(1); m_tempoTargetSpinBox->setValue(120); // layout->addWidget(m_tempoTargetCheckBox, 1, 0, 0+1, 1- 1, AlignRight); // layout->addWidget(m_tempoTargetSpinBox, 1, 2); layout->addWidget(m_tempoConstant, 1, 1, 1, 2); layout->addWidget(m_tempoRampToNext, 2, 1, 1, 2); layout->addWidget(m_tempoRampToTarget, 3, 1); layout->addWidget(m_tempoTargetSpinBox, 3, 2); // connect(m_tempoTargetCheckBox, SIGNAL(clicked()), // SLOT(slotTargetCheckBoxClicked())); connect(m_tempoConstant, SIGNAL(clicked()), SLOT(slotTempoConstantClicked())); connect(m_tempoRampToNext, SIGNAL(clicked()), SLOT(slotTempoRampToNextClicked())); connect(m_tempoRampToTarget, SIGNAL(clicked()), SLOT(slotTempoRampToTargetClicked())); connect(m_tempoTargetSpinBox, SIGNAL(valueChanged(double)), SLOT(slotTargetChanged(double))); m_tempoBeatLabel = new QLabel(frame); layout->addWidget(m_tempoBeatLabel, 0, 4); m_tempoBeat = new QLabel(frame); layout->addWidget(m_tempoBeat, 0, 5); m_tempoBeatsPerMinute = new QLabel(frame); layout->addWidget(m_tempoBeatsPerMinute, 0, 6); frame->setLayout(layout); m_timeEditor = 0; if (timeEditable) { m_timeEditor = new TimeWidget (tr("Time of tempo change"), vbox, &m_doc->getComposition(), 0, true); vboxLayout->addWidget(m_timeEditor); } else { // group box for scope (area) QGroupBox *scopeGroup = new QGroupBox(tr("Scope"), vbox); vboxLayout->addWidget(scopeGroup); QVBoxLayout * scopeBoxLayout = new QVBoxLayout(scopeGroup); scopeBoxLayout->setSpacing(5); scopeBoxLayout->setMargin(5); QVBoxLayout * currentBoxLayout = scopeBoxLayout; QWidget * currentBox = scopeGroup; QLabel *child_15 = new QLabel(tr("The pointer is currently at "), currentBox); currentBoxLayout->addWidget(child_15); m_tempoTimeLabel = new QLabel(currentBox); currentBoxLayout->addWidget(m_tempoTimeLabel); m_tempoBarLabel = new QLabel(currentBox); currentBoxLayout->addWidget(m_tempoBarLabel); QLabel *spare = new QLabel(currentBox); currentBoxLayout->addWidget(spare); currentBox->setLayout(currentBoxLayout); currentBoxLayout->setStretchFactor(spare, 20); m_tempoStatusLabel = new QLabel(scopeGroup); scopeBoxLayout->addWidget(m_tempoStatusLabel); scopeGroup->setLayout(scopeBoxLayout); QWidget * changeWhereBox = scopeGroup; QVBoxLayout * changeWhereBoxLayout = scopeBoxLayout; spare = new QLabel(" ", changeWhereBox); changeWhereBoxLayout->addWidget(spare); QWidget *changeWhereVBox = new QWidget(changeWhereBox); QVBoxLayout *changeWhereVBoxLayout = new QVBoxLayout; changeWhereBoxLayout->addWidget(changeWhereVBox); changeWhereBox->setLayout(changeWhereBoxLayout); changeWhereBoxLayout->setStretchFactor(changeWhereVBox, 20); m_tempoChangeHere = new QRadioButton(tr("Apply this tempo from here onwards"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeHere); m_tempoChangeBefore = new QRadioButton(tr("Replace the last tempo change"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeBefore); m_tempoChangeBeforeAt = new QLabel(changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeBeforeAt); m_tempoChangeBeforeAt->hide(); m_tempoChangeStartOfBar = new QRadioButton(tr("Apply this tempo from the start of this bar"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeStartOfBar); m_tempoChangeGlobal = new QRadioButton(tr("Apply this tempo to the whole composition"), changeWhereVBox); changeWhereVBoxLayout->addWidget(m_tempoChangeGlobal); QWidget *optionHBox = new QWidget(changeWhereVBox); changeWhereVBoxLayout->addWidget(optionHBox); changeWhereVBox->setLayout(changeWhereVBoxLayout); QHBoxLayout *optionHBoxLayout = new QHBoxLayout; QLabel *child_6 = new QLabel(" ", optionHBox); optionHBoxLayout->addWidget(child_6); m_defaultBox = new QCheckBox(tr("Also make this the default tempo"), optionHBox); optionHBoxLayout->addWidget(m_defaultBox); spare = new QLabel(optionHBox); optionHBoxLayout->addWidget(spare); optionHBox->setLayout(optionHBoxLayout); optionHBoxLayout->setStretchFactor(spare, 20); connect(m_tempoChangeHere, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeBefore, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeStartOfBar, SIGNAL(clicked()), SLOT(slotActionChanged())); connect(m_tempoChangeGlobal, SIGNAL(clicked()), SLOT(slotActionChanged())); m_tempoChangeBefore->setChecked(true); // disable initially m_defaultBox->setEnabled(false); } QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help); vboxLayout->addWidget(buttonBox); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(slotHelpRequested())); populateTempo(); }
SimpleClient::SimpleClient(QWidget * parent) : QMainWindow(parent), m_actions(this), m_script_editor(NULL), m_dlgSeqTool(NULL), m_seqTool(NULL) { corbasim::gui::initialize(); QWidget * central = new QWidget; QVBoxLayout * layout = new QVBoxLayout; // Menu m_menu = new QMenuBar; setMenuBar(m_menu); // Menu File QMenu * menuFile = m_menu->addMenu("&File"); QMenu * editMenu = m_menu->addMenu("&Edit"); // Menu Operations m_operations_menu = m_menu->addMenu("&Operations"); // Menu window QMenu * menuWindow = m_menu->addMenu("&Window"); m_mainSplitter = new QSplitter(Qt::Vertical); layout->addWidget(m_mainSplitter); // IOR QGroupBox * gb = new QGroupBox("Reference"); QAction * act = menuWindow->addAction("&Reference"); act->setCheckable(true); act->setChecked(true); connect(act, SIGNAL(toggled(bool)), gb, SLOT(setVisible(bool))); QHBoxLayout * gbLayout = new QHBoxLayout; m_ref = new ObjrefWidget; gbLayout->addWidget(m_ref); gb->setLayout(gbLayout); m_mainSplitter->addWidget(gb); // Operations gb = new QGroupBox("Operations"); act = menuWindow->addAction("&Operations"); act->setCheckable(true); act->setChecked(true); connect(act, SIGNAL(toggled(bool)), gb, SLOT(setVisible(bool))); QVBoxLayout * opsLayout = new QVBoxLayout; m_tab = new QTabWidget; opsLayout->addWidget(m_tab); gb->setLayout(opsLayout); m_mainSplitter->addWidget(gb); // Events gb = new QGroupBox("Events"); act = menuWindow->addAction("&Events"); act->setCheckable(true); act->setChecked(true); connect(act, SIGNAL(toggled(bool)), gb, SLOT(setVisible(bool))); gbLayout = new QHBoxLayout; m_tree = new TreeView(); m_tree->setModel(&m_log_model); gbLayout->addWidget(m_tree); gb->setLayout(gbLayout); m_mainSplitter->addWidget(gb); // Filtered log QDialog * filteredLogDlg = new QDialog(this); QVBoxLayout * filteredLayout = new QVBoxLayout(); m_filteredLog = new FilteredLogView(); m_filteredLog->setLogModel(&m_log_model); filteredLayout->setMargin(0); filteredLayout->addWidget(m_filteredLog); filteredLogDlg->setLayout(filteredLayout); filteredLogDlg->hide(); // Load QAction * loadAction = new QAction( style()->standardIcon(QStyle::SP_DialogOpenButton), "&Load configuration", this); loadAction->setShortcut(QKeySequence::Open); connect(loadAction, SIGNAL(triggered()), this, SLOT(doLoad())); // Save QAction * saveAction = new QAction( style()->standardIcon(QStyle::SP_DialogSaveButton), "&Save configuration", this); saveAction->setShortcut(QKeySequence::SaveAs); connect(saveAction, SIGNAL(triggered()), this, SLOT(doSave())); menuFile->addAction(loadAction); menuFile->addAction(saveAction); menuFile->addSeparator(); menuFile->addAction("&Script editor", this, SLOT(showScriptEditor())); menuFile->addAction("&Operation sequence", this, SLOT(showOperationSequenceTool())); menuFile->addAction("&Filtered log", filteredLogDlg, SLOT(show())); menuFile->addSeparator(); menuFile->addAction("&Close", this, SLOT(close())); // Actions QAction * pasteAction = new QAction("Paste &IOR from clipboard", this); pasteAction->setShortcut(QKeySequence::Paste); connect(pasteAction, SIGNAL(triggered()), this, SLOT(pasteIOR())); QAction * clearAction = new QAction("&Clear", this); clearAction->setShortcut(QKeySequence::Cut); connect(clearAction, SIGNAL(triggered()), this, SLOT(clearAll())); QAction * clearLogAction = new QAction("&Clear log", this); connect(clearLogAction, SIGNAL(triggered()), &m_log_model, SLOT(clearLog())); QAction * stopAction = new QAction("&Stop all timers", this); // stopAction->setShortcut(QKeySequence::Cut); connect(stopAction, SIGNAL(triggered()), this, SLOT(stopAllTimers())); editMenu->addAction(pasteAction); editMenu->addAction(clearAction); editMenu->addAction(clearLogAction); editMenu->addAction(stopAction); central->setLayout(layout); setCentralWidget(central); connect(&m_buttons, SIGNAL(buttonClicked(int)), this, SLOT(showDialog(int))); connect(&m_actions, SIGNAL(triggered(QAction *)), this, SLOT(showDialog(QAction *))); setWindowIcon(QIcon(":/resources/images/csu.png")); }
void PlotWidgetImp::initialize(PlotViewImp *pPlotView, const string& plotName, PlotType plotType) { // cleanup a previous initialization delete mpPlotWidget; // Parent widget for the plot widgets mpPlotWidget = new QWidget(this); // Top labels mpTopLeftLabel = new QLabel(mpPlotWidget); mpTopCenterLabel = new QLabel(mpPlotWidget); mpTopRightLabel = new QLabel(mpPlotWidget); mpTopCenterLabel->setAlignment(Qt::AlignHCenter); // Bottom labels mpBottomLeftLabel = new QLabel(mpPlotWidget); mpBottomCenterLabel = new QLabel(mpPlotWidget); mpBottomRightLabel = new QLabel(mpPlotWidget); mpBottomCenterLabel->setAlignment(Qt::AlignHCenter); // Title mpTitleLabel = new ElidedLabel(mpPlotWidget); mpTitleLabel->setMinimumWidth(100); mpTitleLabel->setAlignment(Qt::AlignHCenter); mpTitleLabel->hide(); // Plot widget QWidget* pPlotWidget = new QWidget(this); // Plot if (pPlotView == NULL) { mpPlot = dynamic_cast<PlotViewImp*>(Service<DesktopServices>()->createPlot(plotName, plotType, pPlotWidget)); } else { mpPlot = pPlotView; } mpPlot->installEventFilter(this); CartesianPlot* pCartesianPlot = dynamic_cast<CartesianPlot*>(mpPlot); if (pCartesianPlot != NULL) { // Mouse locator labels mpXMouseLabel = new FloatingLabel(Qt::Horizontal, pPlotWidget); mpYMouseLabel = new FloatingLabel(Qt::Vertical, pPlotWidget); // Axes mpXAxis = new AxisAdapter(AXIS_BOTTOM, pPlotWidget); mpYAxis = new AxisAdapter(AXIS_LEFT, pPlotWidget); QFont ftAxis; ftAxis.setBold(true); ftAxis.setPointSize(10); mpXAxis->setFont(ftAxis); mpYAxis->setFont(ftAxis); QString strXAxisText = QString::fromStdString(pCartesianPlot->getXDataType()); QString strYAxisText = QString::fromStdString(pCartesianPlot->getYDataType()); mpXAxis->setTitle(strXAxisText); mpYAxis->setTitle(strYAxisText); } // Legend mpLegend = new Legend(); mpLegend->setFrameStyle(QFrame::NoFrame); mpLegend->setMinimumWidth(120); // Splitter widget mpSplitter = new QSplitter(Qt::Horizontal, mpPlotWidget); mpSplitter->setOpaqueResize(true); mpSplitter->installEventFilter(this); mpSplitter->insertWidget(0, pPlotWidget); mpSplitter->insertWidget(1, mpLegend); mpSplitter->setStretchFactor(0, 10); // Layout QHBoxLayout* pTopLabelLayout = new QHBoxLayout(); pTopLabelLayout->setMargin(0); pTopLabelLayout->setSpacing(5); pTopLabelLayout->addWidget(mpTopLeftLabel, 0, Qt::AlignLeft); pTopLabelLayout->addWidget(mpTopCenterLabel, 0, Qt::AlignHCenter); pTopLabelLayout->addWidget(mpTopRightLabel, 0, Qt::AlignRight); QHBoxLayout* pBottomLabelLayout = new QHBoxLayout(); pBottomLabelLayout->setMargin(0); pBottomLabelLayout->setSpacing(5); pBottomLabelLayout->addWidget(mpBottomLeftLabel, 0, Qt::AlignLeft); pBottomLabelLayout->addWidget(mpBottomCenterLabel, 0, Qt::AlignHCenter); pBottomLabelLayout->addWidget(mpBottomRightLabel, 0, Qt::AlignRight); if (pCartesianPlot == NULL) { QVBoxLayout* pPlotLayout = new QVBoxLayout(pPlotWidget); pPlotLayout->setMargin(0); pPlotLayout->setSpacing(5); pPlotLayout->addWidget(mpPlot); } else { QGridLayout* pPlotGrid = new QGridLayout(pPlotWidget); pPlotGrid->setMargin(0); pPlotGrid->setSpacing(0); pPlotGrid->addWidget(mpXMouseLabel, 0, 1); pPlotGrid->setRowMinimumHeight(1, 5); pPlotGrid->addWidget(mpYAxis, 2, 0); pPlotGrid->addWidget(mpPlot, 2, 1); pPlotGrid->setColumnMinimumWidth(2, 5); pPlotGrid->addWidget(mpYMouseLabel, 2, 3); pPlotGrid->setColumnMinimumWidth(3, mpYMouseLabel->sizeHint().width()); pPlotGrid->addWidget(mpXAxis, 3, 1); pPlotGrid->setRowStretch(2, 10); pPlotGrid->setColumnStretch(1, 10); } QVBoxLayout* pPlotLayout = new QVBoxLayout(mpPlotWidget); pPlotLayout->setMargin(10); pPlotLayout->setSpacing(5); pPlotLayout->addLayout(pTopLabelLayout); pPlotLayout->addWidget(mpTitleLabel); pPlotLayout->addWidget(mpSplitter, 10); pPlotLayout->addLayout(pBottomLabelLayout); // Initialization setWindowFlags(Qt::Widget); setBackgroundColor(Qt::white); mpPlotWidget->setAutoFillBackground(true); setCentralWidget(mpPlotWidget); setContextMenuPolicy(Qt::DefaultContextMenu); setFocusPolicy(Qt::StrongFocus); setFocusProxy(mpPlot); addToolBar(mpAnnotationToolBar); addToolBar(mpMouseModeToolBar); AnnotationLayer* pAnnotationLayer = mpPlot->getAnnotationLayer(); if (pAnnotationLayer != NULL) { mpAnnotationToolBar->setAnnotationLayer(pAnnotationLayer); } const MouseMode* pCurrentMouseMode = mpPlot->getCurrentMouseMode(); enableAnnotationToolBar(pCurrentMouseMode); vector<const MouseMode*> mouseModes = mpPlot->getMouseModes(); for (vector<const MouseMode*>::const_iterator iter = mouseModes.begin(); iter != mouseModes.end(); ++iter) { const MouseMode* pMouseMode = *iter; if (pMouseMode != NULL) { QAction* pAction = pMouseMode->getAction(); if (pAction != NULL) { mpMouseModeToolBar->addAction(pAction); } } } mpToolbarsMenu->addAction(mpAnnotationToolBar->toggleViewAction()); mpToolbarsMenu->addAction(mpMouseModeToolBar->toggleViewAction()); updateClassificationText(); list<PlotObject*> plotObjects = mpPlot->getObjects(); for (list<PlotObject*>::iterator iter = plotObjects.begin(); iter != plotObjects.end(); ++iter) { PlotObject* pObject = *iter; if (pObject != NULL) { mpLegend->insertItem(pObject); } } showLegend(false); // Connections VERIFYNR(connect(mpPlot, SIGNAL(renamed(const QString&)), this, SLOT(updateName(const QString&)))); VERIFYNR(connect(mpPlot, SIGNAL(mouseModeChanged(const MouseMode*)), this, SLOT(enableAnnotationToolBar(const MouseMode*)))); VERIFYNR(connect(mpPlot, SIGNAL(classificationChanged(const Classification*)), this, SLOT(updateClassificationText()))); VERIFYNR(connect(mpPlot, SIGNAL(classificationFontChanged(const QFont&)), this, SLOT(setClassificationFont(const QFont&)))); VERIFYNR(connect(mpPlot, SIGNAL(classificationColorChanged(const QColor&)), this, SLOT(setClassificationColor(const QColor&)))); VERIFYNR(connect(mpPlot, SIGNAL(objectAdded(PlotObject*)), mpLegend, SLOT(insertItem(PlotObject*)))); VERIFYNR(connect(mpPlot, SIGNAL(objectDeleted(PlotObject*)), mpLegend, SLOT(removeItem(PlotObject*)))); VERIFYNR(connect(mpPlot, SIGNAL(objectSelected(PlotObject*, bool)), mpLegend, SLOT(setItemSelected(PlotObject*, bool)))); VERIFYNR(connect(mpLegend, SIGNAL(itemSelected(PlotObject*, bool)), this, SLOT(selectPlotObject(PlotObject*, bool)))); if (pCartesianPlot != NULL) { VERIFYNR(connect(mpPlot, SIGNAL(displayAreaChanged()), this, SLOT(updateScaleRange()))); VERIFYNR(connect(mpPlot, SIGNAL(xScaleTypeChanged(ScaleType)), mpXAxis, SLOT(setScaleType(ScaleType)))); VERIFYNR(connect(mpPlot, SIGNAL(yScaleTypeChanged(ScaleType)), mpYAxis, SLOT(setScaleType(ScaleType)))); VERIFYNR(connect(mpPlot, SIGNAL(xDataTypeChanged(const QString&)), mpXAxis, SLOT(setTitle(const QString&)))); VERIFYNR(connect(mpPlot, SIGNAL(yDataTypeChanged(const QString&)), mpYAxis, SLOT(setTitle(const QString&)))); GridlinesImp* pGridlines = dynamic_cast<GridlinesImp*>(pCartesianPlot->getGridlines(HORIZONTAL)); if (pGridlines != NULL) { VERIFYNR(connect(pGridlines, SIGNAL(maxNumMajorLinesChanged(int)), mpYAxis, SLOT(setMaxNumMajorTicks(int)))); VERIFYNR(connect(pGridlines, SIGNAL(maxNumMinorLinesChanged(int)), mpYAxis, SLOT(setMaxNumMinorTicks(int)))); VERIFYNR(connect(mpYAxis, SIGNAL(maxNumMajorTicksChanged(int)), pGridlines, SLOT(setMaxNumMajorLines(int)))); VERIFYNR(connect(mpYAxis, SIGNAL(maxNumMinorTicksChanged(int)), pGridlines, SLOT(setMaxNumMinorLines(int)))); } pGridlines = dynamic_cast<GridlinesImp*>(pCartesianPlot->getGridlines(VERTICAL)); if (pGridlines != NULL) { VERIFYNR(connect(pGridlines, SIGNAL(maxNumMajorLinesChanged(int)), mpXAxis, SLOT(setMaxNumMajorTicks(int)))); VERIFYNR(connect(pGridlines, SIGNAL(maxNumMinorLinesChanged(int)), mpXAxis, SLOT(setMaxNumMinorTicks(int)))); VERIFYNR(connect(mpXAxis, SIGNAL(maxNumMajorTicksChanged(int)), pGridlines, SLOT(setMaxNumMajorLines(int)))); VERIFYNR(connect(mpXAxis, SIGNAL(maxNumMinorTicksChanged(int)), pGridlines, SLOT(setMaxNumMinorLines(int)))); } } LocatorImp* pLocator = dynamic_cast<LocatorImp*>(mpPlot->getMouseLocator()); if (pLocator != NULL) { VERIFYNR(connect(pLocator, SIGNAL(textChanged(const QString&, const QString&)), this, SLOT(updateMouseLabel(const QString&, const QString&)))); }