void KoPAView::initGUI() { QGridLayout * gridLayout = new QGridLayout( this ); gridLayout->setMargin( 0 ); gridLayout->setSpacing( 0 ); setLayout( gridLayout ); d->canvas = new KoPACanvas( this, d->doc, this ); KoCanvasControllerWidget *canvasController = new KoCanvasControllerWidget( this ); d->canvasController = canvasController; d->canvasController->setCanvas( d->canvas ); KoToolManager::instance()->addController( d->canvasController ); KoToolManager::instance()->registerTools( actionCollection(), d->canvasController ); d->zoomController = new KoZoomController( d->canvasController, zoomHandler(), actionCollection()); connect( d->zoomController, SIGNAL( zoomChanged( KoZoomMode::Mode, qreal ) ), this, SLOT( slotZoomChanged( KoZoomMode::Mode, qreal ) ) ); d->zoomAction = d->zoomController->zoomAction(); // set up status bar message d->status = new QLabel( QString() ); d->status->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); d->status->setMinimumWidth( 300 ); addStatusBarItem( d->status, 1 ); connect( KoToolManager::instance(), SIGNAL( changedStatusText( const QString & ) ), d->status, SLOT( setText( const QString & ) ) ); d->zoomActionWidget = d->zoomAction->createWidget( statusBar() ); addStatusBarItem( d->zoomActionWidget, 0 ); d->zoomController->setZoomMode( KoZoomMode::ZOOM_PAGE ); d->viewModeNormal = new KoPAViewModeNormal( this, d->canvas ); setViewMode(d->viewModeNormal); // The rulers d->horizontalRuler = new KoRuler(this, Qt::Horizontal, viewConverter( d->canvas )); d->horizontalRuler->setShowMousePosition(true); d->horizontalRuler->setUnit(d->doc->unit()); d->verticalRuler = new KoRuler(this, Qt::Vertical, viewConverter( d->canvas )); d->verticalRuler->setUnit(d->doc->unit()); d->verticalRuler->setShowMousePosition(true); new KoRulerController(d->horizontalRuler, d->canvas->resourceManager()); connect(d->doc, SIGNAL(unitChanged(const KoUnit&)), d->horizontalRuler, SLOT(setUnit(const KoUnit&))); connect(d->doc, SIGNAL(unitChanged(const KoUnit&)), d->verticalRuler, SLOT(setUnit(const KoUnit&))); gridLayout->addWidget(d->horizontalRuler, 0, 1); gridLayout->addWidget(d->verticalRuler, 1, 0); gridLayout->addWidget(canvasController, 1, 1 ); connect(d->canvasController->proxyObject, SIGNAL(canvasOffsetXChanged(int)), this, SLOT(pageOffsetChanged())); connect(d->canvasController->proxyObject, SIGNAL(canvasOffsetYChanged(int)), this, SLOT(pageOffsetChanged())); connect(d->canvasController->proxyObject, SIGNAL(sizeChanged(const QSize&)), this, SLOT(pageOffsetChanged())); connect(d->canvasController->proxyObject, SIGNAL(canvasMousePositionChanged(const QPoint&)), this, SLOT(updateMousePosition(const QPoint&))); d->verticalRuler->createGuideToolConnection(d->canvas); d->horizontalRuler->createGuideToolConnection(d->canvas); KoToolBoxFactory toolBoxFactory(d->canvasController, i18n("Tools") ); if (shell()) { shell()->createDockWidget( &toolBoxFactory ); connect( canvasController, SIGNAL( toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, QWidget*) ), shell()->dockerManager(), SLOT( newOptionWidgets(const QMap<QString, QWidget *> &, QWidget*) ) ); } connect(shapeManager(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(d->canvas, SIGNAL(documentSize(const QSize&)), d->canvasController->proxyObject, SLOT(updateDocumentSize(const QSize&))); connect(d->canvasController->proxyObject, SIGNAL(moveDocumentOffset(const QPoint&)), d->canvas, SLOT(slotSetDocumentOffset(const QPoint&))); if (shell()) { KoPADocumentStructureDockerFactory structureDockerFactory( KoDocumentSectionView::ThumbnailMode, d->doc->pageType() ); d->documentStructureDocker = qobject_cast<KoPADocumentStructureDocker*>( shell()->createDockWidget( &structureDockerFactory ) ); connect( shell()->partManager(), SIGNAL( activePartChanged( KParts::Part * ) ), d->documentStructureDocker, SLOT( setPart( KParts::Part * ) ) ); connect(d->documentStructureDocker, SIGNAL(pageChanged(KoPAPageBase*)), proxyObject, SLOT(updateActivePage(KoPAPageBase*))); connect(d->documentStructureDocker, SIGNAL(dockerReset()), this, SLOT(reinitDocumentDocker())); KoToolManager::instance()->requestToolActivation( d->canvasController ); } }
cproject_matrix_widget::cproject_matrix_widget(QString projectPath) { this->projectPath = projectPath; this->open_prof_prefs_btn = new QPushButton( QIcon( ":/resources/img/event_edit_matrix_op.png" ), tr( "Open Matrix Parser" ) ); this->open_prof_prefs_btn->setMinimumHeight( 40 ); this->open_prof_prefs_btn->setIconSize( QSize( 32,32 ) ); this->grpbx_available_templates = new QGroupBox( tr( "Available Topics" ) ); this->grpbx_available_templates->setAutoFillBackground( false ); this->grpbx_available_templates->setEnabled( false ); this->available_templates_listWidget = new QListWidget(); QDir d( projectPath + "/sys/" ); this->available_templates_listWidget->addItems( d.entryList( QStringList() << "*.xml", QDir::Files, QDir::Name ) ); this->description = new QLabel( tr( "Click that button to open your project's preferences where you can setup the actors, who your game will contain, monsters that will appear, and other important stuff.If you're an advanced user, I'll be glad to hear to you can control the variation of variables of each topic.You can add the entry 'Age'' to the 'actors' topic by editing the /sys/templates/actor.xml in your project's folder." ) ); this->description->setWordWrap( true ); this->description->setAlignment( Qt::AlignHCenter ); this->description->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); //this logo is only for get an easier paintEvent this->desc_logo = new QLabel(); // desc_logo->setPixmap( QPixmap( ":/resources/img/html_preferences_example.png" ) ); // desc_logo->setAlignment( Qt::AlignCenter ); this->desc_logo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); //this->pro_desc_label = new QLabel( tr( "Your project's description:" ) ); //this->pro_desc_label->setAlignment( Qt::AlignCenter ); //this->pro_desc_label->setWordWrap( true ); //this->project_description_save_btn = new QPushButton( QIcon( ":/resources/img/save.png" ), // tr( "Save" ) ); //QObject::connect( this->project_description_save_btn, SIGNAL(clicked()), // this, SLOT(saveDescription()) ); //this->project_description_textEdit = new QTextEdit(); // this->project_description_textEdit->setAttribute( Qt::WA_NoBackground, true ); //this->project_description_textEdit->setAutoFillBackground( false ); // this->project_description_textEdit->setMask( this->project_description_textEdit->rect() ); //this->project_description_textEdit->setWindowOpacity( (qreal) 50/100 ); //this->loadDescription(); QVBoxLayout* vb = new QVBoxLayout(); vb->addWidget( this->available_templates_listWidget ); this->grpbx_available_templates->setLayout( vb ); QVBoxLayout* vb_btn_and_box = new QVBoxLayout(); vb_btn_and_box->addWidget( this->open_prof_prefs_btn ); vb_btn_and_box->addWidget( this->grpbx_available_templates ); QWidget* w = new QWidget(); w->setLayout( vb_btn_and_box ); w->setFixedWidth( 230 ); QVBoxLayout* spa = new QVBoxLayout(); spa->addStretch(); QGridLayout* gl = new QGridLayout(); gl->setContentsMargins( 40,40,40,40 ); gl->addWidget( w, 0,0,4,1 ); gl->addWidget( this->description, 0,1,1,2 ); gl->addLayout( spa, 1,1,1,1 ); // gl->addWidget( this->pro_desc_label, 2,1,1,1 ); // gl->addWidget( this->project_description_save_btn, 2,2,1,1 ); //gl->addWidget( this->project_description_textEdit, 3,1,1,2 ); this->setLayout( gl ); QObject::connect( this->open_prof_prefs_btn, SIGNAL(clicked()), this, SIGNAL(please_workspace_open_an_project_preferences_widget()) ); }
/** The constructor for a single set of widgets containing parameters for the labeling and format of an axis. * @param app :: the containing application window * @param graph :: the graph the dialog is settign the options for * @param mappedaxis :: the QwtPlot::axis value that corresponds to this axis * @param parent :: the QWidget that acts as this widget's parent in the hierachy */ AxisDetails::AxisDetails(ApplicationWindow* app, Graph* graph, int mappedaxis, QWidget *parent) : QWidget(parent) { m_app = app; m_graph = graph; m_tablesList = m_app->tableNames(); m_mappedaxis = mappedaxis; m_initialised = false; QHBoxLayout * topLayout = new QHBoxLayout(); m_chkShowAxis = new QCheckBox(tr("Show")); topLayout->addWidget(m_chkShowAxis); m_grpTitle = new QGroupBox(tr("Title")); topLayout->addWidget(m_grpTitle); QVBoxLayout *titleBoxLayout = new QVBoxLayout(m_grpTitle); titleBoxLayout->setSpacing(2); m_txtTitle = new QTextEdit(); m_txtTitle->setTextFormat(Qt::PlainText); QFontMetrics metrics(this->font()); m_txtTitle->setMaximumHeight(3 * metrics.height()); titleBoxLayout->addWidget(m_txtTitle); QHBoxLayout *hl = new QHBoxLayout(); hl->setMargin(0); hl->setSpacing(2); m_btnLabelFont = new QPushButton(tr("&Font")); hl->addWidget(m_btnLabelFont); m_formatButtons = new TextFormatButtons(m_txtTitle, TextFormatButtons::AxisLabel); hl->addWidget(m_formatButtons); hl->addStretch(); m_txtTitle->setMaximumWidth(m_btnLabelFont->width() + m_formatButtons->width()); titleBoxLayout->addLayout(hl); QHBoxLayout * bottomLayout = new QHBoxLayout(); m_grpAxisDisplay = new QGroupBox(QString()); bottomLayout->addWidget(m_grpAxisDisplay); QGridLayout * leftBoxLayout = new QGridLayout(m_grpAxisDisplay); leftBoxLayout->addWidget(new QLabel(tr("Type")), 0, 0); m_cmbAxisType = new QComboBox(); m_cmbAxisType->addItem(tr("Numeric")); m_cmbAxisType->addItem(tr("Text from table")); m_cmbAxisType->addItem(tr("Day of the week")); m_cmbAxisType->addItem(tr("Month")); m_cmbAxisType->addItem(tr("Time")); m_cmbAxisType->addItem(tr("Date")); m_cmbAxisType->addItem(tr("Column Headings")); leftBoxLayout->addWidget(m_cmbAxisType, 0, 1); leftBoxLayout->addWidget(new QLabel(tr("Font")), 1, 0); m_btnAxesFont = new QPushButton(); m_btnAxesFont->setText(tr("Axis &Font")); leftBoxLayout->addWidget(m_btnAxesFont, 1, 1); leftBoxLayout->addWidget(new QLabel(tr("Color")), 2, 0); m_cbtnAxisColor = new ColorButton(); leftBoxLayout->addWidget(m_cbtnAxisColor, 2, 1); leftBoxLayout->addWidget(new QLabel(tr("Major Ticks")), 3, 0); m_cmbMajorTicksType = new QComboBox(); m_cmbMajorTicksType->addItem(tr("None")); m_cmbMajorTicksType->addItem(tr("Out")); m_cmbMajorTicksType->addItem(tr("In & Out")); m_cmbMajorTicksType->addItem(tr("In")); leftBoxLayout->addWidget(m_cmbMajorTicksType, 3, 1); leftBoxLayout->addWidget(new QLabel(tr("Minor Ticks")), 4, 0); m_cmbMinorTicksType = new QComboBox(); m_cmbMinorTicksType->addItem(tr("None")); m_cmbMinorTicksType->addItem(tr("Out")); m_cmbMinorTicksType->addItem(tr("In & Out")); m_cmbMinorTicksType->addItem(tr("In")); leftBoxLayout->addWidget(m_cmbMinorTicksType, 4, 1); leftBoxLayout->addWidget(new QLabel(tr("Stand-off")), 5, 0); m_spnBaseline = new QSpinBox(); m_spnBaseline->setRange(0, 1000); leftBoxLayout->addWidget(m_spnBaseline); m_grpShowLabels = new QGroupBox(tr("Show Labels")); m_grpShowLabels->setCheckable(true); m_grpShowLabels->setChecked(true); bottomLayout->addWidget(m_grpShowLabels); QGridLayout *rightBoxLayout = new QGridLayout(m_grpShowLabels); m_lblColumn = new QLabel(tr("Column")); rightBoxLayout->addWidget(m_lblColumn, 0, 0); m_cmbColName = new QComboBox(); rightBoxLayout->addWidget(m_cmbColName, 0, 1); m_lblTable = new QLabel(tr("Table")); rightBoxLayout->addWidget(m_lblTable, 1, 0); m_cmbTableName = new QComboBox(); m_cmbTableName->insertStringList(m_tablesList); m_cmbColName->insertStringList(m_app->columnsList(Table::All)); rightBoxLayout->addWidget(m_cmbTableName, 1, 1); m_lblFormat = new QLabel(tr("Format")); rightBoxLayout->addWidget(m_lblFormat, 2, 0); m_cmbFormat = new QComboBox(); m_cmbFormat->setDuplicatesEnabled(false); rightBoxLayout->addWidget(m_cmbFormat, 2, 1); m_lblPrecision = new QLabel(tr("Precision")); rightBoxLayout->addWidget(m_lblPrecision, 3, 0); m_spnPrecision = new QSpinBox(); m_spnPrecision->setRange(0, 10); rightBoxLayout->addWidget(m_spnPrecision, 3, 1); rightBoxLayout->addWidget(new QLabel(tr("Angle")), 4, 0); m_spnAngle = new QSpinBox(); m_spnAngle->setRange(-90, 90); m_spnAngle->setSingleStep(5); rightBoxLayout->addWidget(m_spnAngle, 4, 1); rightBoxLayout->addWidget(new QLabel(tr("Color")), 5, 0); m_cbtnAxisNumColor = new ColorButton(); rightBoxLayout->addWidget(m_cbtnAxisNumColor, 5, 1); m_chkShowFormula = new QCheckBox(tr("For&mula")); rightBoxLayout->addWidget(m_chkShowFormula, 6, 0); m_txtFormula = new QTextEdit(); m_txtFormula->setTextFormat(Qt::PlainText); m_txtFormula->setMaximumHeight(3 * metrics.height()); //m_txtFormula->hide(); rightBoxLayout->addWidget(m_txtFormula, 6, 1); rightBoxLayout->setRowStretch(7, 1); QVBoxLayout * rightLayout = new QVBoxLayout(this); rightLayout->addLayout(topLayout); rightLayout->addLayout(bottomLayout); rightLayout->addStretch(1); connect(m_chkShowFormula, SIGNAL(clicked()), this, SLOT(enableFormulaBox())); connect(m_cmbAxisType, SIGNAL(activated(int)), this, SLOT(setAxisFormatOptions(int))); connect(m_grpShowLabels, SIGNAL(clicked(bool)), this, SLOT(showAxis())); connect(m_chkShowAxis, SIGNAL(clicked()), this, SLOT(showAxis())); connect(m_cmbFormat, SIGNAL(activated(int)), this, SLOT(showAxis())); connect(m_btnAxesFont, SIGNAL(clicked()), this, SLOT(setScaleFont())); connect(m_btnLabelFont, SIGNAL(clicked()), this, SLOT(setLabelFont())); initWidgets(); }
/* QVaultImageNode */ QVaultImageNode::QVaultImageNode(QWidget* parent) : QVaultNodeEdit(parent) { static QString s_ImgTypes[] = { "(Invalid)", "JPEG", }; fImgTitle = new QLineEdit(this); fImgType = new QComboBox(this); for (int i=0; i<=1; i++) fImgType->addItem(s_ImgTypes[i]); QWidget* imgPanel = new QWidget(this); fImage = new QStaticImage(imgPanel); QPushButton* btnSave = new QPushButton(tr("&Save..."), imgPanel); QPushButton* btnLoad = new QPushButton(tr("&Load..."), imgPanel); QGridLayout* imgLayout = new QGridLayout(imgPanel); imgLayout->setContentsMargins(0, 0, 0, 0); imgLayout->setHorizontalSpacing(8); imgLayout->setVerticalSpacing(8); imgLayout->addWidget(fImage, 0, 0, 1, 3); imgLayout->addWidget(btnSave, 1, 0); imgLayout->addWidget(btnLoad, 1, 1); imgLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum), 1, 2); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->setHorizontalSpacing(8); layout->setVerticalSpacing(8); layout->addWidget(new QLabel(tr("Title:"), this), 0, 0); layout->addWidget(fImgTitle, 0, 1); layout->addWidget(new QLabel(tr("Type:"), this), 1, 0); layout->addWidget(fImgType, 1, 1); layout->addWidget(imgPanel, 2, 0, 1, 2); connect(btnSave, SIGNAL(clicked()), this, SLOT(IExportImage())); connect(btnLoad, SIGNAL(clicked()), this, SLOT(IImportImage())); }
void QvisZoneDumpWindow::CreateWindowContents() { QGridLayout *mainLayout = new QGridLayout(); topLayout->addLayout(mainLayout); variableLabel = new QLabel(tr("Dump Variable"), central); mainLayout->addWidget(variableLabel,0,0); int variableMask = QvisVariableButton::Scalars; variable = new QvisVariableButton(true, true, true, variableMask, central); connect(variable, SIGNAL(activated(const QString&)), this, SLOT(variableChanged(const QString&))); mainLayout->addWidget(variable, 0,1); QLabel *range_label = new QLabel(tr("Dump Zones in Range:"), central); mainLayout->addWidget(range_label, 1,0,1,2); lowerBoundLabel = new QLabel(tr("Lower Bound"), central); mainLayout->addWidget(lowerBoundLabel,2,0); lowerBound = new QLineEdit(central); connect(lowerBound, SIGNAL(returnPressed()), this, SLOT(lowerBoundProcessText())); mainLayout->addWidget(lowerBound, 2,1); upperBoundLabel = new QLabel(tr("Upper Bound"), central); mainLayout->addWidget(upperBoundLabel,3,0); upperBound = new QLineEdit(central); connect(upperBound, SIGNAL(returnPressed()), this, SLOT(upperBoundProcessText())); mainLayout->addWidget(upperBound, 3,1); outputFileLabel = new QLabel(tr("Output File"), central); mainLayout->addWidget(outputFileLabel,4,0); outputFile = new QLineEdit(central); connect(outputFile, SIGNAL(returnPressed()), this, SLOT(outputFileProcessText())); mainLayout->addWidget(outputFile, 4,1); enabledLabel = NULL; enabled = new QCheckBox(tr("Dump Enabled"), central); connect(enabled, SIGNAL(toggled(bool)), this, SLOT(enabledChanged(bool))); mainLayout->addWidget(enabled, 5,0); }
void ExamineResultDialog::createCurrentExamineBox() { this->current_examine_box = new QGroupBox(tr("current examine data:"), this); QLabel *gatekeeper_hint_label = new QLabel(tr("gatekeeper:")); QLabel *gatekeeper_label = new QLabel(Sanguosha->translate(this->examine_state->gatekeeper)); QLabel *gatekeeper_level_hint_label = new QLabel(tr("level:")); QLabel *gatekeeper_level_label = new QLabel(Sanguosha->translate(this->examine_state->level)); QHBoxLayout *pGatekeeperLayout = new QHBoxLayout; pGatekeeperLayout->addWidget(gatekeeper_hint_label); pGatekeeperLayout->addWidget(gatekeeper_label); pGatekeeperLayout->addStretch(); pGatekeeperLayout->addWidget(gatekeeper_level_hint_label); pGatekeeperLayout->addWidget(gatekeeper_level_label); pGatekeeperLayout->addStretch(); QLabel *total_hint_label = new QLabel(tr("total:")); QLabel *total_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->total_finished).arg(this->examine_state->total)); QLabel *warm_hint_label = new QLabel(tr("offensive start:")); QLabel *warm_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->warm_finished).arg(this->examine_state->warm)); QLabel *cold_hint_label = new QLabel(tr("defensive start:")); QLabel *cold_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->cold_finished).arg(this->examine_state->cold)); QLabel *win_hint_label = new QLabel(tr("win times:")); QLabel *win_label = new QLabel(QString::number(this->examine_state->win)); QLabel *draw_hint_label = new QLabel(tr("draw times:")); QLabel *draw_label = new QLabel(QString::number(this->examine_state->draw)); QLabel *lose_hint_label = new QLabel(tr("lose times:")); QLabel *lose_label = new QLabel(QString::number(this->examine_state->lose)); QGridLayout *pDataLayout = new QGridLayout; pDataLayout->addWidget(total_hint_label, 0, 0); pDataLayout->addWidget(total_label, 0, 1); pDataLayout->addWidget(warm_hint_label, 1, 0); pDataLayout->addWidget(warm_label, 1, 1); pDataLayout->addWidget(cold_hint_label, 2, 0); pDataLayout->addWidget(cold_label, 2, 1); pDataLayout->addWidget(win_hint_label, 3, 0); pDataLayout->addWidget(win_label, 3, 1); pDataLayout->addWidget(draw_hint_label, 4, 0); pDataLayout->addWidget(draw_label, 4, 1); pDataLayout->addWidget(lose_hint_label, 5, 0); pDataLayout->addWidget(lose_label, 5, 1); QHBoxLayout *pDataXLayout = new QHBoxLayout; pDataXLayout->addLayout(pDataLayout); pDataXLayout->addStretch(); QVBoxLayout *pMainLayout = new QVBoxLayout; pMainLayout->addLayout(pGatekeeperLayout); pMainLayout->addLayout(pDataXLayout); this->current_examine_box->setLayout(pMainLayout); }
void PMeshViewer::createWidgets() { // Create vtk objects vtkWidget = new QVTKWidget(this); // QVTKWidget has already created a render window and interactor renderWindow = vtkWidget->GetRenderWindow(); renderer = vtkRenderer::New(); renderer->SetBackground(0.0, 0.0, 0.0); renderWindow->AddRenderer(renderer); interactor = renderWindow->GetInteractor(); style = vtkInteractorStyleTrackballCamera::New(); interactor->SetInteractorStyle(style); PMeshViewerCallback *callback = PMeshViewerCallback::New(); callback->viewer = this; interactor->AddObserver(vtkCommand::RightButtonPressEvent, callback); callback->Delete(); // Central widget QGridLayout *grid = new QGridLayout; grid->addWidget(vtkWidget, 0, 0); QWidget *main = new QWidget; main->setLayout(grid); setCentralWidget(main); // Overall setWindowTitle(appName); setWindowIcon(QIcon(":/images/panax-icon.png")); // Create mesh mode box meshModeBox = new QComboBox(this); QStringList choices; choices << "smooth surface" << "flat surface" << "flat + lines" << "wire frame"; meshModeBox->insertItems(0, choices); connect(meshModeBox, SIGNAL(activated(int)), this, SLOT(setMeshMode(int))); // Create mesh table meshTable = new QTableWidget(NumRow, NumColumn); QPalette palette = meshTable->palette(); palette.setColor(QPalette::Base, QColor(248, 248, 248)); meshTable->setPalette(palette); meshTable->verticalHeader()->hide(); meshTable->setShowGrid(false); meshTable->setSelectionMode(QTableWidget::SingleSelection); QStringList labels; labels << "" << "Colour" << "Name" << "Annotation"; meshTable->setHorizontalHeaderLabels(labels); QTableWidgetItem *headerItem = new QTableWidgetItem(QString("Source")); headerItem->setTextAlignment(Qt::AlignLeft); meshTable->setHorizontalHeaderItem(4, headerItem); QList<QHeaderView::ResizeMode> modes; modes << QHeaderView::Fixed << QHeaderView::Fixed << QHeaderView::Interactive << QHeaderView::Interactive << QHeaderView::Interactive; QHeaderView *header = meshTable->horizontalHeader(); for (int i = 0; i < NumColumn; ++i) header->setResizeMode(i, modes[i]); QList<int> widths; widths << 30 << 50 << 100 << 100 << 200; int tableWidth = 0; for (int i = 0; i < NumColumn; ++i) { meshTable->setColumnWidth(i, widths[i]); tableWidth += widths[i]; } meshTable->resize(tableWidth + 50, 200); connect(meshTable, SIGNAL(cellClicked(int, int)), this, SLOT(setVisibility(int, int))); connect(meshTable, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(setColor(int, int))); connect(meshTable, SIGNAL(cellClicked(int, int)), this, SLOT(blink(int, int))); meshTable->installEventFilter(this); // Create dock widget for right dock area. rightDockWidget = new QDockWidget("Mesh List"); rightDockWidget->setWidget(meshTable); rightDockWidget->setAllowedAreas(Qt::RightDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, rightDockWidget); }
void ItemTransfer::slotSearch() { QDialog* dialog = new QDialog(this, "Search", true); dialog->setCaption(tr("Item Search")); QLabel* numberLabel = new QLabel(tr("Item Number:"), dialog); LineEdit* numberWidget = new LineEdit(dialog); QLabel* descLabel = new QLabel(tr("Description:"), dialog); LineEdit* descWidget = new LineEdit(dialog); QCheckBox* startOver = new QCheckBox(tr("Start search at top?"), dialog); QFrame* buttons = new QFrame(dialog); QPushButton* next = new QPushButton(tr("&Next"), buttons); QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons); next->setDefault(true); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setMargin(6); buttonGrid->setSpacing(10); buttonGrid->addWidget(next, 0, 1); buttonGrid->addWidget(cancel, 0, 2); QGridLayout* grid = new QGridLayout(dialog); grid->setMargin(6); grid->setSpacing(10); grid->addWidget(numberLabel, 0, 0); grid->addWidget(numberWidget, 0, 1, AlignLeft | AlignVCenter); grid->addWidget(descLabel, 1, 0); grid->addWidget(descWidget, 1, 1, AlignLeft | AlignVCenter); grid->addMultiCellWidget(startOver, 2, 2, 0, 1, AlignLeft | AlignVCenter); grid->addMultiCellWidget(buttons, 3, 3, 0, 1); connect(next, SIGNAL(clicked()), dialog, SLOT(accept())); connect(cancel, SIGNAL(clicked()), dialog, SLOT(reject())); _items->setFocus(); startOver->setChecked(true); while (true) { if (dialog->exec() != QDialog::Accepted) break; QString number = numberWidget->text(); QString desc = descWidget->text(); if (number.isEmpty() && desc.isEmpty()) { QString message = tr("No search criteria given"); QMessageBox::critical(this, tr("Error"), message); continue; } int startRow = -1; if (!startOver->isChecked()) startRow = _items->currentRow(); int foundRow = -1; for (int row = startRow + 1; row < _items->rows(); ++row) { QString rowNumber = _items->cellValue(row, 0).toPlu().number(); QString rowDesc = _items->cellValue(row, 1).toString(); if (!number.isEmpty() && rowNumber.contains(number, false)) { foundRow = row; break; } if (!desc.isEmpty() && rowDesc.contains(desc, false)) { foundRow = row; break; } } if (foundRow == -1 && startOver->isChecked()) { QString message = tr("No matches found"); QMessageBox::critical(this, tr("Error"), message); } else if (foundRow == -1 && !startOver->isChecked()) { QString message = tr("No further matches found"); int choice = QMessageBox::critical(this, tr("Error"), message, tr("Start Over"), tr("Cancel")); if (choice != 0) break; _items->setCurrentCell(0, 0); startOver->setChecked(true); } else { _items->setCurrentCell(foundRow, 0); startOver->setChecked(false); } } delete dialog; }
ItemTransfer::ItemTransfer(MainWindow* main, Id transfer_id) : DataWindow(main, "ItemTransfer", transfer_id) { _helpSource = "item_transfer.html"; // Search button QPushButton* search = new QPushButton(tr("Search"), _buttons); connect(search, SIGNAL(clicked()), SLOT(slotSearch())); // Get the company for deposit info _quasar->db()->lookup(_company); // Create widgets _gltxFrame = new GltxFrame(main, tr("Adjustment No."), _frame); _gltxFrame->setTitle(tr("From")); connect(_gltxFrame->store, SIGNAL(validData()), SLOT(slotStoreChanged())); _items = new Table(_frame); _items->setVScrollBarMode(QScrollView::AlwaysOn); _items->setLeftMargin(fontMetrics().width("99999")); _items->setDisplayRows(6); connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int))); connect(_items, SIGNAL(cellChanged(int,int,Variant)), SLOT(cellChanged(int,int,Variant))); connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(focusNext(bool&,int&,int&,int))); connect(_items, SIGNAL(rowInserted(int)), SLOT(rowInserted(int))); connect(_items, SIGNAL(rowDeleted(int)), SLOT(rowDeleted(int))); // Lookups _lookup = new ItemLookup(_main, this); _lookup->inventoriedOnly = true; // Add columns new LookupColumn(_items, tr("Item Number"), 18, _lookup); new TextColumn(_items, tr("Description"), 20); new TextColumn(_items, tr("Size"), 10); new NumberColumn(_items, tr("On Hand"), 6); new NumberColumn(_items, tr("Quantity"), 6); new MoneyColumn(_items, tr("Amount")); if (_company.depositAccount() != INVALID_ID) new MoneyColumn(_items, tr("Deposit"), 4); // Add editors _size = new QComboBox(_items); new LookupEditor(_items, 0, new ItemEdit(_lookup, _items)); new ComboEditor(_items, 2, _size); new NumberEditor(_items, 4, new DoubleEdit(_items)); new NumberEditor(_items, 5, new MoneyEdit(_items)); if (_company.depositAccount() != INVALID_ID) new NumberEditor(_items, 6, new MoneyEdit(_items)); QGroupBox* to = new QGroupBox(tr("To"), _frame); QLabel* toNumberLabel = new QLabel(tr("Adjustment No."), to); _toNumber = new LineEdit(9, to); toNumberLabel->setBuddy(_toNumber); QLabel* toShiftLabel = new QLabel(tr("Shift:"), to); _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT), to); _toShift->setLength(10); _toShift->setFocusPolicy(ClickFocus); toShiftLabel->setBuddy(_toShift); QLabel* toStoreLabel = new QLabel(tr("Store:"), to); _toStore = new LookupEdit(new StoreLookup(_main, this), to); _toStore->setLength(30); toStoreLabel->setBuddy(_toStore); QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2); toGrid->setSpacing(3); toGrid->setMargin(6); toGrid->setColStretch(2, 1); toGrid->addColSpacing(2, 10); toGrid->setColStretch(5, 1); toGrid->addColSpacing(5, 10); toGrid->addRowSpacing(0, to->fontMetrics().height()); toGrid->addWidget(toNumberLabel, 1, 0); toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter); toGrid->addWidget(toShiftLabel, 1, 3); toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter); toGrid->addWidget(toStoreLabel, 1, 6); toGrid->addWidget(_toStore, 1, 7, AlignLeft | AlignVCenter); QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame); AccountLookup* lookup = new AccountLookup(main, this, Account::OtherCurLiability); _account = new LookupEdit(lookup, _frame); _account->setLength(30); accountLabel->setBuddy(_account); QLabel* totalLabel = new QLabel(tr("Transfer Amount:"), _frame); _total = new MoneyEdit(_frame); _total->setLength(14); _total->setFocusPolicy(NoFocus); totalLabel->setBuddy(_total); _inactive->setText(tr("Voided?")); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setColStretch(2, 1); grid->setRowStretch(1, 1); grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4); grid->addMultiCellWidget(_items, 1, 1, 0, 4); grid->addMultiCellWidget(to, 2, 2, 0, 4); grid->addWidget(accountLabel, 3, 0); grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter); grid->addWidget(totalLabel, 3, 3); grid->addWidget(_total, 3, 4, AlignLeft | AlignVCenter); setCaption(tr("Item Transfer")); finalize(); }
void LazyWord::ConfigureUI() { ConfigureBox = new QGroupBox(tr("Configure")); LibSelectLabel = new QLabel(tr("LibSelect:")); //WordLibBox = new QComboBox; WordLibBox = WordLib(); StimeLabel = new QLabel(tr("Showtime:")); ItimeLabel = new QLabel(tr("Invertaltime:")); StimeBox = new QSpinBox; StimeBox->setRange(5, 60); StimeBox->setSuffix(" s"); StimeBox->setValue(Shtime); ItimeBox = new QSpinBox; ItimeBox->setRange(5, 180); ItimeBox->setSuffix(" s"); ItimeBox->setValue(Invertime); DselectLabel = new QLabel(tr("Degree Select:")); show_StrangeBox = new QCheckBox(tr("Strange")); show_UnderstandBox = new QCheckBox(tr("Understand")); show_MasterBox = new QCheckBox(tr("Master")); show_AllBox = new QCheckBox(tr("All")); ShowTestButton = new QPushButton(tr("Test")); AboutButton = new QPushButton(tr("About")); InsertLibButton = new QPushButton(tr("Insert Lib")); OkButton = new QPushButton(tr("Start Lazy")); UpdateLibButton = new QPushButton(tr("Update Lib")); GetAllExplainButton = new QPushButton(tr("Get All Explain")); ChangeColorButton = new QPushButton(tr("Change Color")); //ShowTestButton->setDefault(true); QGridLayout *messageLayout = new QGridLayout; messageLayout->addWidget(LibSelectLabel, 0, 0); messageLayout->addWidget(WordLibBox, 0, 1, 1, 2); messageLayout->addWidget(StimeLabel, 1, 0); messageLayout->addWidget(StimeBox, 1, 1); messageLayout->addWidget(ItimeLabel, 1, 3); messageLayout->addWidget(ItimeBox, 1, 4); messageLayout->addWidget(DselectLabel, 2, 0); messageLayout->addWidget(show_StrangeBox, 3, 1,1,1); messageLayout->addWidget(show_UnderstandBox, 3, 2,1,1); messageLayout->addWidget(show_MasterBox, 3, 3,1,1); messageLayout->addWidget(show_AllBox, 3, 4,1,1); messageLayout->addWidget(UpdateLibButton, 4, 1); messageLayout->addWidget(InsertLibButton, 4, 2); messageLayout->addWidget(OkButton, 4, 3); messageLayout->addWidget(ShowTestButton, 4, 4); messageLayout->addWidget(GetAllExplainButton,5,2); messageLayout->addWidget(AboutButton,5,0); messageLayout->addWidget(ChangeColorButton,5,1); messageLayout->setRowStretch(4, 1); ConfigureBox->setLayout(messageLayout); }
SoxFilterWidget::SoxFilterWidget() : FilterWidget() { int gridRow = 0; QGridLayout *grid = new QGridLayout( this ); grid->setMargin( 0 ); // set up filter options selection QHBoxLayout *box1 = new QHBoxLayout(); grid->addLayout( box1, gridRow++, 0 ); chSampleRate = new QCheckBox( i18n("Sample rate")+":", this ); connect( chSampleRate, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chSampleRate ); cSampleRate = new KComboBox( this ); cSampleRate->addItem( "8000 Hz" ); cSampleRate->addItem( "11025 Hz" ); cSampleRate->addItem( "12000 Hz" ); cSampleRate->addItem( "16000 Hz" ); cSampleRate->addItem( "22050 Hz" ); cSampleRate->addItem( "24000 Hz" ); cSampleRate->addItem( "32000 Hz" ); cSampleRate->addItem( "44100 Hz" ); cSampleRate->addItem( "48000 Hz" ); cSampleRate->setCurrentIndex( 7 ); cSampleRate->setEditable( true ); cSampleRate->setEnabled( false ); connect( cSampleRate, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); box1->addWidget( cSampleRate ); connect( chSampleRate, SIGNAL(toggled(bool)), cSampleRate, SLOT(setEnabled(bool)) ); box1->addSpacing( 12 ); chSampleSize = new QCheckBox( i18n("Sample size")+":", this ); connect( chSampleSize, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chSampleSize ); cSampleSize = new KComboBox( this ); cSampleSize->addItem( "8 bit" ); cSampleSize->addItem( "16 bit" ); cSampleSize->addItem( "24 bit" ); cSampleSize->addItem( "32 bit" ); cSampleSize->setCurrentIndex( 1 ); cSampleSize->setEditable( true ); cSampleSize->setEnabled( false ); box1->addWidget( cSampleSize ); connect( chSampleSize, SIGNAL(toggled(bool)), cSampleSize, SLOT(setEnabled(bool)) ); box1->addSpacing( 12 ); chChannels = new QCheckBox( i18n("Channels")+":", this ); connect( chChannels, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chChannels ); cChannels = new KComboBox( this ); cChannels->addItem( i18n("Mono") ); cChannels->addItem( i18n("Stereo") ); cChannels->setEnabled( false ); box1->addWidget( cChannels ); connect( chChannels, SIGNAL(toggled(bool)), cChannels, SLOT(setEnabled(bool)) ); box1->addStretch(); effectWidgetsBox = new QVBoxLayout(); grid->addLayout( effectWidgetsBox, gridRow++, 0 ); SoxEffectWidget *effectWidget = new SoxEffectWidget( this ); effectWidget->setAddButtonShown( true ); effectWidget->setRemoveButtonShown( false ); connect( effectWidget, SIGNAL(addEffectWidgetClicked()), this, SLOT(addEffectWidgetClicked()) ); connect( effectWidget, SIGNAL(removeEffectWidgetClicked(SoxEffectWidget*)), this, SLOT(removeEffectWidgetClicked(SoxEffectWidget*)) ); effectWidgetsBox->addWidget( effectWidget ); effectWidgets.append( effectWidget ); }
ColorMatrixEffectConfigWidget::ColorMatrixEffectConfigWidget(QWidget *parent) : KFilterEffectConfigWidgetBase(parent), m_effect(0) { QGridLayout * g = new QGridLayout(this); m_type = new KComboBox(this); m_type->addItem(i18n("Apply color matrix")); m_type->addItem(i18n("Saturate colors")); m_type->addItem(i18n("Rotate hue")); m_type->addItem(i18n("Luminance to alpha")); g->addWidget(m_type, 0, 0); m_stack = new QStackedWidget(this); m_stack->setContentsMargins(0, 0, 0, 0); g->addWidget(m_stack, 1, 0); m_matrixModel = new MatrixDataModel(this); QTableView * matrixWidget = new QTableView(m_stack); matrixWidget->setModel(m_matrixModel); matrixWidget->horizontalHeader()->hide(); matrixWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch); matrixWidget->verticalHeader()->hide(); matrixWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); m_stack->addWidget(matrixWidget); QWidget * saturateWidget = new QWidget(m_stack); QGridLayout * saturateLayout = new QGridLayout(saturateWidget); saturateLayout->addWidget(new QLabel(i18n("Saturate value"), saturateWidget), 0, 0); m_saturate = new KDoubleNumInput(saturateWidget); m_saturate->setRange(0.0, 1.0, 0.05, false); saturateLayout->addWidget(m_saturate, 0, 1); saturateLayout->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 1, 0); saturateWidget->setLayout(saturateLayout); m_stack->addWidget(saturateWidget); QWidget * hueRotateWidget = new QWidget(m_stack); QGridLayout * hueRotateLayout = new QGridLayout(hueRotateWidget); hueRotateLayout->addWidget(new QLabel(i18n("Angle"), hueRotateWidget), 0, 0); m_hueRotate = new KDoubleNumInput(hueRotateWidget); m_hueRotate->setRange(0.0, 360.0, 1.0, false); hueRotateLayout->addWidget(m_hueRotate, 0, 1); hueRotateLayout->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 1, 0); hueRotateWidget->setLayout(hueRotateLayout); m_stack->addWidget(hueRotateWidget); QWidget * luminanceWidget = new QWidget(m_stack); m_stack->addWidget(luminanceWidget); setLayout(g); connect(m_type, SIGNAL(currentIndexChanged(int)), m_stack, SLOT(setCurrentIndex(int))); connect(m_type, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int))); connect(m_saturate, SIGNAL(valueChanged(double)), this, SLOT(saturateChanged(double))); connect(m_hueRotate, SIGNAL(valueChanged(double)), this, SLOT(hueRotateChanged(double))); connect(m_matrixModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(matrixChanged())); }
AccountMaster::AccountMaster(MainWindow* main, Id account_id) : DataWindow(main, "AccountMaster", account_id) { _helpSource = "account_master.html"; // Create widgets QLabel* nameLabel = new QLabel(tr("&Name:"), _frame); _name = new LineEdit(_frame); _name->setLength(30); nameLabel->setBuddy(_name); QLabel* numberLabel = new QLabel(tr("N&umber:"), _frame); _number = new LineEdit(_frame); _number->setLength(12); numberLabel->setBuddy(_number); QLabel* typeLabel = new QLabel(tr("&Type:"), _frame); _type = new QComboBox(false, _frame); typeLabel->setBuddy(_type); connect(_type, SIGNAL(activated(int)), SLOT(typeChanged(int))); for (int type = Account::Bank; type <= Account::OtherExpense; ++type) { _type->insertItem(Account::typeName(Account::Type(type))); } _type->setMinimumSize(_type->sizeHint()); _type->setMaximumSize(_type->sizeHint()); QLabel* parentLabel = new QLabel(tr("&Parent:"), _frame); _parentLookup = new AccountLookup(main, this, -1, true, false); _parent = new LookupEdit(_parentLookup, _frame); parentLabel->setBuddy(_parent); QFrame* boxes = new QFrame(_frame); _header = new QCheckBox(tr("Header Account?"), boxes); QLabel* nextNumLabel = new QLabel(tr("Next Cheque #:"), boxes); _nextNum = new IntegerEdit(boxes); _nextNum->setLength(6); QLabel* lastReconLabel = new QLabel(tr("Last Reconciled:"), boxes); _lastRecon = new DateEdit(boxes); _lastRecon->setEnabled(false); QGroupBox* groups = new QGroupBox(tr("Groups"), boxes); QGridLayout* g_grid = new QGridLayout(groups, 2, 1,groups->frameWidth()*2); g_grid->addRowSpacing(0, groups->fontMetrics().height()); _groups = new Table(groups); _groups->setVScrollBarMode(QScrollView::AlwaysOn); _groups->setDisplayRows(2); _groups->setLeftMargin(fontMetrics().width("999")); connect(_groups, SIGNAL(cellChanged(int,int,Variant)), SLOT(groupCellChanged(int,int,Variant))); GroupLookup* groupLookup = new GroupLookup(_main, this, Group::ACCOUNT); new LookupColumn(_groups, tr("Group Name"), 15, groupLookup); new LookupEditor(_groups, 0, new LookupEdit(groupLookup, _groups)); g_grid->addWidget(_groups, 1, 0); QGridLayout* grid1 = new QGridLayout(boxes); grid1->setSpacing(3); grid1->setMargin(3); grid1->setRowStretch(2, 1); grid1->setColStretch(1, 1); grid1->addWidget(_header, 0, 0); grid1->addWidget(nextNumLabel, 1, 0, AlignLeft | AlignVCenter); grid1->addWidget(_nextNum, 1, 1, AlignLeft | AlignVCenter); grid1->addWidget(lastReconLabel, 3, 0, AlignLeft | AlignVCenter); grid1->addWidget(_lastRecon, 3, 1, AlignLeft | AlignVCenter); grid1->addMultiCellWidget(groups, 0, 3, 2, 2); QGridLayout *grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->addWidget(nameLabel, 0, 0); grid->addWidget(_name, 0, 1); grid->addWidget(numberLabel, 0, 2); grid->addWidget(_number, 0, 3, AlignLeft | AlignVCenter); grid->addWidget(typeLabel, 1, 0); grid->addWidget(_type, 1, 1, AlignLeft | AlignVCenter); grid->addWidget(parentLabel, 1, 2); grid->addWidget(_parent, 1, 3); grid->addMultiCellWidget(boxes, 2, 2, 0, 3); setCaption(tr("Account Master")); finalize(); }
QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title, const QString& message, QSystemTrayIcon *ti) : QWidget(0, Qt::ToolTip), trayIcon(ti), timerId(-1) { setAttribute(Qt::WA_DeleteOnClose); QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close())); QLabel *titleLabel = new QLabel; titleLabel->installEventFilter(this); titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); #ifdef Q_OS_WINCE f.setPointSize(f.pointSize() - 2); #endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows #ifdef Q_OS_WINCE const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; #else const int iconSize = 18; const int closeButtonSize = 15; #endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize)); closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); closeButton->setFixedSize(closeButtonSize, closeButtonSize); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; #ifdef Q_OS_WINCE f.setBold(false); msgLabel->setFont(f); #endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label #ifdef Q_OS_WINCE int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; #else int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; #endif if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { msgLabel->d_func()->ensureTextControl(); if (QWidgetTextControl *control = msgLabel->d_func()->control) { QTextOption opt = control->document()->defaultTextOption(); opt.setWrapMode(QTextOption::WrapAnywhere); control->document()->setDefaultTextOption(opt); } } #ifdef Q_OS_WINCE // Make sure that the text isn't wrapped "somewhere" in the balloon widget // in the case that we have a long title label. setMaximumWidth(limit); #else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); #endif } QIcon si; switch (icon) { case QSystemTrayIcon::Warning: si = style()->standardIcon(QStyle::SP_MessageBoxWarning); break; case QSystemTrayIcon::Critical: si = style()->standardIcon(QStyle::SP_MessageBoxCritical); break; case QSystemTrayIcon::Information: si = style()->standardIcon(QStyle::SP_MessageBoxInformation); break; case QSystemTrayIcon::NoIcon: default: break; } QGridLayout *layout = new QGridLayout; if (!si.isNull()) { QLabel *iconLabel = new QLabel; iconLabel->setPixmap(si.pixmap(iconSize, iconSize)); iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); iconLabel->setMargin(2); layout->addWidget(iconLabel, 0, 0); layout->addWidget(titleLabel, 0, 1); } else { layout->addWidget(titleLabel, 0, 0, 1, 2); } layout->addWidget(closeButton, 0, 2); layout->addWidget(msgLabel, 1, 0, 1, 3); layout->setSizeConstraint(QLayout::SetFixedSize); layout->setMargin(3); setLayout(layout); QPalette pal = palette(); pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1)); pal.setColor(QPalette::WindowText, Qt::black); setPalette(pal); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); { //! [0] QWidget *window = new QWidget; //! [0] //! [1] QPushButton *button1 = new QPushButton("One"); //! [1] //! [2] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [2] //! [3] QHBoxLayout *layout = new QHBoxLayout; //! [3] //! [4] layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); window->setLayout(layout); //! [4] //! [5] window->show(); //! [5] } { //! [6] QWidget *window = new QWidget; //! [6] //! [7] QPushButton *button1 = new QPushButton("One"); //! [7] //! [8] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [8] //! [9] QVBoxLayout *layout = new QVBoxLayout; //! [9] //! [10] layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); window->setLayout(layout); //! [10] //! [11] window->show(); //! [11] } { //! [12] QWidget *window = new QWidget; //! [12] //! [13] QPushButton *button1 = new QPushButton("One"); //! [13] //! [14] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [14] //! [15] QGridLayout *layout = new QGridLayout; //! [15] //! [16] layout->addWidget(button1, 0, 0); layout->addWidget(button2, 0, 1); layout->addWidget(button3, 1, 0, 1, 2); layout->addWidget(button4, 2, 0); layout->addWidget(button5, 2, 1); window->setLayout(layout); //! [16] //! [17] window->show(); //! [17] } return app.exec(); }
void MainPanel::init() { if (!db.init()) { QMessageBox error; error.critical(0, "Error!", "An error occured while trying to load the database."); exit(EXIT_FAILURE); return; } stack = new QStackedWidget(this); QString style = getStylesheet(":/Styles/Content.css"); // Prepare UI objects for each tab libraryPtr = new Library(db); libraryPtr->setStyleSheet(style); browserPtr = new Browser(); browserPtr->setStyleSheet(style); stack->addWidget(libraryPtr); stack->addWidget(browserPtr); stack->setCurrentWidget(libraryPtr); // System layout QHBoxLayout* systemLayout = new QHBoxLayout; systemLayout->setSpacing(0); systemLayout->setMargin(8); // Header spacing QVBoxLayout* topLayout = new QVBoxLayout; topLayout->setMargin(0); // Header layout QHBoxLayout* headerLayout = new QHBoxLayout; headerLayout->setSpacing(0); headerLayout->setMargin(0); // Window title QLabel* windowTitle = new QLabel(this); windowTitle->setObjectName("windowTitle"); windowTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); windowTitle->setMinimumWidth(175); windowTitle->setMaximumWidth(175); windowTitle->setAlignment(Qt::AlignTop); windowTitle->setFont(QFont("Sansation", 18)); windowTitle->setText("Project \nASCENSION"); windowTitle->setStyleSheet("color: #7D818C;"); windowTitle->setAttribute(Qt::WA_TransparentForMouseEvents); // Post-initialization header spacing topLayout->addLayout(systemLayout); topLayout->addLayout(headerLayout); topLayout->addSpacing(10); headerLayout->addSpacing(20); headerLayout->addWidget(windowTitle); headerLayout->addSpacing(40); // Header tabs libraryTab = new TabLabel(this); libraryTab = g_tabFactory(libraryTab, "libraryTab", "LIBRARY"); headerLayout->addSpacing(8); headerLayout->addWidget(libraryTab); libraryTab->setStyleSheet("font-weight: bold; color: lightgreen;"); storeTab = new TabLabel(this); storeTab = g_tabFactory(storeTab, "storeTab", " STORE"); headerLayout->addSpacing(8); headerLayout->addWidget(storeTab); modsTab = new TabLabel(this); modsTab = g_tabFactory(modsTab, "modsTab", " MODS"); headerLayout->addSpacing(8); headerLayout->addWidget(modsTab); newsTab = new TabLabel(this); newsTab = g_tabFactory(newsTab, "newsTab", "NEWS"); headerLayout->addSpacing(8); headerLayout->addWidget(newsTab); browserTab = new TabLabel(this); browserTab = g_tabFactory(browserTab, "browserTab", "BROWSER"); headerLayout->addSpacing(8); headerLayout->addWidget(browserTab); activeTab = libraryTab; headerLayout->addStretch(); // System buttons systemLayout->addStretch(); // Minimize QPushButton* pushButtonMinimize = new QPushButton("", this); pushButtonMinimize->setObjectName("pushButtonMinimize"); systemLayout->addWidget(pushButtonMinimize); QObject::connect(pushButtonMinimize, SIGNAL(clicked()), this, SLOT(pushButtonMinimize())); // Maximize QPushButton* pushButtonMaximize = new QPushButton("", this); pushButtonMaximize->setObjectName("pushButtonMaximize"); systemLayout->addWidget(pushButtonMaximize); QObject::connect(pushButtonMaximize, SIGNAL(clicked()), this, SLOT(pushButtonMaximize())); // Close QPushButton* pushButtonClose = new QPushButton("", this); pushButtonClose->setObjectName("pushButtonClose"); systemLayout->addWidget(pushButtonClose); QObject::connect(pushButtonClose, SIGNAL(clicked()), this, SLOT(pushButtonClose())); // Main panel layout QGridLayout* mainGridLayout = new QGridLayout(); mainGridLayout->setSpacing(0); mainGridLayout->setMargin(0); setLayout(mainGridLayout); // Central widget QWidget* centralWidget = new QWidget(this); centralWidget->setObjectName("centralWidget"); centralWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // Main panel scroll area QScrollArea* scrollArea = new QScrollArea(this); scrollArea->setWidgetResizable(true); scrollArea->setObjectName("mainPanelScrollArea"); scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // Vertical layout example QVBoxLayout* verticalLayout = new QVBoxLayout(); verticalLayout->setSpacing(5); verticalLayout->setMargin(0); verticalLayout->setAlignment(Qt::AlignHCenter); verticalLayout->addLayout(topLayout, 1); verticalLayout->addWidget(stack, 4); // Connect signals connect(libraryTab, SIGNAL(clicked()), this, SLOT(setTabLibrary())); connect(browserTab, SIGNAL(clicked()), this, SLOT(setTabBrowser())); // Show centralWidget->setLayout(verticalLayout); scrollArea->setWidget(centralWidget); mainGridLayout->addWidget(scrollArea); }
Calculator::Calculator(QWidget *parent): QDialog(parent) { sumInMemory = 0.0; sumSoFar = 0.0; factorSoFar=0.0; waitingForOperand=true; display = new QLineEdit("0"); display->setReadOnly(true); display->setAlignment(Qt::AlignRight); display->setMaxLength(15); QFont font = display ->font(); font.setPointSize(font.pointSize()+8); display->setFont(font); for (int i=0; i<NumDigitButtons;++i){ digitButtons[i]= createButton(QString::number(i),SLOT(digitClicked())); } Button *pointButton = createButton(tr("."),SLOT(pointClicked())); Button *changeSignButton = createButton(tr("\302\261"),SLOT(changeSignClicked())); Button *backspaceButton = createButton(tr("Borrar"),SLOT(backspaceClicked())); Button *clearButton = createButton(tr("Limpiar"),SLOT(clear())); Button *clearAllButton = createButton(tr("Limpiar Todo"),SLOT(clearAll())); Button *clearMemoryButton = createButton(tr("MC"),SLOT(clearMemory())); Button *readMemoryButton = createButton(tr("MR"),SLOT(readMemory())); Button *setMemoryButton = createButton(tr("MS"),SLOT(setMemory())); Button *addToMemoryButton = createButton(tr("M+"),SLOT(addToMemory())); Button *divisionButton = createButton(tr("\303\267"),SLOT(multiplicativeOperatorClicked())); Button *timesButton = createButton(tr("\303\227"),SLOT(multiplicativeOperatorClicked())); Button *minusButton = createButton(tr("-"),SLOT(additiveOperatorClicked())); Button *plusButton = createButton(tr("+"),SLOT(additiveOperatorClicked())); Button *squareRootButton = createButton(tr("Raiz"),SLOT(unaryOperatorClicked())); Button *powerButton = createButton(tr("x\302\262"),SLOT(unaryOperatorClicked())); Button *reciprocalButton = createButton(tr("1/x"),SLOT(unaryOperatorClicked())); Button *equalButton = createButton(tr("="),SLOT(equalClicked())); QGridLayout *mainLayout = new QGridLayout; mainLayout->setSizeConstraint(QLayout::SetFixedSize); mainLayout->addWidget(display,0,0,1,6); mainLayout->addWidget(backspaceButton,1,0,1,2); mainLayout->addWidget(clearButton,1,2,1,2); mainLayout->addWidget(clearAllButton,1,4,1,2); mainLayout->addWidget(clearMemoryButton,2,0); mainLayout->addWidget(readMemoryButton,3,0); mainLayout->addWidget(setMemoryButton,4,0); mainLayout->addWidget(addToMemoryButton,5,0); for (int i=1;i<NumDigitButtons;++i){ int row = ((9-i)/3)+2; int column = ((i - 1)%3)+1; mainLayout->addWidget(digitButtons[i],row,column); } mainLayout->addWidget(digitButtons[0],5,1); mainLayout->addWidget(pointButton,5,2); mainLayout->addWidget(changeSignButton,5,3); mainLayout->addWidget(divisionButton,2,4); mainLayout->addWidget(timesButton,3,4); mainLayout->addWidget(minusButton,4,4); mainLayout->addWidget(plusButton,5,4); mainLayout->addWidget(squareRootButton,2,5); mainLayout->addWidget(powerButton,3,5); mainLayout->addWidget(reciprocalButton,4,5); mainLayout->addWidget(equalButton,5,5); setLayout(mainLayout); setWindowTitle(tr("Calculadora 2011640366 Guerra Zarate Sergio Uriel")); }
ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf, const QString& inputMRL ) : QVLCDialog( parent, _p_intf ) { setWindowTitle( qtr( "Convert" ) ); setWindowRole( "vlc-convert" ); QGridLayout *mainLayout = new QGridLayout( this ); SoutInputBox *inputBox = new SoutInputBox( this ); inputBox->setMRL( inputMRL ); mainLayout->addWidget( inputBox, 0, 0, 1, -1 ); /** * Destination **/ QGroupBox *destBox = new QGroupBox( qtr( "Destination" ) ); QGridLayout *destLayout = new QGridLayout( destBox ); QLabel *destLabel = new QLabel( qtr( "Destination file:" ) ); destLayout->addWidget( destLabel, 0, 0); fileLine = new QLineEdit; fileLine->setMinimumWidth( 300 ); fileLine->setFocus( Qt::ActiveWindowFocusReason ); destLabel->setBuddy( fileLine ); QPushButton *fileSelectButton = new QPushButton( qtr( "Browse" ) ); destLayout->addWidget( fileLine, 0, 1 ); destLayout->addWidget( fileSelectButton, 0, 2); BUTTONACT( fileSelectButton, fileBrowse() ); displayBox = new QCheckBox( qtr( "Display the output" ) ); displayBox->setToolTip( qtr( "This display the resulting media, but can " "slow things down." ) ); destLayout->addWidget( displayBox, 2, 0, 1, -1 ); mainLayout->addWidget( destBox, 1, 0, 1, -1 ); /* Profile Editor */ QGroupBox *settingBox = new QGroupBox( qtr( "Settings" ) ); QGridLayout *settingLayout = new QGridLayout( settingBox ); profile = new VLCProfileSelector( this ); settingLayout->addWidget( profile, 0, 0, 1, -1 ); deinterBox = new QCheckBox( qtr( "Deinterlace" ) ); settingLayout->addWidget( deinterBox, 1, 0 ); dumpBox = new QCheckBox( qtr( "Dump raw input" ) ); settingLayout->addWidget( dumpBox, 1, 1 ); mainLayout->addWidget( settingBox, 3, 0, 1, -1 ); /* Buttons */ QPushButton *okButton = new QPushButton( qtr( "&Start" ) ); QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) ); QDialogButtonBox *buttonBox = new QDialogButtonBox; okButton->setDefault( true ); buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole ); buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole ); mainLayout->addWidget( buttonBox, 5, 3 ); BUTTONACT(okButton,close()); BUTTONACT(cancelButton,cancel()); CONNECT(dumpBox,toggled(bool),this,dumpChecked(bool)); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //MainWindow w; //QWidget *widget = new QWidget(); QWidget *widget = new QWidget(); this->setCentralWidget(widget); //w.show(); QGridLayout *layout = new QGridLayout(); widget->setLayout(layout); //Title of the Main Window QLabel *title = new QLabel(); title->setText("PageCacheSync"); layout->addWidget(title,0,0,1,0,Qt::AlignCenter); QFont f( "Arial", 25, QFont::Bold); title->setFont(f); searchFile = new QLineEdit(this); layout->addWidget(searchFile,1,1); QLabel *Filetext = new QLabel(this); Filetext->setText("Directory"); layout->addWidget(Filetext,1,0); load = new QPushButton(this); load->setText("Load"); layout->addWidget(load,1,2); connect(load,SIGNAL(clicked()),this,SLOT(clickedLoad())); //IP Enter location ipEnter = new QLineEdit(); layout->addWidget(ipEnter,2,1); QLabel *ipText = new QLabel(); ipText->setText("Enter IP Address"); layout->addWidget(ipText,2,0); //Search Button Enter = new QPushButton(this); Enter->setText("Enter"); layout->addWidget(Enter,3,2); connect(Enter,SIGNAL(clicked()),this, SLOT(clickedSearch())); //New Search Input Location searchEnter = new QLineEdit(this); layout->addWidget(searchEnter,3,1); QLabel *searchText = new QLabel(this); searchText->setText("Search for"); layout->addWidget(searchText,3,0); connect(searchEnter,SIGNAL(textEdited(QString)),this,SLOT(lineEdited(QString))); //Sync Button syncButton = new QPushButton(); syncButton->setText("Sync"); layout->addWidget(syncButton,2,2); connect(syncButton,SIGNAL(clicked()),this,SLOT(clickedSync())); //Text Box where autocomplete results show text = new QTextEdit(this); layout->addWidget(text,4,1); //Add initial data to hash table string file = "/Users/wasimkhan/PageCache/DC1-sampleQueries.txt"; hash = new HashTable(file); //Networking Part mySender = new Sender(); myReceiver = new Receiver(); filterArray_send = hash->filterArray; }
QSoundBuffer::QSoundBuffer(plCreatable* pCre, QWidget* parent) : QCreatable(pCre, kSoundBuffer, parent) { plSoundBuffer* obj = plSoundBuffer::Convert(fCreatable); QGroupBox* flagGroup = new QGroupBox(tr("Flags"), this); fFlags[kIsExternal] = new QCheckBox(tr("External"), flagGroup); fFlags[kAlwaysExternal] = new QCheckBox(tr("Always External"), flagGroup); fFlags[kStreamCompressed] = new QCheckBox(tr("Stream Compressed"), flagGroup); fFlags[kOnlyLeftChannel] = new QCheckBox(tr("Left Channel Only"), flagGroup); fFlags[kOnlyRightChannel] = new QCheckBox(tr("Right Channel Only"), flagGroup); QGridLayout* flagLayout = new QGridLayout(flagGroup); flagLayout->setVerticalSpacing(0); flagLayout->setHorizontalSpacing(8); flagLayout->addWidget(fFlags[kIsExternal], 0, 0); flagLayout->addWidget(fFlags[kAlwaysExternal], 1, 0); flagLayout->addWidget(fFlags[kStreamCompressed], 2, 0); flagLayout->addWidget(fFlags[kOnlyLeftChannel], 0, 1); flagLayout->addWidget(fFlags[kOnlyRightChannel], 1, 1); fFlags[kIsExternal]->setChecked((obj->getFlags() & plSoundBuffer::kIsExternal) != 0); fFlags[kAlwaysExternal]->setChecked((obj->getFlags() & plSoundBuffer::kAlwaysExternal) != 0); fFlags[kStreamCompressed]->setChecked((obj->getFlags() & plSoundBuffer::kStreamCompressed) != 0); fFlags[kOnlyLeftChannel]->setChecked((obj->getFlags() & plSoundBuffer::kOnlyLeftChannel) != 0); fFlags[kOnlyRightChannel]->setChecked((obj->getFlags() & plSoundBuffer::kOnlyRightChannel) != 0); QGroupBox* headerGroup = new QGroupBox(tr("Header"), this); fFormat = new QComboBox(headerGroup); fFormat->addItems(QStringList() << "(Invalid)" << "PCM"); fBitRate = new QIntEdit(headerGroup); fBitRate->setRange(0, 0xFFFF); fNumChannels = new QSpinBox(headerGroup); fNumChannels->setRange(0, 0xFFFF); fBlockAlign = new QIntEdit(headerGroup); fBlockAlign->setRange(0, 0xFFFF); fSampleRate = new QIntEdit(headerGroup); fSampleRate->setRange(0, 0x7FFFFFFF); fAvgBytesPerSec = new QIntEdit(headerGroup); fAvgBytesPerSec->setRange(0, 0x7FFFFFFF); QGridLayout* headerLayout = new QGridLayout(headerGroup); headerLayout->setVerticalSpacing(4); headerLayout->setHorizontalSpacing(8); headerLayout->addItem(new QSpacerItem(8, 0, QSizePolicy::Minimum, QSizePolicy::Minimum), 2, 2); headerLayout->addWidget(new QLabel(tr("Format:"), headerGroup), 0, 0); headerLayout->addWidget(fFormat, 0, 1); headerLayout->addWidget(new QLabel(tr("Bit Rate:"), headerGroup), 0, 3); headerLayout->addWidget(fBitRate, 0, 4); headerLayout->addWidget(new QLabel(tr("Channels:"), headerGroup), 1, 0); headerLayout->addWidget(fNumChannels, 1, 1); headerLayout->addWidget(new QLabel(tr("Block Align:"), headerGroup), 1, 3); headerLayout->addWidget(fBlockAlign, 1, 4); headerLayout->addWidget(new QLabel(tr("Sample Rate:"), headerGroup), 2, 0, 1, 3); headerLayout->addWidget(fSampleRate, 2, 3, 1, 2); headerLayout->addWidget(new QLabel(tr("Avg. Bytes/Second:"), headerGroup), 3, 0, 1, 3); headerLayout->addWidget(fAvgBytesPerSec, 3, 3, 1, 2); fFormat->setCurrentIndex(obj->getHeader().getFormatTag()); fBlockAlign->setValue(obj->getHeader().getBlockAlign()); fNumChannels->setValue(obj->getHeader().getNumChannels()); fBitRate->setValue(obj->getHeader().getBitsPerSample()); fSampleRate->setValue(obj->getHeader().getNumSamplesPerSec()); fAvgBytesPerSec->setValue(obj->getHeader().getAvgBytesPerSec()); fFilename = new QLineEdit(this); fFilename->setText(~obj->getFileName()); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(8, 8, 8, 8); layout->addWidget(flagGroup, 0, 0, 1, 2); layout->addWidget(headerGroup, 1, 0, 1, 2); layout->addWidget(new QLabel(tr("Filename:"), this), 2, 0); layout->addWidget(fFilename, 2, 1); }
//! [0] WidgetGallery::WidgetGallery(QWidget *parent) : QDialog(parent) { originalPalette = QApplication::palette(); styleComboBox = new QComboBox; styleComboBox->addItem("NorwegianWood"); styleComboBox->addItems(QStyleFactory::keys()); styleLabel = new QLabel(tr("&Style:")); styleLabel->setBuddy(styleComboBox); useStylePaletteCheckBox = new QCheckBox(tr("&Use style's standard palette")); useStylePaletteCheckBox->setChecked(true); disableWidgetsCheckBox = new QCheckBox(tr("&Disable widgets")); createTopLeftGroupBox(); createTopRightGroupBox(); createBottomLeftTabWidget(); createBottomRightGroupBox(); createProgressBar(); //! [0] //! [1] connect(styleComboBox, SIGNAL(activated(QString)), //! [1] //! [2] this, SLOT(changeStyle(QString))); connect(useStylePaletteCheckBox, SIGNAL(toggled(bool)), this, SLOT(changePalette())); connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), topLeftGroupBox, SLOT(setDisabled(bool))); connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), topRightGroupBox, SLOT(setDisabled(bool))); connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), bottomLeftTabWidget, SLOT(setDisabled(bool))); connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), bottomRightGroupBox, SLOT(setDisabled(bool))); //! [2] //! [3] QHBoxLayout *topLayout = new QHBoxLayout; //! [3] //! [4] topLayout->addWidget(styleLabel); topLayout->addWidget(styleComboBox); topLayout->addStretch(1); topLayout->addWidget(useStylePaletteCheckBox); topLayout->addWidget(disableWidgetsCheckBox); QGridLayout *mainLayout = new QGridLayout; mainLayout->addLayout(topLayout, 0, 0, 1, 2); mainLayout->addWidget(topLeftGroupBox, 1, 0); mainLayout->addWidget(topRightGroupBox, 1, 1); mainLayout->addWidget(bottomLeftTabWidget, 2, 0); mainLayout->addWidget(bottomRightGroupBox, 2, 1); mainLayout->addWidget(progressBar, 3, 0, 1, 2); mainLayout->setRowStretch(1, 1); mainLayout->setRowStretch(2, 1); mainLayout->setColumnStretch(0, 1); mainLayout->setColumnStretch(1, 1); setLayout(mainLayout); setWindowTitle(tr("Styles")); changeStyle("NorwegianWood"); }
EditContactDialog::EditContactDialog(AlcatelCategoryList *cat, AlcatelContactList *lst, const AlcatelContact *cont, QWidget *parent, const char *name ) : KDialog(parent,name,true) { contact = cont; list= lst; categories = cat; QLabel *label; QFrame *line; resize(500, 580 ); if (cont == NULL) setCaption( i18n( "New contact" ) ); else setCaption( i18n( "Edit contact" ) ); QGridLayout *mainLayout = new QGridLayout( this ); mainLayout->setSpacing( 6 ); mainLayout->setMargin( 8 ); if (cont == NULL) label = new QLabel( i18n("<b>New contact</b>"), this ); else label = new QLabel( i18n("<b>Edit contact</b>"), this ); mainLayout->addMultiCellWidget(label,0,0,0,3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,1,1,0,3); mainLayout->setRowStretch(0, -1); mainLayout->setRowStretch(1, -1); mainLayout->addWidget(new QLabel(i18n("First name"), this), 2, 0); mainLayout->addWidget(editFirstName = new QLineEdit(this), 2, 1); mainLayout->addWidget(new QLabel(i18n("Last name"), this), 2, 2); mainLayout->addWidget(editLastName = new QLineEdit(this), 2, 3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,3,3,0,3); mainLayout->addWidget(new QLabel(i18n("Company"), this), 4, 0); mainLayout->addWidget(editCompany = new QLineEdit(this), 4, 1); mainLayout->addWidget(new QLabel(i18n("Job title"), this), 4, 2); mainLayout->addWidget(editJobTitle = new QLineEdit(this), 4, 3); mainLayout->addWidget(new QLabel(i18n("Category"), this), 5, 0); mainLayout->addWidget(editCategory = new KComboBox(this), 5, 1); editCategory->insertItem(i18n("Not set")); /* -1 */ editCategory->insertItem(i18n("none_category", "None")); /* 255 */ for( AlcatelCategoryList::Iterator c_it = categories->begin(); c_it != categories->end(); ++c_it ) { editCategory->insertItem((*c_it).Name); } // , (*c_it).Id mainLayout->addWidget(new QLabel(i18n("Private"), this), 5, 2); mainLayout->addWidget(editPrivate = new QCheckBox(this), 5, 3); mainLayout->addWidget(new QLabel(i18n("Note"), this), 6, 0); /* this will be longer */ mainLayout->addMultiCellWidget(editNote = new QLineEdit(this), 6, 6, 1, 3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,7,7,0,3); mainLayout->addWidget(new QLabel(i18n("Work number"), this),8 , 0); mainLayout->addWidget(editWorkNumber = new QLineEdit(this),8 , 1); editWorkNumber->setValidator(new PhoneNumberValidator(true, true, false, editWorkNumber)); mainLayout->addWidget(new QLabel(i18n("Main number"), this),8 , 2); mainLayout->addWidget(editMainNumber = new QLineEdit(this),8 , 3); editMainNumber->setValidator(new PhoneNumberValidator(true, true, false, editMainNumber)); mainLayout->addWidget(new QLabel(i18n("Fax number"), this),9 , 0); mainLayout->addWidget(editFaxNumber = new QLineEdit(this),9 , 1); editFaxNumber->setValidator(new PhoneNumberValidator(true, true, false, editFaxNumber)); mainLayout->addWidget(new QLabel(i18n("Other number"), this),9 , 2); mainLayout->addWidget(editOtherNumber = new QLineEdit(this),9 , 3); editOtherNumber->setValidator(new PhoneNumberValidator(true, true, false, editOtherNumber)); mainLayout->addWidget(new QLabel(i18n("Pager number"), this),10 , 0); mainLayout->addWidget(editPagerNumber = new QLineEdit(this),10 , 1); editPagerNumber->setValidator(new PhoneNumberValidator(true, true, false, editPagerNumber)); mainLayout->addWidget(new QLabel(i18n("Mobile number"), this),10 , 2); mainLayout->addWidget(editMobileNumber = new QLineEdit(this),10 , 3); editMobileNumber->setValidator(new PhoneNumberValidator(true, true, false, editMobileNumber)); mainLayout->addWidget(new QLabel(i18n("Home number"), this),11 , 0); mainLayout->addWidget(editHomeNumber = new QLineEdit(this),11 , 1); editHomeNumber->setValidator(new PhoneNumberValidator(true, true, false, editHomeNumber)); /* what should be here? mainLayout->addWidget(new QLabel(i18n(""), this), , 2);*/ line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,12,12,0,3); mainLayout->addWidget(new QLabel(i18n("Email 1"), this), 13, 0); mainLayout->addWidget(editEmail1 = new QLineEdit(this), 13, 1); mainLayout->addWidget(new QLabel(i18n("Email 2"), this), 13, 2); mainLayout->addWidget(editEmail2 = new QLineEdit(this), 13, 3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,14,14,0,3); mainLayout->addWidget(new QLabel(i18n("Address"), this), 15, 0); /* this will be longer */ mainLayout->addMultiCellWidget(editAddress = new QLineEdit(this), 15, 15, 1, 3); mainLayout->addWidget(new QLabel(i18n("City"), this), 16, 0); mainLayout->addWidget(editCity = new QLineEdit(this), 16, 1); mainLayout->addWidget(new QLabel(i18n("Zip"), this), 16, 2); mainLayout->addWidget(editZip = new QLineEdit(this), 16, 3); mainLayout->addWidget(new QLabel(i18n("State"), this), 17, 0); mainLayout->addWidget(editState = new QLineEdit(this), 17, 1); mainLayout->addWidget(new QLabel(i18n("Country"), this), 17, 2); mainLayout->addWidget(editCountry = new QLineEdit(this), 17, 3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,18,18,0,3); mainLayout->addWidget(new QLabel(i18n("Custom 1"), this), 19, 0); mainLayout->addWidget(editCustom1 = new QLineEdit(this), 19, 1); mainLayout->addWidget(new QLabel(i18n("Custom 2"), this), 19, 2); mainLayout->addWidget(editCustom2 = new QLineEdit(this), 19, 3); mainLayout->addWidget(new QLabel(i18n("Custom 3"), this), 20, 0); mainLayout->addWidget(editCustom3 = new QLineEdit(this), 20, 1); mainLayout->addWidget(new QLabel(i18n("Custom 4"), this), 20, 2); mainLayout->addWidget(editCustom4 = new QLineEdit(this), 20, 3); line = new QFrame( this ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMargin(3); mainLayout->addMultiCellWidget(line,21,21,0,3); mainLayout->addWidget(new QLabel(i18n("Storage"), this), 22, 0); editStorage = new KComboBox(this); editStorage->insertItem(i18n("none_storage", "None")); editStorage->insertItem(i18n("PC")); editStorage->insertItem(i18n("SIM")); editStorage->insertItem(i18n("Mobile")); connect( editStorage, SIGNAL( activated(int)), this, SLOT( slotStorage(int))); editStorage->setCurrentItem(1); mainLayout->addWidget(editStorage, 22, 1); mainLayout->addWidget(new QLabel(i18n("Position"), this), 22, 2); editPosition = new KIntNumInput(this); editPosition->setRange(-1, 9999,1,false); editPosition->setSpecialValueText(i18n("Auto")); mainLayout->addWidget(editPosition, 22, 3); QHBoxLayout *layout = new QHBoxLayout; layout->setSpacing( 6 ); layout->setMargin( 0 ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout->addItem( spacer ); QPushButton *buttonOK = new QPushButton(i18n("&OK"), this); buttonOK->setDefault(true); layout->addWidget(buttonOK); QPushButton *buttonCancel = new QPushButton(i18n("&Cancel"), this); layout->addWidget(buttonCancel); mainLayout->addMultiCellLayout( layout, 24,24, 0,3 ); line = new QFrame( this); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); mainLayout->addMultiCellWidget( line, 23,23, 0,3 ); connect( buttonOK, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); editPosition->setEnabled(false); loadContact(); if (contact == NULL) editPosition->setValue(-1); editStorage->setEnabled(contact == NULL); }
ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) : QWidget(parent), m_mode(mode), m_defaultSizeSlider(0), m_previewSizeSlider(0), m_fontRequester(0), m_widthBox(0), m_maxLinesBox(0), m_expandableFolders(0) { QVBoxLayout* topLayout = new QVBoxLayout(this); // Create "Icon Size" group QGroupBox* iconSizeGroup = new QGroupBox(this); iconSizeGroup->setTitle(i18nc("@title:group", "Icon Size")); const int minRange = ZoomLevelInfo::minimumLevel(); const int maxRange = ZoomLevelInfo::maximumLevel(); QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this); m_defaultSizeSlider = new QSlider(Qt::Horizontal, this); m_defaultSizeSlider->setPageStep(1); m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow); m_defaultSizeSlider->setRange(minRange, maxRange); connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotDefaultSliderMoved(int))); QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this); m_previewSizeSlider = new QSlider(Qt::Horizontal, this); m_previewSizeSlider->setPageStep(1); m_previewSizeSlider->setTickPosition(QSlider::TicksBelow); m_previewSizeSlider->setRange(minRange, maxRange); connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotPreviewSliderMoved(int))); QGridLayout* layout = new QGridLayout(iconSizeGroup); layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight); layout->addWidget(m_defaultSizeSlider, 0, 1); layout->addWidget(previewLabel, 1, 0, Qt::AlignRight); layout->addWidget(m_previewSizeSlider, 1, 1); // Create "Text" group QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this); QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup); m_fontRequester = new DolphinFontRequester(textGroup); QGridLayout* textGroupLayout = new QGridLayout(textGroup); textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight); textGroupLayout->addWidget(m_fontRequester, 0, 1); switch (m_mode) { case IconsMode: { QLabel* widthLabel = new QLabel(i18nc("@label:listbox", "Width:"), textGroup); m_widthBox = new KComboBox(textGroup); m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Small")); m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Medium")); m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Large")); m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Huge")); QLabel* maxLinesLabel = new QLabel(i18nc("@label:listbox", "Maximum lines:"), textGroup); m_maxLinesBox = new KComboBox(textGroup); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "Unlimited")); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "1")); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "2")); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "3")); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "4")); m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "5")); textGroupLayout->addWidget(widthLabel, 2, 0, Qt::AlignRight); textGroupLayout->addWidget(m_widthBox, 2, 1); textGroupLayout->addWidget(maxLinesLabel, 3, 0, Qt::AlignRight); textGroupLayout->addWidget(m_maxLinesBox, 3, 1); break; } case CompactMode: { QLabel* maxWidthLabel = new QLabel(i18nc("@label:listbox", "Maximum width:"), textGroup); m_widthBox = new KComboBox(textGroup); m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Unlimited")); m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Small")); m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Medium")); m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Large")); textGroupLayout->addWidget(maxWidthLabel, 2, 0, Qt::AlignRight); textGroupLayout->addWidget(m_widthBox, 2, 1); break; } case DetailsMode: m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable folders"), this); break; default: break; } topLayout->addWidget(iconSizeGroup); topLayout->addWidget(textGroup); topLayout->addWidget(m_expandableFolders); topLayout->addStretch(1); loadSettings(); connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); switch (m_mode) { case IconsMode: connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); connect(m_maxLinesBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); break; case CompactMode: connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); break; case DetailsMode: connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); break; default: break; } }
PeopleDefinitionInspectorView::PeopleDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent) : ModelObjectInspectorView(model, true, parent) { m_isIP = isIP; //QWidget* hiddenWidget = new QWidget(); //this->stackedWidget()->insertWidget(0, hiddenWidget); QWidget* visibleWidget = new QWidget(); this->stackedWidget()->addWidget(visibleWidget); //this->stackedWidget()->setCurrentIndex(0); QGridLayout* mainGridLayout = new QGridLayout(); mainGridLayout->setContentsMargins(7,7,7,7); mainGridLayout->setSpacing(14); visibleWidget->setLayout(mainGridLayout); // name QVBoxLayout* vLayout = new QVBoxLayout(); QLabel* label = new QLabel("Name: "); label->setObjectName("H2"); vLayout->addWidget(label); m_nameEdit = new OSLineEdit2(); vLayout->addWidget(m_nameEdit); mainGridLayout->addLayout(vLayout,0,0,1,3, Qt::AlignTop); // number of people, people per area, and area per person vLayout = new QVBoxLayout(); label = new QLabel("Number of People: "); label->setObjectName("H2"); vLayout->addWidget(label); bool isConnected = false; m_numberofPeopleEdit = new OSDoubleEdit2(); vLayout->addWidget(m_numberofPeopleEdit); mainGridLayout->addLayout(vLayout,1,0, Qt::AlignTop|Qt::AlignLeft); vLayout = new QVBoxLayout(); label = new QLabel("People per Space Floor Area: "); label->setObjectName("H2"); vLayout->addWidget(label); m_peopleperSpaceFloorAreaEdit = new OSQuantityEdit2("people/m^2", "people/m^2", "people/ft^2", m_isIP); isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_peopleperSpaceFloorAreaEdit, SLOT(onUnitSystemChange(bool))); OS_ASSERT(isConnected); vLayout->addWidget(m_peopleperSpaceFloorAreaEdit); mainGridLayout->addLayout(vLayout,1,1, Qt::AlignTop|Qt::AlignLeft); vLayout = new QVBoxLayout(); label = new QLabel("Space Floor Area per Person: "); label->setObjectName("H2"); vLayout->addWidget(label); m_spaceFloorAreaperPersonEdit = new OSQuantityEdit2("m^2/person", "m^2/person", "ft^2/person", m_isIP); isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_spaceFloorAreaperPersonEdit, SLOT(onUnitSystemChange(bool))); OS_ASSERT(isConnected); vLayout->addWidget(m_spaceFloorAreaperPersonEdit); mainGridLayout->addLayout(vLayout,1,2, Qt::AlignTop|Qt::AlignLeft); // fraction radiance, sensible heat fraction, carbon dioxide rate vLayout = new QVBoxLayout(); label = new QLabel("Fraction Radiant: "); label->setObjectName("H2"); vLayout->addWidget(label); m_fractionRadiantEdit = new OSDoubleEdit2(); vLayout->addWidget(m_fractionRadiantEdit); mainGridLayout->addLayout(vLayout,2,0, Qt::AlignTop|Qt::AlignLeft); vLayout = new QVBoxLayout(); label = new QLabel("Sensible Heat Fraction Radiant: "); label->setObjectName("H2"); vLayout->addWidget(label); m_sensibleHeatFractionEdit = new OSDoubleEdit2(); vLayout->addWidget(m_sensibleHeatFractionEdit); mainGridLayout->addLayout(vLayout,2,1, Qt::AlignTop|Qt::AlignLeft); vLayout = new QVBoxLayout(); label = new QLabel("Carbon Dioxide Generation Rate: "); label->setObjectName("H2"); vLayout->addWidget(label); m_carbonDioxideGenerationRateEdit = new OSQuantityEdit2("m^3/s*W", "L/s*W", "ft^3*hr/min*Btu", m_isIP); isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_carbonDioxideGenerationRateEdit, SLOT(onUnitSystemChange(bool))); OS_ASSERT(isConnected); vLayout->addWidget(m_carbonDioxideGenerationRateEdit); mainGridLayout->addLayout(vLayout,2,2, Qt::AlignTop|Qt::AlignLeft); mainGridLayout->setColumnMinimumWidth(0, 80); mainGridLayout->setColumnMinimumWidth(1, 80); mainGridLayout->setColumnMinimumWidth(2, 80); mainGridLayout->setColumnStretch(3,1); mainGridLayout->setRowMinimumHeight(0, 30); mainGridLayout->setRowMinimumHeight(1, 30); mainGridLayout->setRowMinimumHeight(2, 30); mainGridLayout->setRowStretch(3,1); }
NoteInfoDialog::NoteInfoDialog(QWidget *parent, QString guid) : QDialog(parent) { if (guid.isEmpty()) { reject(); return; } note = Note::fromGUID(guid); if (note == NULL) { reject(); return; } setWindowTitle("Note Info"); QGridLayout* layout = new QGridLayout(this); QLabel* title = new QLabel(note->getTitle(), this); title->setAlignment(Qt::AlignCenter); QFont mainTitleFont, titleFont = title->font(); mainTitleFont.setBold(true); mainTitleFont.setPointSize(15); title->setFont(mainTitleFont); layout->addWidget(title, 0, 0, 1, 4); layout->addWidget(new QLabel("<b>Overview</b>", this), 2, 0, 1, 4); titleFont.setCapitalization(QFont::AllUppercase); titleFont.setFamily("gotham,helvetica,arial,sans-serif"); titleFont.setLetterSpacing(QFont::PercentageSpacing, 102); titleFont.setWeight(100); QLabel* createdTitle = new QLabel("Created:", this); createdTitle->setFont(titleFont); layout->addWidget(createdTitle, 3, 0); QLabel* updatedTitle = new QLabel("Updated:", this); updatedTitle->setFont(titleFont); layout->addWidget(updatedTitle, 4, 0); QLabel* sizeTitle = new QLabel("Size:", this); sizeTitle->setFont(titleFont); layout->addWidget(sizeTitle, 5, 0); QLabel* reminderTitle = new QLabel("Reminder:", this); reminderTitle->setFont(titleFont); layout->addWidget(reminderTitle, 6, 0); QLabel* created = new QLabel(this); created->setText(note->getCreated().toString("dddd, MMMM d yyyy, h:mm AP")); layout->addWidget(created, 3, 1, 1, 3); QLabel* updated = new QLabel(this); updated->setText(note->getUpdated().toString("dddd, MMMM d yyyy, h:mm AP")); layout->addWidget(updated, 4, 1, 1, 3); QLabel* size = new QLabel(this); size->setText(QString("%1 bytes").arg(note->getSize())); size->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); layout->addWidget(size, 5, 1, 1, 3); reminderEdit = new QDateTimeEdit(this); reminderEdit->setDisplayFormat("dddd, MMMM d yyyy, h:mm AP"); reminderEdit->setCalendarPopup(true); reminderEdit->setMinimumDateTime(QDateTime::currentDateTime()); reminderEdit->setHidden(true); layout->addWidget(reminderEdit, 6, 1); QPushButton *deleteReminder = new QPushButton(this); deleteReminder->setIcon(QIcon::fromTheme("edit-delete")); deleteReminder->setHidden(true); layout->addWidget(deleteReminder, 6, 2); connect(deleteReminder, SIGNAL(clicked()), reminderEdit, SLOT(hide())); connect(deleteReminder, SIGNAL(clicked()), deleteReminder, SLOT(hide())); QPushButton *setReminder = new QPushButton(this); setReminder->setIcon(QIcon(":/img/reminder.png")); layout->addWidget(setReminder, 6, 3); connect(setReminder, SIGNAL(clicked()), reminderEdit, SLOT(show())); connect(setReminder, SIGNAL(clicked()), deleteReminder, SLOT(show())); QDateTime reminderTime = note->getReminderOrder(); if (!reminderTime.isNull()) { reminderEdit->setHidden(false); reminderEdit->setDateTime(reminderTime); deleteReminder->setHidden(false); } url = new QLineEdit(this); url->setPlaceholderText("Set a URL..."); url->setText(note->getSourceURL()); url->setMaxLength(4096); layout->addWidget(url, 7, 0, 1, 4); author = new QLineEdit(this); author->setPlaceholderText("Set an Author..."); author->setText(note->getAuthor()); author->setMaxLength(4096); layout->addWidget(author, 8, 0, 1, 4); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Save, Qt::Horizontal, this); connect(buttons, SIGNAL(accepted()), this, SLOT(save())); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); layout->addWidget(buttons, 9, 0, 1, 4); setLayout(layout); setMinimumWidth(400); }
UIWizardExportAppPageBasic3::UIWizardExportAppPageBasic3() { /* Create widgets: */ QVBoxLayout *pMainLayout = new QVBoxLayout(this); { m_pLabel = new QIRichTextLabel(this); QGridLayout *pSettingsLayout = new QGridLayout; { m_pUsernameEditor = new QLineEdit(this); m_pUsernameLabel = new QLabel(this); { m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pUsernameLabel->setBuddy(m_pUsernameEditor); } m_pPasswordEditor = new QLineEdit(this); { m_pPasswordEditor->setEchoMode(QLineEdit::Password); } m_pPasswordLabel = new QLabel(this); { m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pPasswordLabel->setBuddy(m_pPasswordEditor); } m_pHostnameEditor = new QLineEdit(this); m_pHostnameLabel = new QLabel(this); { m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pHostnameLabel->setBuddy(m_pHostnameEditor); } m_pBucketEditor = new QLineEdit(this); m_pBucketLabel = new QLabel(this); { m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pBucketLabel->setBuddy(m_pBucketEditor); } m_pFileSelector = new VBoxEmptyFileSelector(this); { m_pFileSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Save); m_pFileSelector->setEditable(true); m_pFileSelector->setButtonPosition(VBoxEmptyFileSelector::RightPosition); m_pFileSelector->setDefaultSaveExt("ova"); } m_pFileSelectorLabel = new QLabel(this); { m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pFileSelectorLabel->setBuddy(m_pFileSelector); } m_pFormatComboBox = new QComboBox(this); { const QString strFormat09("ovf-0.9"); const QString strFormat10("ovf-1.0"); const QString strFormat20("ovf-2.0"); m_pFormatComboBox->addItem(strFormat09, strFormat09); m_pFormatComboBox->addItem(strFormat10, strFormat10); m_pFormatComboBox->addItem(strFormat20, strFormat20); connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip())); } m_pFormatComboBoxLabel = new QLabel(this); { m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox); } pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0); pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1); pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0); pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1); pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0); pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1); pSettingsLayout->addWidget(m_pBucketLabel, 3, 0); pSettingsLayout->addWidget(m_pBucketEditor, 3, 1); pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0); pSettingsLayout->addWidget(m_pFileSelector, 4, 1); pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0); pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1); } m_pManifestCheckbox = new QCheckBox(this); pMainLayout->addWidget(m_pLabel); pMainLayout->addLayout(pSettingsLayout); pMainLayout->addWidget(m_pManifestCheckbox); pMainLayout->addStretch(); chooseDefaultSettings(); } /* Setup connections: */ connect(m_pUsernameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged())); connect(m_pPasswordEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged())); connect(m_pHostnameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged())); connect(m_pBucketEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged())); connect(m_pFileSelector, SIGNAL(pathChanged(const QString &)), this, SIGNAL(completeChanged())); /* Register fields: */ registerField("format", this, "format"); registerField("manifestSelected", this, "manifestSelected"); registerField("username", this, "username"); registerField("password", this, "password"); registerField("hostname", this, "hostname"); registerField("bucket", this, "bucket"); registerField("path", this, "path"); }
Notes::Notes() : m_notesFileName(QStandardPaths::standardLocations(QStandardPaths::DataLocation).value(0)), m_settings(QApplication::applicationName()), m_textEdit(new QPlainTextEdit), m_menu(new QMenu(this)), m_saveTimer(new QTimer(this)), m_canMove(false) { QAction *saveAct = new QAction(tr("Save"), this); saveAct->setShortcut(QKeySequence("Ctrl+S")); connect(saveAct, &QAction::triggered, this, &Notes::save); m_visibilityAct = new QAction(tr("Show"), this); m_visibilityAct->setProperty("SecondText", tr("Hide")); connect(m_visibilityAct, &QAction::triggered, this, &Notes::toggleVisibility); QAction *stayOnBottomAct = new QAction(tr("Stay on bottom"), this); stayOnBottomAct->setShortcut(QKeySequence("Alt+B")); stayOnBottomAct->setCheckable(true); connect(stayOnBottomAct, &QAction::triggered, [this, stayOnBottomAct] { Qt::WindowFlags flags = getNotesWindowFlags(); if (stayOnBottomAct->isChecked()) flags |= Qt::WindowStaysOnBottomHint; setWindowFlags(flags); setVisible(m_visible); }); QAction *aboutAct = new QAction(tr("About"), this); aboutAct->setShortcut(QKeySequence("F1")); connect(aboutAct, &QAction::triggered, [this] { QMessageBox::information(this, QString(), tr("KiiroNotes - simple notes for Linux desktop") + " (" + QCoreApplication::applicationVersion() + ")"); }); QAction *closeAct = new QAction(tr("Close"), this); closeAct->setShortcut(QKeySequence("Ctrl+Q")); connect(closeAct, &QAction::triggered, this, &Notes::close); /**/ m_saveTimer->setSingleShot(true); connect(m_saveTimer, &QTimer::timeout, this, &Notes::save); /**/ m_menu->addAction(saveAct); m_menu->addSeparator(); m_menu->addAction(m_visibilityAct); m_menu->addAction(stayOnBottomAct); m_menu->addSeparator(); m_menu->addAction(aboutAct); m_menu->addSeparator(); m_menu->addAction(closeAct); /**/ m_textEdit->setFrameShadow(QFrame::Plain); m_textEdit->setFrameShape(QFrame::NoFrame); QFile file(m_notesFileName); if (file.open(QFile::ReadOnly)) { m_textEdit->setPlainText(file.readAll()); m_textEdit->moveCursor(QTextCursor::End); m_textEdit->document()->setModified(false); } connect(m_textEdit, &QPlainTextEdit::textChanged, [this] { m_saveTimer->start(10000); }); /**/ QPalette palette; palette.setBrush(QPalette::Window, QColor(0xF7DC9D)); palette.setBrush(QPalette::Base, QColor(0xF7EC9D)); setPalette(palette); addAction(saveAct); addAction(m_visibilityAct); addAction(stayOnBottomAct); addAction(closeAct); QGridLayout *gridLayout = new QGridLayout(this); gridLayout->addWidget(m_textEdit, 0, 0, 1, 2); gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 1, 0, 1, 1); gridLayout->addWidget(new QSizeGrip(this), 1, 1, 1, 1); gridLayout->setMargin(0); /**/ setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &Notes::customContextMenuRequested, [this](const QPoint &p) { m_menu->popup(mapToGlobal(p)); }); Qt::WindowFlags flags = getNotesWindowFlags(); if (m_settings.value("StayOnBottom", false).toBool()) { flags |= Qt::WindowStaysOnBottomHint; stayOnBottomAct->setChecked(true); } setWindowFlags(flags); if (!restoreGeometry(m_settings.value("Geometry").toByteArray())) resize(300, 400); if (m_settings.value("Visible", true).toBool()) toggleVisibility(); else m_visible = false; }
/*---------------------------------------------------------------------- * EDIT SEASON DIALOG *--------------------------------------------------------------------*/ EditSeasonDialog::EditSeasonDialog(Context *context, Season *season) : QDialog(context->mainWindow, Qt::Dialog), context(context), season(season) { setWindowTitle(tr("Edit Date Range")); QVBoxLayout *mainLayout = new QVBoxLayout(this); // Grid QGridLayout *grid = new QGridLayout; QLabel *name = new QLabel(tr("Name")); QLabel *type = new QLabel(tr("Type")); QLabel *from = new QLabel(tr("From")); QLabel *to = new QLabel(tr("To")); QLabel *seed = new QLabel(tr("Starting LTS")); QLabel *low = new QLabel(tr("Lowest SB")); nameEdit = new QLineEdit(this); nameEdit->setText(season->getName()); typeEdit = new QComboBox; typeEdit->addItem(tr("Season"), Season::season); typeEdit->addItem(tr("Cycle"), Season::cycle); typeEdit->addItem(tr("Adhoc"), Season::adhoc); typeEdit->setCurrentIndex(typeEdit->findData(season->getType())); fromEdit = new QDateEdit(this); fromEdit->setDate(season->getStart()); toEdit = new QDateEdit(this); toEdit->setDate(season->getEnd()); seedEdit = new QDoubleSpinBox(this); seedEdit->setDecimals(0); seedEdit->setRange(0.0, 300.0); seedEdit->setSingleStep(1.0); seedEdit->setWrapping(true); seedEdit->setAlignment(Qt::AlignLeft); seedEdit->setValue(season->getSeed()); lowEdit = new QDoubleSpinBox(this); lowEdit->setDecimals(0); lowEdit->setRange(-500, 0); lowEdit->setSingleStep(1.0); lowEdit->setWrapping(true); lowEdit->setAlignment(Qt::AlignLeft); lowEdit->setValue(season->getLow()); grid->addWidget(name, 0,0); grid->addWidget(nameEdit, 0,1); grid->addWidget(type, 1,0); grid->addWidget(typeEdit, 1,1); grid->addWidget(from, 2,0); grid->addWidget(fromEdit, 2,1); grid->addWidget(to, 3,0); grid->addWidget(toEdit, 3,1); grid->addWidget(seed, 4,0); grid->addWidget(seedEdit, 4,1); grid->addWidget(low, 5,0); grid->addWidget(lowEdit, 5,1); mainLayout->addLayout(grid); // Buttons QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); applyButton = new QPushButton(tr("&OK"), this); cancelButton = new QPushButton(tr("&Cancel"), this); buttonLayout->addWidget(cancelButton); buttonLayout->addWidget(applyButton); mainLayout->addLayout(buttonLayout); // connect up slots connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); }
/** * Fourth Panel - Stats * Displays the Statistics for reading/streaming/encoding/displaying in a tree */ InputStatsPanel::InputStatsPanel( QWidget *parent, intf_thread_t *_p_intf ) : QWidget( parent ), p_intf( _p_intf ) { QGridLayout *layout = new QGridLayout(this); QLabel *topLabel = new QLabel( qtr( "Current" " media / stream " "statistics") ); topLabel->setWordWrap( true ); layout->addWidget( topLabel, 0, 0 ); StatsTree = new QTreeWidget(this); StatsTree->setColumnCount( 3 ); StatsTree->setHeaderHidden( true ); #define CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ) { \ itemName = \ new QTreeWidgetItem((QStringList () << itemText << itemValue << unit )); \ itemName->setTextAlignment( 1 , Qt::AlignRight ) ; } #define CREATE_CATEGORY( catName, itemText ) { \ CREATE_TREE_ITEM( catName, itemText , "", "" ); \ catName->setExpanded( true ); \ StatsTree->addTopLevelItem( catName ); } #define CREATE_AND_ADD_TO_CAT( itemName, itemText, itemValue, catName, unit ){ \ CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ); \ catName->addChild( itemName ); } /* Create the main categories */ CREATE_CATEGORY( audio, qtr("Audio") ); CREATE_CATEGORY( video, qtr("Video") ); CREATE_CATEGORY( input, qtr("Input/Read") ); CREATE_CATEGORY( streaming, qtr("Output/Written/Sent") ); CREATE_AND_ADD_TO_CAT( read_media_stat, qtr("Media data size"), "0", input , "KiB" ); CREATE_AND_ADD_TO_CAT( input_bitrate_stat, qtr("Input bitrate"), "0", input, "kb/s" ); CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed data size"), "0", input, "KiB") ; CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Content bitrate"), "0", input, "kb/s" ); CREATE_AND_ADD_TO_CAT( corrupted_stat, qtr("Discarded (corrupted)"), "0", input, "" ); CREATE_AND_ADD_TO_CAT( discontinuity_stat, qtr("Dropped (discontinued)"), "0", input, "" ); CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded"), "0", video, qtr("blocks") ); CREATE_AND_ADD_TO_CAT( vdisplayed_stat, qtr("Displayed"), "0", video, qtr("frames") ); CREATE_AND_ADD_TO_CAT( vlost_frames_stat, qtr("Lost"), "0", video, qtr("frames") ); CREATE_AND_ADD_TO_CAT( send_stat, qtr("Sent"), "0", streaming, qtr("packets") ); CREATE_AND_ADD_TO_CAT( send_bytes_stat, qtr("Sent"), "0", streaming, "KiB" ); CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Upstream rate"), "0", streaming, "kb/s" ); CREATE_AND_ADD_TO_CAT( adecoded_stat, qtr("Decoded"), "0", audio, qtr("blocks") ); CREATE_AND_ADD_TO_CAT( aplayed_stat, qtr("Played"), "0", audio, qtr("buffers") ); CREATE_AND_ADD_TO_CAT( alost_stat, qtr("Lost"), "0", audio, qtr("buffers") ); #undef CREATE_AND_ADD_TO_CAT #undef CREATE_CATEGORY #undef CREATE_TREE_ITEM input->setExpanded( true ); video->setExpanded( true ); streaming->setExpanded( true ); audio->setExpanded( true ); StatsTree->resizeColumnToContents( 0 ); StatsTree->setColumnWidth( 1 , 200 ); layout->addWidget(StatsTree, 1, 0 ); }
void Controller::createGUI(void) { // If old top level window exists, delete it first if (window) { delete window; } window = new QWidget(); window->setWindowTitle("Controller"); // Top level horizontal box QHBoxLayout *mainHoriz = new QHBoxLayout(); window->setLayout(mainHoriz); window->resize(800, 600); // Vertical box with slider and the camera screen QVBoxLayout *screenVert = new QVBoxLayout(); mainHoriz->addLayout(screenVert); horizSlider = new QSlider(Qt::Horizontal); horizSlider->setMinimum(-90); horizSlider->setMaximum(+90); horizSlider->setSliderPosition(0); QObject::connect(horizSlider, SIGNAL(valueChanged(int)), this, SLOT(updateCameraX(int))); screenVert->addWidget(horizSlider); vr = new VideoReceiver(window); screenVert->addWidget(vr); // Vertical slider next to camera screen vertSlider = new QSlider(Qt::Vertical); vertSlider->setMinimum(-90); vertSlider->setMaximum(+90); vertSlider->setSliderPosition(0); mainHoriz->addWidget(vertSlider); QObject::connect(vertSlider, SIGNAL(valueChanged(int)), this, SLOT(updateCameraY(int))); // Grid layoyt for the slave stats QGridLayout *grid = new QGridLayout(); mainHoriz->addLayout(grid); // Stats in separate horizontal boxes QLabel *label = NULL; int row = 0; // Round trip time label = new QLabel("RTT:"); labelRTT = new QLabel(""); grid->addWidget(label, row, 0, Qt::AlignLeft); grid->addWidget(labelRTT, row, 1, Qt::AlignLeft); // Resent Packets label = new QLabel("Resends:"); labelResentPackets = new QLabel("0"); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelResentPackets, row, 1, Qt::AlignLeft); // Resend timeout label = new QLabel("Resend timeout:"); labelResendTimeout = new QLabel(""); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelResendTimeout, row, 1, Qt::AlignLeft); // Uptime label = new QLabel("Uptime:"); labelUptime = new QLabel(""); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelUptime, row, 1, Qt::AlignLeft); // Load Avg label = new QLabel("Load Avg:"); labelLoadAvg = new QLabel(""); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelLoadAvg, row, 1, Qt::AlignLeft); // Wlan label = new QLabel("Wlan:"); labelWlan = new QLabel(""); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelWlan, row, 1, Qt::AlignLeft); // Bytes received per second (payload / total) label = new QLabel("Payload/total Rx:"); labelRx = new QLabel("0"); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelRx, row, 1, Qt::AlignLeft); // Bytes sent per second (payload / total) label = new QLabel("Payload/total Tx:"); labelTx = new QLabel("0"); grid->addWidget(label, ++row, 0, Qt::AlignLeft); grid->addWidget(labelTx, row, 1, Qt::AlignLeft); // Enable video label = new QLabel("Video:"); grid->addWidget(label, ++row, 0, Qt::AlignLeft); buttonEnableVideo = new QPushButton("Enable"); buttonEnableVideo->setCheckable(true); QObject::connect(buttonEnableVideo, SIGNAL(clicked(bool)), this, SLOT(clickedEnableVideo(bool))); grid->addWidget(buttonEnableVideo, row, 1, Qt::AlignLeft); // Video source label = new QLabel("Video source:"); grid->addWidget(label, ++row, 0, Qt::AlignLeft); comboboxVideoSource = new QComboBox(); comboboxVideoSource->addItem("Test"); comboboxVideoSource->addItem("Camera"); grid->addWidget(comboboxVideoSource, row, 1, Qt::AlignLeft); QObject::connect(comboboxVideoSource, SIGNAL(currentIndexChanged(int)), this, SLOT(selectedVideoSource(int))); window->show(); }