PerformanceMeasurement::Panel::Panel(QWidget *parent) : QWidget(parent, 0, Qt::WStyle_NormalBorder | Qt::WDestructiveClose), Workspace::Instance( "Performance Measuremnt", vars, num_vars ), state( INIT1), duration( 0 ), lastRead( 0 ), timestep( 0 ), maxDuration( 0 ), maxTimestep( 0 ), jitter( 0 ) { QHBox *hbox; QBoxLayout *layout = new QVBoxLayout(this); setCaption("Real-time Benchmarks"); hbox = new QHBox(this); layout->addWidget(hbox); QChar mu = QChar(0x3BC); QString suffix = QString("s)"); QString labeltext = "Computation Time ("; labeltext.append(mu); labeltext.append(suffix); (void) (new QLabel(labeltext, hbox))->setFixedWidth(175); durationEdit = new QLineEdit(hbox); hbox = new QHBox(this); layout->addWidget(hbox); labeltext = "Peak Computation Time ("; labeltext.append(mu); labeltext.append(suffix); (void) (new QLabel(labeltext, hbox))->setFixedWidth(175); maxDurationEdit = new QLineEdit(hbox); hbox = new QHBox(this); layout->addWidget(hbox); labeltext = "Real-time Period ("; labeltext.append(mu); labeltext.append(suffix); (void) (new QLabel(labeltext, hbox))->setFixedWidth(175); timestepEdit = new QLineEdit(hbox); hbox = new QHBox(this); layout->addWidget(hbox); labeltext = "Peak Real-time Period ("; labeltext.append(mu); labeltext.append(suffix); (void) (new QLabel(labeltext, hbox))->setFixedWidth(175); maxTimestepEdit = new QLineEdit(hbox); QToolTip::add(maxTimestepEdit, "The worst case time step"); hbox = new QHBox(this); layout->addWidget(hbox); labeltext = "Real-time Jitter ("; labeltext.append(mu); labeltext.append(suffix); (void) (new QLabel(labeltext, hbox))->setFixedWidth(175); timestepJitterEdit = new QLineEdit(hbox); QToolTip::add(timestepJitterEdit, "The variance in the real-time period"); hbox = new QHBox(this); layout->addWidget(hbox); QPushButton *resetButton = new QPushButton("Reset", this); layout->addWidget(resetButton); QObject::connect(resetButton,SIGNAL(clicked(void)),this,SLOT(reset(void))); QTimer *timer = new QTimer(this); timer->start(500); QObject::connect(timer,SIGNAL(timeout(void)),this,SLOT(update(void))); // Connect states to workspace setData( Workspace::STATE, 0, &duration ); setData( Workspace::STATE, 1, &maxDuration ); setData( Workspace::STATE, 2, ×tep ); setData( Workspace::STATE, 3, &maxTimestep ); setData( Workspace::STATE, 4, &jitter ); setActive(true); saveStats = false; }
NotificationDialog::NotificationDialog(Notification *notification, QWidget *parent) : QDialog(parent), m_notification(notification), m_closeLabel(NULL) { QFrame *notificationFrame = new QFrame(this); notificationFrame->setObjectName(QLatin1String("notificationFrame")); notificationFrame->setStyleSheet(QLatin1String("#notificationFrame {padding:5px;border:1px solid #CCC;border-radius:10px;background:#F0F0f0;}")); notificationFrame->setCursor(QCursor(Qt::PointingHandCursor)); notificationFrame->installEventFilter(this); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::LeftToRight); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); mainLayout->setSizeConstraint(QLayout::SetMinimumSize); mainLayout->addWidget(notificationFrame); QLabel *iconLabel = new QLabel(this); iconLabel->setPixmap(Utils::getIcon(QLatin1String("otter-browser-32")).pixmap(32, 32)); iconLabel->setStyleSheet(QLatin1String("padding:5px;")); QLabel *messageLabel = new QLabel(this); messageLabel->setText(m_notification->getMessage()); messageLabel->setStyleSheet(QLatin1String("padding:5px;font-size:13px;")); messageLabel->setWordWrap(true); QStyleOption option; option.rect = QRect(0, 0, 16, 16); QPixmap pixmap(16, 16); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &option, &painter, this); m_closeLabel = new QLabel(notificationFrame); m_closeLabel->setToolTip(tr("Close")); m_closeLabel->setPixmap(pixmap); m_closeLabel->setAlignment(Qt::AlignTop); m_closeLabel->setMargin(5); m_closeLabel->installEventFilter(this); QBoxLayout *notificationLayout = new QBoxLayout(QBoxLayout::LeftToRight); notificationLayout->setContentsMargins(0, 0, 0, 0); notificationLayout->setSpacing(0); notificationLayout->setSizeConstraint(QLayout::SetMinimumSize); notificationLayout->addWidget(iconLabel); notificationLayout->addWidget(messageLabel); notificationLayout->addWidget(m_closeLabel); notificationFrame->setLayout(notificationLayout); setLayout(mainLayout); setFixedWidth(400); setMinimumHeight(50); setMaximumHeight(150); setWindowOpacity(0); setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool | Qt::FramelessWindowHint); setFocusPolicy(Qt::NoFocus); setAttribute(Qt::WA_ShowWithoutActivating); setAttribute(Qt::WA_TranslucentBackground); adjustSize(); m_animation = new QPropertyAnimation(this, QStringLiteral("windowOpacity").toLatin1()); m_animation->setDuration(500); m_animation->setStartValue(0.0); m_animation->setEndValue(1.0); m_animation->start(); const int visibilityDuration = SettingsManager::getValue(QLatin1String("Interface/NotificationVisibilityDuration")).toInt(); if (visibilityDuration > 0) { QTimer::singleShot((visibilityDuration * 1000), this, SLOT(aboutToClose())); } }
/*! Changes the status bar's appearance to account for item changes. Special subclasses may need this, but normally geometry management will take care of any necessary rearrangements. */ void QStatusBar::reformat() { if ( d->box ) delete d->box; QBoxLayout *vbox; if ( isSizeGripEnabled() ) { d->box = new QHBoxLayout( this ); vbox = new QVBoxLayout( d->box ); } else { vbox = d->box = new QVBoxLayout( this ); } vbox->addSpacing( 3 ); QBoxLayout* l = new QHBoxLayout( vbox ); l->addSpacing( 3 ); int maxH = fontMetrics().height(); QStatusBarPrivate::SBItem* item = d->items.first(); while ( item && !item->p ) { l->addWidget( item->w, item->s ); l->addSpacing( 4 ); int itemH = item->w->sizeHint().height(); maxH = QMAX( maxH, itemH ); item = d->items.next(); } l->addStretch( 0 ); while ( item ) { l->addWidget( item->w, item->s ); l->addSpacing( 4 ); int itemH = item->w->sizeHint().height(); maxH = QMAX( maxH, itemH ); item = d->items.next(); } #ifndef QT_NO_SIZEGRIP if ( d->resizer ) { maxH = QMAX( maxH, d->resizer->sizeHint().height() ); d->box->addSpacing( 2 ); d->box->addWidget( d->resizer, 0, AlignBottom ); } #endif l->addStrut( maxH ); vbox->addSpacing( 2 ); d->box->activate(); repaint(); }
DvbEpgDialog::DvbEpgDialog(DvbManager *manager_, QWidget *parent) : KDialog(parent), manager(manager_) { setButtons(KDialog::Close); setCaption(i18nc("@title:window", "Program Guide")); QWidget *widget = new QWidget(this); QBoxLayout *mainLayout = new QHBoxLayout(widget); epgChannelTableModel = new DvbEpgChannelTableModel(this); epgChannelTableModel->setManager(manager); channelView = new QTreeView(widget); channelView->setMaximumWidth(30 * fontMetrics().averageCharWidth()); channelView->setModel(epgChannelTableModel); channelView->setRootIsDecorated(false); channelView->setUniformRowHeights(true); connect(channelView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(channelActivated(QModelIndex))); mainLayout->addWidget(channelView); QBoxLayout *rightLayout = new QVBoxLayout(); QBoxLayout *boxLayout = new QHBoxLayout(); KAction *scheduleAction = new KAction(QIcon::fromTheme(QLatin1String("media-record")), i18nc("@action:inmenu tv show", "Record Show"), this); connect(scheduleAction, SIGNAL(triggered()), this, SLOT(scheduleProgram())); QPushButton *pushButton = new QPushButton(scheduleAction->icon(), scheduleAction->text(), widget); connect(pushButton, SIGNAL(clicked()), this, SLOT(scheduleProgram())); boxLayout->addWidget(pushButton); boxLayout->addWidget(new QLabel(i18nc("@label:textbox", "Search:"), widget)); epgTableModel = new DvbEpgTableModel(this); epgTableModel->setEpgModel(manager->getEpgModel()); connect(epgTableModel, SIGNAL(layoutChanged()), this, SLOT(checkEntry())); KLineEdit *lineEdit = new KLineEdit(widget); lineEdit->setClearButtonShown(true); connect(lineEdit, SIGNAL(textChanged(QString)), epgTableModel, SLOT(setContentFilter(QString))); boxLayout->addWidget(lineEdit); rightLayout->addLayout(boxLayout); epgView = new QTreeView(widget); epgView->addAction(scheduleAction); epgView->header()->setResizeMode(QHeaderView::ResizeToContents); epgView->setContextMenuPolicy(Qt::ActionsContextMenu); epgView->setMinimumWidth(75 * fontMetrics().averageCharWidth()); epgView->setModel(epgTableModel); epgView->setRootIsDecorated(false); epgView->setUniformRowHeights(true); connect(epgView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(entryActivated(QModelIndex))); rightLayout->addWidget(epgView); contentLabel = new QLabel(widget); contentLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); contentLabel->setMargin(5); contentLabel->setWordWrap(true); QScrollArea *scrollArea = new QScrollArea(widget); scrollArea->setBackgroundRole(QPalette::Light); scrollArea->setMinimumHeight(12 * fontMetrics().height()); scrollArea->setWidget(contentLabel); scrollArea->setWidgetResizable(true); rightLayout->addWidget(scrollArea); mainLayout->addLayout(rightLayout); setMainWidget(widget); }
Configurator::Configurator(QWidget *parent) :QWidget(parent) { #ifdef K_DEBUG TINIT; #endif QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); /* QTextEdit *textArea = new QTextEdit; textArea->setFixedHeight(170); textArea->setHtml("<p>" + tr("This tool is just a <b>proof-of-concept</b> of the basic algorithm for the Tupi's free-tracing vectorial brushes") + "</p>"); mainLayout->addWidget(textArea); */ QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom); QLabel *label = new QLabel(tr("Parameters")); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label); mainLayout->addLayout(layout); /* QBoxLayout *structureLayout = new QBoxLayout(QBoxLayout::TopToBottom); QLabel *structureLabel = new QLabel(tr("Structure")); structureLabel->setAlignment(Qt::AlignHCenter); structureLayout->addWidget(structureLabel); structureCombo = new QComboBox(); structureCombo->addItem(tr("Basic")); structureCombo->addItem(tr("Axial")); structureCombo->addItem(tr("Organic")); structureCombo->setCurrentIndex(2); structureLayout->addWidget(structureCombo); mainLayout->addLayout(structureLayout); */ QBoxLayout *spaceLayout = new QBoxLayout(QBoxLayout::TopToBottom); QLabel *spaceLabel = new QLabel(tr("Dot Spacing")); spaceLabel->setAlignment(Qt::AlignHCenter); spaceLayout->addWidget(spaceLabel); spacingBox = new QSpinBox(); spacingBox->setSingleStep(1); spacingBox->setMinimum(1); spacingBox->setMaximum(10); spacingBox->setValue(5); spaceLayout->addWidget(spacingBox); connect(spacingBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSpacing(int))); mainLayout->addLayout(spaceLayout); QBoxLayout *sizeLayout = new QBoxLayout(QBoxLayout::TopToBottom); QLabel *sizeLabel = new QLabel(tr("Size Tolerance")); sizeLabel->setAlignment(Qt::AlignHCenter); sizeLayout->addWidget(sizeLabel); sizeBox = new QSpinBox(); sizeBox->setSingleStep(10); sizeBox->setMinimum(0); sizeBox->setMaximum(200); sizeBox->setValue(50); sizeLayout->addWidget(sizeBox); connect(sizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(updateSizeTolerance(int))); mainLayout->addLayout(sizeLayout); /* QBoxLayout *checkLayout = new QBoxLayout(QBoxLayout::TopToBottom); checkBox = new QCheckBox(tr("Run simulation")); checkBox->setChecked(true); checkLayout->addWidget(checkBox); connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(updateInterface(int))); mainLayout->addLayout(checkLayout); */ QBoxLayout *smoothLayout = new QBoxLayout(QBoxLayout::TopToBottom); QLabel *smoothLabel = new QLabel(tr("Smoothness")); smoothLabel->setAlignment(Qt::AlignHCenter); smoothLayout->addWidget(smoothLabel); smoothBox = new QDoubleSpinBox(); smoothBox->setValue(4.0); smoothBox->setDecimals(2); smoothBox->setSingleStep(0.1); smoothBox->setMaximum(100); smoothLayout->addWidget(smoothBox); mainLayout->addLayout(smoothLayout); // smoothBox->setDisabled(true); mainLayout->addStretch(2); }
void ControllBarUI::setupButtonIcons() { QBoxLayout *layout = qobject_cast<QBoxLayout*>( _ui->_buttonContainer->layout() ); if( layout == NULL ) { Error error; error.setErrorMessage( tr( "Cannot display controll bar buttons because buttonContainer layout cannot be cast to QBoxLayout" ), Error::Fatal ); Error::raise( &error ); return; } QBoxLayout *layoutMuteButtons = qobject_cast<QBoxLayout*>( _ui->_muteButtonRegion->layout() ); if( layoutMuteButtons == NULL ) { Error error; error.setErrorMessage( tr( "Cannot display mute buttons because mute buttonsRegin layout cannot be cast to QBoxLayout" ), Error::Fatal ); Error::raise( &error ); return; } _backwardButton = new ToogleButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_BACKWARD, Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_BACKWARD ); _backwardButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_BACKWARD ); layout->insertWidget( 0, _backwardButton ); _playButton = new CommandButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_PLAY ); _playButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_PLAY ); _playButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_PLAY ); layout->insertWidget( 1, _playButton ); _forwardButton = new ToogleButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_FORWARD, Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_FORWARD ); _forwardButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_FORWARD ); layout->insertWidget( 2, _forwardButton ); _previewButton = new ToogleButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_PREVIEW, Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_PREVIEW ); _previewButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_PREVIEW ); layout->insertWidget( 4, _previewButton ); _snapshotButton = new CommandButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_SNAPSHOT ); _snapshotButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_SNAPSHOT ); _snapshotButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_SNAPSHOT ); layout->insertWidget( 5, _snapshotButton ); _fullscreenButton = new ToogleButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_FULLSCREEN, Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_FULLSCREEN ); _fullscreenButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_FULLSCREEN ); layout->insertWidget( 6, _fullscreenButton ); _resolutionButton = new CommandButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_RESOLUTION ); _resolutionButton->setMouseOverImage( Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_RESOLUTION ); _resolutionButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_RESOLUTION ); layout->insertWidget( 7, _resolutionButton ); _muteButton = new ToogleButton( _ui->_buttonContainer, Constants::CONTROLL_BAR_IMAGE_DIR + Constants::CONTROLL_BAR_VOLUME, Constants::CONTROLL_BAR_IMAGE_DIR + "active" + Constants::CONTROLL_BAR_VOLUME ); _muteButton->setDisabledImage( Constants::CONTROLL_BAR_IMAGE_DIR + "disabled" + Constants::CONTROLL_BAR_VOLUME ); layoutMuteButtons->insertWidget( 0, _muteButton ); }
ChooseFolderView::ChooseFolderView( QWidget *parent ) : QWidget(parent) { QBoxLayout *layout = new QVBoxLayout(this); layout->setAlignment(Qt::AlignCenter); layout->setSpacing(PADDING); layout->setMargin(PADDING); welcomeLayout = new QHBoxLayout(); welcomeLayout->setAlignment(Qt::AlignLeft); welcomeLayout->setSpacing(0); welcomeLayout->setMargin(0); layout->addLayout(welcomeLayout); QLabel *logo = new QLabel(this); logo->setPixmap(QPixmap(":/images/app.png")); welcomeLayout->addWidget(logo, 0, Qt::AlignTop); // hLayout->addSpacing(PADDING); QLabel *welcomeLabel = new QLabel("<h1>" + tr("Welcome to <a href='%1'>%2</a>,") .replace("<a ", "<a style='color:palette(text)'") .arg(Constants::WEBSITE, Constants::APP_NAME) + "</h1>", this); welcomeLabel->setOpenExternalLinks(true); welcomeLayout->addWidget(welcomeLabel); // layout->addSpacing(PADDING); tipLabel = new QLabel( tr("%1 needs to scan your music collection.").arg(Constants::APP_NAME) , this); tipLabel->setFont(FontUtils::big()); layout->addWidget(tipLabel); QBoxLayout *buttonLayout = new QHBoxLayout(); layout->addLayout(buttonLayout); cancelButton = new QPushButton(tr("Cancel")); connect(cancelButton, SIGNAL(clicked()), parent, SLOT(goBack())); buttonLayout->addWidget(cancelButton); #ifdef APP_MAC_NO QPushButton *useiTunesDirButton = new QPushButton(tr("Use iTunes collection")); connect(useiTunesDirButton, SIGNAL(clicked()), SLOT(iTunesDirChosen())); useiTunesDirButton->setDefault(true); useiTunesDirButton->setFocus(Qt::NoFocusReason); buttonLayout->addWidget(useiTunesDirButton); #endif QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); QString homeLocation = QDesktopServices::storageLocation(QDesktopServices::HomeLocation); if (QFile::exists(musicLocation) && musicLocation != homeLocation + "/") { QPushButton *useSystemDirButton = new QPushButton(tr("Use %1").arg(musicLocation)); connect(useSystemDirButton, SIGNAL(clicked()), SLOT(systemDirChosen())); #ifndef APP_MAC_NO useSystemDirButton->setDefault(true); useSystemDirButton->setFocus(Qt::NoFocusReason); #endif buttonLayout->addWidget(useSystemDirButton); } QPushButton *chooseDirButton = new QPushButton(tr("Choose a folder...")); connect(chooseDirButton, SIGNAL(clicked()), SLOT(chooseFolder())); buttonLayout->addWidget(chooseDirButton); #if !defined(APP_MAC) && !defined(Q_WS_WIN) QLabel *privacyLabel = new QLabel( tr("%1 will connect to the Last.fm web services and pass artist names and album titles in order to fetch covert art, biographies and much more.") .arg(Constants::APP_NAME) + " " + tr("If you have privacy concerns about this you can quit now.") , this); privacyLabel->setFont(FontUtils::small()); privacyLabel->setOpenExternalLinks(true); privacyLabel->setWordWrap(true); layout->addWidget(privacyLabel); #endif }
void MyPluginGUI::createGUI(DefaultGUIModel::variable_t *var, int size) { setMinimumSize(200, 300); // Qt API for setting window size //overall GUI layout with a "horizontal box" copied from DefaultGUIModel QBoxLayout *layout = new QHBoxLayout(this); //additional GUI layouts with "vertical" layouts that will later // be added to the overall "layout" above QBoxLayout *leftlayout = new QVBoxLayout(); //QBoxLayout *rightlayout = new QVBoxLayout(); // this is a "horizontal button group" QHButtonGroup *bttnGroup = new QHButtonGroup("Button Panel:", this); // we add two pushbuttons to the button group QPushButton *aBttn = new QPushButton("Button A", bttnGroup); QPushButton *bBttn = new QPushButton("Button B", bttnGroup); // clicked() is a Qt signal that is given to pushbuttons. The connect() // function links the clicked() event to a function that is defined // as a "private slot:" in the header. QObject::connect(aBttn, SIGNAL(clicked()), this, SLOT(aBttn_event())); QObject::connect(bBttn, SIGNAL(clicked()), this, SLOT(bBttn_event())); //these 3 utility buttons are copied from DefaultGUIModel QHBox *utilityBox = new QHBox(this); pauseButton = new QPushButton("Pause", utilityBox); pauseButton->setToggleButton(true); QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool))); QPushButton *modifyButton = new QPushButton("Modify", utilityBox); QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void))); QPushButton *unloadButton = new QPushButton("Unload", utilityBox); QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void))); // add custom button group at the top of the layout leftlayout->addWidget(bttnGroup); // copied from DefaultGUIModel DO NOT EDIT // this generates the text boxes and labels QScrollView *sv = new QScrollView(this); sv->setResizePolicy(QScrollView::AutoOneFit); leftlayout->addWidget(sv); QWidget *viewport = new QWidget(sv->viewport()); sv->addChild(viewport); QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2); size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0; for (size_t i = 0; i < num_vars; i++) { if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT)) { param_t param; param.label = new QLabel(vars[i].name, viewport); scrollLayout->addWidget(param.label, parameter.size(), 0); param.edit = new DefaultGUILineEdit(viewport); scrollLayout->addWidget(param.edit, parameter.size(), 1); QToolTip::add(param.label, vars[i].description); QToolTip::add(param.edit, vars[i].description); if (vars[i].flags & PARAMETER) { if (vars[i].flags & DOUBLE) { param.edit->setValidator(new QDoubleValidator(param.edit)); param.type = PARAMETER | DOUBLE; } else if (vars[i].flags & UINTEGER) { QIntValidator *validator = new QIntValidator(param.edit); param.edit->setValidator(validator); validator->setBottom(0); param.type = PARAMETER | UINTEGER; } else if (vars[i].flags & INTEGER) { param.edit->setValidator(new QIntValidator(param.edit)); param.type = PARAMETER | INTEGER; } else param.type = PARAMETER; param.index = nparam++; param.str_value = new QString; } else if (vars[i].flags & STATE) { param.edit->setReadOnly(true); param.edit->setPaletteForegroundColor(Qt::darkGray); param.type = STATE; param.index = nstate++; } else if (vars[i].flags & EVENT) { param.edit->setReadOnly(true); param.type = EVENT; param.index = nevent++; } else if (vars[i].flags & COMMENT) { param.type = COMMENT; param.index = ncomment++; } parameter[vars[i].name] = param; } } // end DO NOT EDIT // add the 3 utility buttons to the bottom of the layout leftlayout->addWidget(utilityBox); // layouts can contain other layouts. if you added components to // "rightlayout" and added "rightlayout" to "layout," you would // have left and right panels in your custom GUI. layout->addLayout(leftlayout); //layout->addLayout(rightlayout); show(); // this line is required to render the GUI }
OSDPretty::OSDPretty(Mode mode, QWidget* parent) : QWidget(parent), ui_(new Ui_OSDPretty), mode_(mode), background_color_(kPresetBlue), background_opacity_(0.85), popup_display_(0), font_(QFont()), disable_duration_(false), timeout_(new QTimer(this)), fading_enabled_(false), fader_(new QTimeLine(300, this)), toggle_mode_(false) { Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint; setWindowFlags(flags); setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_X11NetWmWindowTypeNotification, true); setAttribute(Qt::WA_ShowWithoutActivating, true); ui_->setupUi(this); #ifdef Q_OS_WIN32 // Don't show the window in the taskbar. Qt::ToolTip does this too, but it // adds an extra ugly shadow. int ex_style = GetWindowLong(winId(), GWL_EXSTYLE); ex_style |= WS_EX_NOACTIVATE; SetWindowLong(winId(), GWL_EXSTYLE, ex_style); #endif // Mode settings switch (mode_) { case Mode_Popup: setCursor(QCursor(Qt::ArrowCursor)); break; case Mode_Draggable: setCursor(QCursor(Qt::OpenHandCursor)); break; } // Timeout timeout_->setSingleShot(true); timeout_->setInterval(5000); connect(timeout_, SIGNAL(timeout()), SLOT(hide())); ui_->icon->setMaximumSize(kMaxIconSize, kMaxIconSize); // Fader connect(fader_, SIGNAL(valueChanged(qreal)), SLOT(FaderValueChanged(qreal))); connect(fader_, SIGNAL(finished()), SLOT(FaderFinished())); #ifdef Q_OS_WIN32 set_fading_enabled(true); #endif // Load the show edges and corners QImage shadow_edge(":osd_shadow_edge.png"); QImage shadow_corner(":osd_shadow_corner.png"); for (int i = 0; i < 4; ++i) { QTransform rotation = QTransform().rotate(90 * i); shadow_edge_[i] = QPixmap::fromImage(shadow_edge.transformed(rotation)); shadow_corner_[i] = QPixmap::fromImage(shadow_corner.transformed(rotation)); } background_ = QPixmap(":osd_background.png"); // Set the margins to allow for the drop shadow QBoxLayout* l = static_cast<QBoxLayout*>(layout()); int margin = l->margin() + kDropShadowSize; l->setMargin(margin); // Get current screen resolution QRect screenResolution = QApplication::desktop()->screenGeometry(); // Leave 200 px for icon ui_->summary->setMaximumWidth(screenResolution.width() - 200); ui_->message->setMaximumWidth(screenResolution.width() - 200); // Set maximum size for the OSD, a little margin here too setMaximumSize(screenResolution.width() - 100, screenResolution.height() - 100); // Don't load settings here, they will be reloaded anyway on creation }
QxFileBrowser::QxFileBrowser(QWidget* parent) : QWidget(parent), gotoMenu_(0), recentMenu_(0), showHidden_(false), showDetails_(true), createFileDialog_(0), createDirDialog_(0), renameDialog_(0) { //-------------------------------------------------------------------------- // setup primary model and view cwdModel_ = new QFileSystemModel(this); cwdModel_->setReadOnly(false); QModelIndex root = cwdModel_->setRootPath(QDir::currentPath()); connect( cwdModel_, SIGNAL(fileRenamed(const QString&, const QString&, const QString&)), this, SLOT(fileRenamed(const QString&, const QString&, const QString&)) ); dirView_ = new QxFileSystemView(this); dirView_->setModel(cwdModel_); dirView_->header()->hide(); dirView_->setRootIndex(root); dirView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dirView_->setDragDropMode(QAbstractItemView::DragOnly); connect(dirView_, SIGNAL(activated(const QModelIndex&)), this, SLOT(cwdSet(const QModelIndex&))); connect(dirView_, SIGNAL(escape()), this, SIGNAL(escape())); connect(dirView_, SIGNAL(cdUp()), this, SLOT(cdUp())); connect(cwdModel_, SIGNAL(layoutChanged()), dirView_, SLOT(resizeColumnsToContents())); setFocusProxy(dirView_); // dirView_->setTextElideMode(Qt::ElideMiddle); dirView_->setFrameStyle(QFrame::NoFrame); // dirView_->setIndentation(18); // together with a branch pixmap could improve branch alignment dirView_->setLineWidth(0); dirView_->setMidLineWidth(0); #ifdef Q_WS_MAC dirView_->setStyleSheet( "QTreeView {" " font-size: 12px;" "}" "QTreeView::item {" " padding-top: 1px;" "}" ); #endif { QPalette pal = dirView_->palette(); pal.setColor(QPalette::Base, styleManager()->color("fileBrowserDirViewBgColor")); dirView_->setPalette(pal); } //-------------------------------------------------------------------------- // setup navigation bar / panel head gotoButton_ = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserGotoButton"))); gotoButton_->setMode(QxControl::MenuMode); gotoButton_->visual()->setText(QDir::current().dirName()); gotoButton_->setMinimumWidth(10); // design HACK gotoButton_->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); { QPixmap folderIcon = QFileIconProvider().icon(QFileInfo(QDir::currentPath())).pixmap(QSize(16, 16)); gotoButton_->visual()->setLeadingIcon(folderIcon); } #ifdef Q_WS_MAC #ifdef QT_MAC_USE_COCOA connect(gotoButton_, SIGNAL(toggled(bool)), this, SLOT(blockFloating(bool))); #endif // QT_MAC_USE_COCOA #endif // Q_WS_MAC updateGotoMenu(); class QxCdUpButton: public QxControl { public: QxCdUpButton(QWidget* parent) : QxControl(parent, new QxVisual(styleManager()->style("fileBrowserCdUpButton"))) {} private: // workaround HACK, prevent undocking, map double click event to single click virtual void mouseDoubleClickEvent(QMouseEvent* event) { press(); event->accept(); } }; QxControl* cdUpButton = new QxCdUpButton(this); cdUpButton->setMode(QxControl::TouchMode); connect(cdUpButton, SIGNAL(pressed()), this, SLOT(cdUp())); //-------------------------------------------------------------------------- // define context actions contextMenu_ = new QMenu(this); // QxDesignHack::beautify(contextMenu_); openDefaultAction_ = new QAction(tr("Open in Default App."), this); openDefaultAction_->setShortcut(tr("Ctrl+D")); openDefaultAction_->setShortcutContext(Qt::WidgetShortcut); openFileAction_ = new QAction(tr("Open in %1").arg(qApp->applicationName()), this); createFileAction_ = contextMenu_->addAction(tr("New File")); createDirAction_ = contextMenu_->addAction(tr("New Folder")); contextMenu_->addSeparator(); contextMenu_->addAction(openFileAction_); contextMenu_->addAction(openDefaultAction_); contextMenu_->addSeparator(); renameAction_ = contextMenu_->addAction(tr("Rename")); deleteAction_ = contextMenu_->addAction(tr("Move To Trash")); contextMenu_->addSeparator(); bookmarkAction_ = contextMenu_->addAction(tr("Bookmark")); contextMenu_->addSeparator(); showHiddenAction_ = contextMenu_->addAction(tr("Show Hidden")); showDetailsAction_ = contextMenu_->addAction(tr("Show Details")); connect(createFileAction_, SIGNAL(triggered()), this, SLOT(createFile())); connect(createDirAction_, SIGNAL(triggered()), this, SLOT(createDir())); connect(openDefaultAction_, SIGNAL(triggered()), this, SLOT(openDefault())); connect(openFileAction_, SIGNAL(triggered()), this, SLOT(openFile())); connect(renameAction_, SIGNAL(triggered()), this, SLOT(rename())); connect(deleteAction_, SIGNAL(triggered()), this, SLOT(delete_())); connect(dirView_, SIGNAL(delKeyPressed()), this, SLOT(delete_())); connect(showHiddenAction_, SIGNAL(toggled(bool)), this, SLOT(showHidden(bool))); connect(showDetailsAction_, SIGNAL(toggled(bool)), this, SLOT(showDetails(bool))); connect(bookmarkAction_, SIGNAL(triggered()), this, SLOT(bookmark())); showHiddenAction_->setCheckable(true); showDetailsAction_->setCheckable(true); showHiddenAction_->setChecked(false); showDetailsAction_->setChecked(false); //-------------------------------------------------------------------------- // setup toolbar QxControl* plusButton = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserPlusButton"))); plusButton->setMode(QxControl::TouchMode); connect(plusButton, SIGNAL(pressed()), this, SLOT(createFile())); QxControl* wheelButton = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserWheelButton"))); wheelButton->setMenu(contextMenu_); wheelButton->setMenuPopupMode(QxControl::DownsideMenuPopup|QxControl::UpsideMenuPopup|QxControl::PreferUpsideMenuPopup); QxControl* recentButton = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserRecentButton"))); recentButton->setMode(QxControl::TouchMode); connect(recentButton, SIGNAL(pressed()), this, SLOT(recentShowOrHide())); QxControl* bookmarksButton = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserBookmarksButton"))); bookmarksButton->setMode(QxControl::TouchMode); connect(bookmarksButton, SIGNAL(pressed()), this, SLOT(bookmarksShowOrHide())); statusBar_ = new QxStatusBar(this); showHidden(false); showDetails(false); //-------------------------------------------------------------------------- // setup bottom views recentModel_ = new QxUrlListModel(this); recentView_ = new QxUrlListView(this); // recentView_->header()->hide(); // recentView_->setViewMode(QListView::IconMode); // recentView_->setIconSize(QSize(16, 16)); recentView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); recentView_->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); recentView_->setTextElideMode(Qt::ElideLeft); recentView_->setFrameStyle(QFrame::NoFrame); recentView_->setLineWidth(0); recentView_->setMidLineWidth(0); recentView_->setStyleSheet( "QListView::item {" " padding-top: 1px;" "}" ); // recentView_->setAlternatingRowColors(true); recentView_->setModel(recentModel_); connect(recentView_, SIGNAL(activated(const QModelIndex&)), this, SLOT(gotoRecent(const QModelIndex&))); recentContextMenu_ = new QMenu(this); recentContextMenu_->addAction(tr("Goto"), this, SLOT(gotoRecent())); recentContextMenu_->addAction(tr("Add To Bookmarks"), this, SLOT(recentAddToBookmarks())); bookmarksModel_ = new QxUrlListModel(this); bookmarksModel_->setPathReduction(1); bookmarksView_ = new QxUrlListView(this); bookmarksView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); bookmarksView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); bookmarksView_->setTextElideMode(Qt::ElideLeft); bookmarksView_->setFrameStyle(QFrame::NoFrame); bookmarksView_->setLineWidth(0); bookmarksView_->setMidLineWidth(0); bookmarksView_->setStyleSheet( "QListView::item {" " padding-top: 1px;" "}" ); bookmarksView_->setModel(bookmarksModel_); bookmarksView_->setDragDropMode(QAbstractItemView::InternalMove); bookmarksView_->setDragEnabled(true); bookmarksView_->setAcceptDrops(true); bookmarksView_->setDropIndicatorShown(true); connect(bookmarksView_, SIGNAL(activated(const QModelIndex&)), this, SLOT(gotoBookmark(const QModelIndex&))); bookmarksContextMenu_ = new QMenu(this); bookmarksContextMenu_->addAction(tr("Add Current Directory"), this, SLOT(cwdAddToBookmark())); bookmarksContextMenu_->addAction(tr("Add Other Directory"), this, SLOT(addDirBookmark())); bookmarksContextMenu_->addSeparator(); bookmarksContextMenu_->addAction(tr("Goto Here"), this, SLOT(gotoBookmark())); bookmarksContextMenu_->addAction(tr("Remove From List"), this, SLOT(removeBookmark())); bookmarksContextMenu_->addSeparator(); bookmarksShowFullPathAction_ = bookmarksContextMenu_->addAction(tr("Show Full Path")); bookmarksShowFullPathAction_->setCheckable(true); bookmarksShowFullPathAction_->setChecked(bookmarksModel_->pathReduction() == -1); connect(bookmarksShowFullPathAction_, SIGNAL(toggled(bool)), this, SLOT(bookmarksShowFullPath(bool))); #ifdef Q_WS_MAC { QProxyStyle* proxyStyle = qobject_cast<QProxyStyle*>(style()); QMacStyle* macStyle = qobject_cast<QMacStyle*>((proxyStyle) ? proxyStyle->baseStyle() : style()); if (macStyle) { macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled); macStyle->setFocusRectPolicy(recentView_, QMacStyle::FocusDisabled); macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled); macStyle->setFocusRectPolicy(bookmarksView_, QMacStyle::FocusDisabled); } } #endif //-------------------------------------------------------------------------- // layout widgets handle_ = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserSplitter"))); handle_->visual()->setText(""); handleTextRecent_ = tr("Recent Places"); handleTextBookmarks_ = tr("Bookmarks"); bottomStack_ = new QxControl(this); bottomStackLayout_ = new QStackedLayout; bottomStackLayout_->addWidget(recentView_); bottomStackLayout_->addWidget(bookmarksView_); bottomStack_->setLayout(bottomStackLayout_); bottomStack_->setVisible(false); splitter_ = new QxSplitter(this); splitter_->setOrientation(Qt::Vertical); splitter_->setHandle(1, handle_); splitter_->setHandleWidth(styleManager()->constant("fileBrowserSplitterWidth")); splitter_->addWidget(dirView_); /*{ QxControl* carrier = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserDirView"))); QGridLayout* layout = new QGridLayout; layout->setSpacing(0); layout->setMargin(0); layout->addWidget(dirView_); carrier->setLayout(layout); splitter_->addWidget(carrier); }*/ splitter_->addWidget(bottomStack_); // make dirView_ grow/shrink dynamically, while bottomStack_ keeps user-defined size splitter_->setStretchFactor(0, 1); splitter_->setStretchFactor(1, 0); QDockWidget* dock = qobject_cast<QDockWidget*>(parent); if (dock) { dock->setWidget(this); // connect(dock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(adaptToDockLocation(Qt::DockWidgetArea))); } QVBoxLayout* col = new QVBoxLayout; col->setSpacing(0); col->setMargin(0); { QxControl* carrier = new QxControl(parent, new QxVisual(styleManager()->style("fileBrowserNavCarrier"))); QHBoxLayout* row = new QHBoxLayout; row->setSpacing(0); row->setMargin(0); row->addWidget(gotoButton_); row->addStretch(); row->addWidget(cdUpButton); carrier->setLayout(row); if (dock) dock->setTitleBarWidget(carrier); else col->addWidget(carrier); } col->addWidget(splitter_); col->addWidget(styleManager()->hl(this)); { QBoxLayout* row = new QBoxLayout(QBoxLayout::LeftToRight); row->setSpacing(0); row->setMargin(0); row->addWidget(plusButton); row->addWidget(styleManager()->vl(this)); row->addWidget(wheelButton); row->addWidget(styleManager()->vl(this)); row->addWidget(recentButton); row->addWidget(styleManager()->vl(this)); row->addWidget(bookmarksButton); row->addWidget(styleManager()->vl(this)); row->addWidget(statusBar_); col->addLayout(row); bottomToolLayout_ = row; } setLayout(col); }
TileSelectDialog::TileSelectDialog (QWidget* parent) : QDialog (parent) { QBoxLayout* layout = new QBoxLayout (QBoxLayout::TopToBottom, this); QRadioButton* radio_button = new QRadioButton ("Load Tile", this); radio_button->setChecked (true); layout->addWidget (radio_button); connect (radio_button, SIGNAL (toggled (bool)), this, SLOT (load_tile_toggled (bool))); _load_tile_frame = new QFrame (this); layout->addWidget (_load_tile_frame); QBoxLayout* box_layout = new QBoxLayout (QBoxLayout::LeftToRight, _load_tile_frame); _load_tile_line_edit = new QLineEdit (_load_tile_frame); box_layout->addWidget (_load_tile_line_edit); QPushButton* button = new QPushButton ("Choose", _load_tile_frame); box_layout->addWidget (button); connect (button, SIGNAL (pressed ()), this, SLOT (choose_button_pressed ())); radio_button = new QRadioButton ("Custom Tile", this); layout->addWidget (radio_button); _custom_tile_frame = new QFrame (this); _custom_tile_frame->setEnabled (false); layout->addWidget (_custom_tile_frame); connect (radio_button, SIGNAL (toggled (bool)), this, SLOT (custom_tile_toggled (bool))); QGridLayout* grid_layout = new QGridLayout (_custom_tile_frame); grid_layout->addWidget (new QLabel ("Size", _custom_tile_frame), 0, 0); _width_line_edit = new QLineEdit ("1", _custom_tile_frame); grid_layout->addWidget (_width_line_edit, 1, 0); grid_layout->addWidget (new QLabel ("x", _custom_tile_frame), 1, 1); _height_line_edit = new QLineEdit ("1", _custom_tile_frame); grid_layout->addWidget (_height_line_edit, 1, 2); grid_layout->addWidget (new QLabel ("Text", _custom_tile_frame), 2, 0); _text_line_edit = new QLineEdit (_custom_tile_frame); grid_layout->addWidget (_text_line_edit, 3, 0, 1, 3); box_layout = new QBoxLayout (QBoxLayout::RightToLeft); layout->addLayout (box_layout); button = new QPushButton ("&Ok", this); button->setDefault (true); connect (button, SIGNAL (pressed ()), this, SLOT (verify_input ())); box_layout->addWidget (button); button = new QPushButton ("&Cancel", this); connect (button, SIGNAL (pressed ()), this, SLOT (reject ())); box_layout->addWidget (button); }
KDMUsersWidget::KDMUsersWidget( QWidget *parent ) : QWidget( parent ) { #ifdef __linux__ struct stat st; if (!stat( "/etc/debian_version", &st )) { /* debian */ defminuid = "1000"; defmaxuid = "29999"; } else if (!stat( "/usr/portage", &st )) { /* gentoo */ defminuid = "1000"; defmaxuid = "65000"; } else if (!stat( "/etc/mandrake-release", &st )) { /* mandrake - check before redhat! */ defminuid = "500"; defmaxuid = "65000"; } else if (!stat( "/etc/redhat-release", &st )) { /* redhat */ defminuid = "100"; defmaxuid = "65000"; } else /* if (!stat( "/etc/SuSE-release", &st )) */ { /* suse */ defminuid = "500"; defmaxuid = "65000"; } #else defminuid = "1000"; defmaxuid = "65000"; #endif // We assume that $kde_datadir/kdm exists, but better check for pics/ and pics/users, // and create them if necessary. m_userPixDir = config->group("X-*-Greeter").readEntry( "FaceDir", KGlobal::dirs()->resourceDirs( "data" ).last() + "kdm/faces" ) + '/'; QDir testDir( m_userPixDir ); if (!testDir.exists() && !testDir.mkdir( testDir.absolutePath() ) && !geteuid()) KMessageBox::sorry( this, i18n("Unable to create folder %1", testDir.absolutePath() ) ); if (!getpwnam( "nobody" ) && !geteuid()) KMessageBox::sorry( this, i18n("User 'nobody' does not exist. " "Displaying user images will not work in KDM.") ); m_defaultText = i18n("<placeholder>default</placeholder>"); QString wtstr; minGroup = new QGroupBox( i18n("System U&IDs"), this ); minGroup->setWhatsThis( i18n("Users with a UID (numerical user identification) outside this range will not be listed by KDM and this setup dialog." " Note that users with the UID 0 (typically root) are not affected by this and must be" " explicitly hidden in \"Not hidden\" mode.") ); QSizePolicy sp_ign_fix( QSizePolicy::Ignored, QSizePolicy::Fixed ); QValidator *valid = new QIntValidator( 0, 999999, minGroup ); QLabel *minlab = new QLabel( i18n("Below:"), minGroup ); leminuid = new KLineEdit( minGroup ); minlab->setBuddy( leminuid ); leminuid->setSizePolicy( sp_ign_fix ); leminuid->setValidator( valid ); connect( leminuid, SIGNAL(textChanged( const QString & )), SIGNAL(changed()) ); connect( leminuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) ); QLabel *maxlab = new QLabel( i18n("Above:"), minGroup ); lemaxuid = new KLineEdit( minGroup ); maxlab->setBuddy( lemaxuid ); lemaxuid->setSizePolicy( sp_ign_fix ); lemaxuid->setValidator( valid ); connect( lemaxuid, SIGNAL(textChanged( const QString & )), SIGNAL(changed()) ); connect( lemaxuid, SIGNAL(textChanged( const QString & )), SLOT(slotMinMaxChanged()) ); QGridLayout *grid = new QGridLayout( minGroup ); grid->addWidget( minlab, 0, 0 ); grid->addWidget( leminuid, 0, 1 ); grid->addWidget( maxlab, 1, 0 ); grid->addWidget( lemaxuid, 1, 1 ); usrGroup = new QGroupBox( i18n("Users"), this ); cbshowlist = new QCheckBox( i18n("Show list"), usrGroup ); cbshowlist->setWhatsThis( i18n("If this option is checked, KDM will show a list of users," " so users can click on their name or image rather than typing in their login.") ); cbcomplete = new QCheckBox( i18n("Autocompletion"), usrGroup ); cbcomplete->setWhatsThis( i18n("If this option is checked, KDM will automatically complete" " user names while they are typed in the line edit.") ); cbinverted = new QCheckBox( i18n("Inverse selection"), usrGroup ); cbinverted->setWhatsThis( i18n("This option specifies how the users for \"Show list\" and \"Autocompletion\"" " are selected in the \"Select users and groups\" list: " "If not checked, select only the checked users. " "If checked, select all non-system users, except the checked ones.") ); cbusrsrt = new QCheckBox( i18n("Sor&t users"), usrGroup ); cbusrsrt->setWhatsThis( i18n("If this is checked, KDM will alphabetically sort the user list." " Otherwise users are listed in the order they appear in the password file.") ); QButtonGroup *buttonGroup = new QButtonGroup( usrGroup ); buttonGroup->setExclusive( false ); connect( buttonGroup, SIGNAL(buttonClicked( int )), SLOT(slotShowOpts()) ); connect( buttonGroup, SIGNAL(buttonClicked( int )), SIGNAL(changed()) ); buttonGroup->addButton( cbshowlist ); buttonGroup->addButton( cbcomplete ); buttonGroup->addButton( cbinverted ); buttonGroup->addButton( cbusrsrt ); QBoxLayout *box = new QVBoxLayout( usrGroup ); box->addWidget( cbshowlist ); box->addWidget( cbcomplete ); box->addWidget( cbinverted ); box->addWidget( cbusrsrt ); wstack = new QStackedWidget( this ); s_label = new QLabel( i18n("S&elect users and groups:"), this ); s_label->setBuddy( wstack ); optinlv = new K3ListView( this ); optinlv->addColumn( i18n("Selected Users") ); optinlv->setResizeMode( Q3ListView::LastColumn ); optinlv->setWhatsThis( i18n("KDM will show all checked users. Entries denoted with '@' are user groups. Checking a group is like checking all users in that group.") ); wstack->addWidget( optinlv ); connect( optinlv, SIGNAL(clicked( Q3ListViewItem * )), SLOT(slotUpdateOptIn( Q3ListViewItem * )) ); connect( optinlv, SIGNAL(clicked( Q3ListViewItem * )), SIGNAL(changed()) ); optoutlv = new K3ListView( this ); optoutlv->addColumn( i18n("Hidden Users") ); optoutlv->setResizeMode( Q3ListView::LastColumn ); optoutlv->setWhatsThis( i18n("KDM will show all non-checked non-system users. Entries denoted with '@' are user groups. Checking a group is like checking all users in that group.") ); wstack->addWidget( optoutlv ); connect( optoutlv, SIGNAL(clicked( Q3ListViewItem * )), SLOT(slotUpdateOptOut( Q3ListViewItem * )) ); connect( optoutlv, SIGNAL(clicked( Q3ListViewItem * )), SIGNAL(changed()) ); faceGroup = new QGroupBox( i18n("User Image Source"), this ); faceGroup->setWhatsThis( i18n("Here you can specify where KDM will obtain the images that represent users." " \"Admin\" represents the global folder; these are the pictures you can set below." " \"User\" means that KDM should read the user's $HOME/.face.icon file." " The two selections in the middle define the order of preference if both sources are available.") ); rbadmonly = new QRadioButton( i18n("Admin"), faceGroup ); rbprefadm = new QRadioButton( i18n("Admin, user"), faceGroup ); rbprefusr = new QRadioButton( i18n("User, admin"), faceGroup ); rbusronly = new QRadioButton( i18n("User"), faceGroup ); buttonGroup = new QButtonGroup( faceGroup ); connect( buttonGroup, SIGNAL(buttonClicked( int )), SLOT(slotFaceOpts()) ); connect( buttonGroup, SIGNAL(buttonClicked( int )), SIGNAL(changed()) ); buttonGroup->addButton( rbadmonly ); buttonGroup->addButton( rbprefadm ); buttonGroup->addButton( rbprefusr ); buttonGroup->addButton( rbusronly ); box = new QVBoxLayout( faceGroup ); box->addWidget( rbadmonly ); box->addWidget( rbprefadm ); box->addWidget( rbprefusr ); box->addWidget( rbusronly ); QGroupBox *picGroup = new QGroupBox( i18n("User Images"), this ); usercombo = new KComboBox( picGroup ); usercombo->setWhatsThis( i18n("The user the image below belongs to.") ); connect( usercombo, SIGNAL(activated( int )), SLOT(slotUserSelected()) ); QLabel *userlabel = new QLabel( i18n("User:"******"Click or drop an image here") ); userbutton->setWhatsThis( i18n("Here you can see the image assigned to the user selected in the combo box above. Click on the image button to select from a list" " of images or drag and drop your own image on to the button (e.g. from Konqueror).") ); rstuserbutton = new QPushButton( i18n("Unset"), picGroup ); rstuserbutton->setWhatsThis( i18n("Click this button to make KDM use the default image for the selected user.") ); connect( rstuserbutton, SIGNAL(clicked()), SLOT(slotUnsetUserPix()) ); QGridLayout *hlpl = new QGridLayout( picGroup ); hlpl->setSpacing( KDialog::spacingHint() ); hlpl->addWidget( userlabel, 0, 0 ); hlpl->addWidget( usercombo, 0, 1 ); // XXX this makes the layout too wide hlpl->addWidget( userbutton, 1, 0, 1, 2, Qt::AlignHCenter ); hlpl->addWidget( rstuserbutton, 2, 0, 1, 2, Qt::AlignHCenter ); QHBoxLayout *main = new QHBoxLayout( this ); main->setSpacing( 10 ); QVBoxLayout *lLayout = new QVBoxLayout(); main->addItem( lLayout ); lLayout->setSpacing( 10 ); lLayout->addWidget( minGroup ); lLayout->addWidget( usrGroup ); lLayout->addStretch( 1 ); QVBoxLayout *mLayout = new QVBoxLayout(); main->addItem( mLayout ); mLayout->setSpacing( 10 ); mLayout->addWidget( s_label ); mLayout->addWidget( wstack ); mLayout->setStretchFactor( wstack, 1 ); main->setStretchFactor( mLayout, 1 ); QVBoxLayout *rLayout = new QVBoxLayout(); main->addItem( rLayout ); rLayout->setSpacing( 10 ); rLayout->addWidget( faceGroup ); rLayout->addWidget( picGroup ); rLayout->addStretch( 1 ); }
ClsQGroupStateManip::ClsQGroupStateManip ( const char * _name = 0,string _strGroupID = ""): QFrame( 0, _name, Qt::WDestructiveClose), strGroupID(_strGroupID) { bApplied = false; clsQStateArrayView = NULL; iInterval = 1; iLoops = 1; iStepSize = 1; string strGroupName = ClsFESystemManager::Instance()->getGroupName(strGroupID).c_str(); string strTitle = "State Manipulation Panel for \"" + strGroupName + "\""; this->setCaption(strTitle.c_str()); QBitmap qbmEraser( eraser_cursor_width, eraser_cursor_height, eraser_cursor_bits, TRUE ); QBitmap qbmEraserMask( eraser_cursor_mask_width, eraser_cursor_mask_height, eraser_cursor_mask_bits, TRUE ); qcursorEraser = new QCursor( qbmEraser, qbmEraserMask,0 ,0 ); QBitmap qbmPencil( pencil_cursor_width, pencil_cursor_height, pencil_cursor_bits, TRUE ); QBitmap qbmPencilMask( pencil_cursor_mask_width, pencil_cursor_mask_height, pencil_cursor_mask_bits, TRUE ); qcursorPencil = new QCursor( qbmPencil, qbmPencilMask, 0, 0 ); QSplitter *qsplitter = new QSplitter(this); QFrame *qfmLeftPane = new QFrame(qsplitter); QBoxLayout * layoutMain = new QHBoxLayout( this); layoutMain->setResizeMode (QLayout::Fixed); layoutMain->addWidget(qsplitter); QBoxLayout * layoutLeftPane = new QVBoxLayout( qfmLeftPane, 5, -1, "mainL"); qlblCaption = new QLabel(qfmLeftPane); qlblCaption->setText(strGroupName.c_str()); layoutLeftPane->addWidget(qlblCaption); qfmStateArray = new QFrame(qfmLeftPane);; QHBoxLayout *qlayoutQfm = new QHBoxLayout( qfmStateArray); qlayoutQfm->setAutoAdd ( true); createStateArray(strGroupID); layoutLeftPane->addWidget(qfmStateArray, 0, Qt::AlignHCenter); qfmStateArray->show(); clsQStateArrayView->show(); clsQStateArrayView->setValue(DEFAULTVALUE); QHBoxLayout *qlayoutGradient = new QHBoxLayout( layoutLeftPane); QString qstr; QLabel* qlblMin = new QLabel(qfmLeftPane); qstr.setNum(fMinVal()); qlblMin->setText(qstr); qlayoutGradient->addWidget(qlblMin, 0, Qt::AlignRight); qlblGradientPixmap = new QLabel(qfmLeftPane);; qlayoutGradient->addWidget(qlblGradientPixmap, 1, Qt::AlignHCenter); qstr.setNum(fMaxVal()); QLabel* qlblMax = new QLabel(qfmLeftPane); qlblMax->setText(qstr); qlayoutGradient->addWidget(qlblMax); int iImgWidth = clsQStateArrayView->width() - qlblMin->minimumWidth() - qlblMax->minimumWidth() - 30; int iImgHeight = 13; qlblGradientPixmap->setFixedSize(iImgWidth,iImgHeight); qlblGradientPixmap->setPixmap(clsQStateArrayView->getGradientPixmap(iImgWidth, iImgHeight)); /* -------------------------------- */ qgrpbxTools = new QGroupBox( ); QLabel *lblValue = new QLabel(); lblValue->setText("Value:"); qdblspnbx = new QDoubleSpinBox( qgrpbxTools ); qdblspnbx->setMinimum(fMinVal()); qdblspnbx->setMaximum(fMaxVal()); qdblspnbx->setDecimals(3); qdblspnbx->setSingleStep ( 0.01); qdblspnbx->setValue(DEFAULTVALUE); connect(qdblspnbx, SIGNAL(valueChanged(double)), this, SLOT(slotChangeValue(double))); QPushButton* qpbtnPen = new QPushButton (QIcon(QPixmap(pencil)), ""); qpbtnPen->setToggleButton ( true); qpbtnPen->setFlat(true); qpbtnPen->setChecked(true); slotSelectTool(TOOL_PENCIL); QPushButton* qpbtnEraser = new QPushButton (QIcon(QPixmap(eraser)), ""); qpbtnEraser->setToggleButton ( true); qpbtnEraser->setFlat(true); QHBoxLayout *qlayoutTools = new QHBoxLayout; qlayoutTools->addWidget(lblValue); qlayoutTools->addWidget(qdblspnbx); qlayoutTools->addWidget(qpbtnPen); qlayoutTools->addWidget(qpbtnEraser); qgrpbxTools->setLayout(qlayoutTools); qbtngrpTools = new QButtonGroup(); connect(qbtngrpTools, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectTool(int))); qbtngrpTools->addButton(qpbtnPen, TOOL_PENCIL); qbtngrpTools->addButton(qpbtnEraser, TOOL_ERASER); layoutLeftPane->addWidget(qgrpbxTools); /* ------------------------------------ */ QHBoxLayout *layout2 = new QHBoxLayout( layoutLeftPane); QPushButton *qpbtnClear = new QPushButton ("Clear", qfmLeftPane); connect(qpbtnClear, SIGNAL(clicked()), this, SLOT(slotClear())); layout2->addWidget(qpbtnClear, Qt::AlignTop); QPushButton *qpbtnAdd = new QPushButton ("Add", qfmLeftPane); connect(qpbtnAdd, SIGNAL(clicked()), this, SLOT(slotAdd())); layout2->addWidget(qpbtnAdd, Qt::AlignTop); QPushButton *qpbtnReplace = new QPushButton ("Replace", qfmLeftPane); connect(qpbtnReplace, SIGNAL(clicked()), this, SLOT(slotReplace())); layout2->addWidget(qpbtnReplace, Qt::AlignTop); /* ------------------------------------ */ QGroupBox *qgrpbxMode = new QGroupBox("Mode", qfmLeftPane); QRadioButton *qrbClamp = new QRadioButton ("Clamp", qgrpbxMode ); qrbClamp->setChecked( TRUE ); slotSetMode(ClsGroupManipPattern::MODE_CLAMP); QRadioButton *qrbAddPattern = new QRadioButton ("Add", qgrpbxMode ); QRadioButton *qrbMultiplyPattern = new QRadioButton ("Multiply", qgrpbxMode ); QHBoxLayout *qlayoutMode = new QHBoxLayout; qlayoutMode->addWidget(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qlayoutMode->addWidget(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qlayoutMode->addWidget(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); qgrpbxMode->setLayout(qlayoutMode); QButtonGroup *qbtngrpMode = new QButtonGroup(); connect(qbtngrpMode, SIGNAL(buttonClicked(int)), SLOT(slotSetMode(int)) ); qbtngrpMode->addButton(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qbtngrpMode->addButton(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qbtngrpMode->addButton(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); layoutLeftPane->addWidget(qgrpbxMode); /* ------------------------------------ */ /* ------------------------------------ */ QGroupBox *qgrpbxPlayBack = new QGroupBox("Play Back", qfmLeftPane); QRadioButton *qrbPersist = new QRadioButton( "For ever" ); qrbPersist->setChecked( TRUE ); slotSetPlayback(ClsGroupManipPattern::PLAYBACK_LOOP); QRadioButton *qrbIterations = new QRadioButton( "Times"); QButtonGroup *qbtngrpPlayBack = new QButtonGroup(); connect(qbtngrpPlayBack, SIGNAL(buttonClicked(int)), SLOT(slotSetPlayback(int)) ); qbtngrpPlayBack->addButton(qrbPersist, ClsGroupManipPattern::PLAYBACK_LOOP); qbtngrpPlayBack->addButton(qrbIterations, ClsGroupManipPattern::PLAYBACK_ITERATIONS); qspnbxIterations = new QSpinBox( ); qspnbxIterations->setMinimum(1); qspnbxIterations->setMaximum(INT_MAX); qspnbxIterations->setMaximumWidth(50); connect(qspnbxIterations, SIGNAL(valueChanged(int)), this, SLOT(slotSetLoops(int))); QLabel *qlblInterval = new QLabel(); qlblInterval->setText("Interval"); qspnbxInterval = new QSpinBox( ); qspnbxInterval->setMinimum(1); qspnbxInterval->setMaximum(INT_MAX); qspnbxInterval->setMaximumWidth(50); connect(qspnbxInterval, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QLabel *qlblStepSize = new QLabel(); qlblStepSize->setText("StepSize"); qspnbxStepSize = new QSpinBox(); qspnbxStepSize->setMinimum(1); qspnbxStepSize->setMaximum(INT_MAX); qspnbxStepSize->setMaximumWidth(50); connect(qspnbxStepSize, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QGridLayout* qglayoutPlayBack = new QGridLayout (); qglayoutPlayBack->addWidget(qrbPersist, 1,1); qglayoutPlayBack->addWidget(qrbIterations, 1, 2); qglayoutPlayBack->addWidget(qspnbxIterations, 1, 3); qglayoutPlayBack->addWidget(qlblInterval, 2, 2); qglayoutPlayBack->addWidget(qspnbxInterval, 2, 3); qglayoutPlayBack->addWidget(qlblStepSize, 3,2); qglayoutPlayBack->addWidget(qspnbxStepSize, 3, 3); qgrpbxPlayBack->setLayout(qglayoutPlayBack); layoutLeftPane->addWidget(qgrpbxPlayBack); /* ------------------------------------ */ QHBoxLayout *qlayoutCmdButtons = new QHBoxLayout( layoutLeftPane, 5); QPushButton *qpbtnApply = new QPushButton ("Send", qfmLeftPane); connect(qpbtnApply, SIGNAL(clicked()), this, SLOT(slotApply())); qpbtnRevoke = new QPushButton ("Revoke", qfmLeftPane); qpbtnRevoke->setEnabled(false); connect(qpbtnRevoke, SIGNAL(clicked()), this, SLOT(slotRevoke())); QPushButton *qpbtnClose = new QPushButton ("Close", qfmLeftPane); connect(qpbtnClose, SIGNAL(clicked()), this, SLOT(close())); qlayoutCmdButtons->addWidget(qpbtnApply); qlayoutCmdButtons->addWidget(qpbtnRevoke); qlayoutCmdButtons->addWidget(qpbtnClose); QToolTip::add(qpbtnPen, "Pencil"); QToolTip::add(qpbtnEraser, "Eraser"); QToolTip::add(qpbtnClear, "Clear"); QToolTip::add(qpbtnAdd, "Add"); QToolTip::add(qrbClamp, "Repace Value"); QToolTip::add(qrbAddPattern, "Add Values"); QToolTip::add(qrbMultiplyPattern, "Mutliply with Values"); QToolTip::add(qrbPersist, "Apply for ever"); QToolTip::add(qspnbxIterations, "Apply for selected timesteps"); QToolTip::add(qspnbxInterval, "Apply every X timestep"); QToolTip::add(qspnbxStepSize, "Apply step by X"); clsQSAList = new ClsQSAList(qsplitter, this); connect(clsQSAList, SIGNAL(sigChangeMatrix(vector <vector<double> >)), this, SLOT(slotMatrixChanged(vector <vector<double> >))); clsQSAList->show(); qsplitter->setResizeMode(clsQSAList, QSplitter::FollowSizeHint); };
GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/) { m_NumericalExpression = numericalExpression; QGroupBox* pExpressionSettings = new QGroupBox; QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout; QBoxLayout* pExpressionEditLayout = new QHBoxLayout; pExpressionSettings->setFixedWidth(400); pExpressionSettings->setTitle("Expression Settings"); pExpressionSettings->setLayout(pExpressionSettingsLayout); pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0); pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0); pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout); QGroupBox* pVariableSettings = new QGroupBox; QGroupBox* pShowVariables = new QGroupBox; QBoxLayout* pShowVariablesLayout = new QVBoxLayout; QBoxLayout* pVariableSettingsLayout = new QVBoxLayout; QRadioButton* pLayoutVariablesVertically = new QRadioButton; QRadioButton* pLayoutVariablesHorizontally = new QRadioButton; QRadioButton* pLayoutVariablesGrid = new QRadioButton; pVariableSettings->setFixedWidth(400); pVariableSettings->setTitle("Variable Settings"); pVariableSettings->setLayout(pVariableSettingsLayout); pShowVariables->setTitle("Show Variables"); pShowVariables->setCheckable(true); pShowVariables->setLayout(pShowVariablesLayout); pLayoutVariablesHorizontally->setText("Layout: Horizontal"); pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally); pLayoutVariablesVertically->setText("Layout: Vertical"); pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically); pLayoutVariablesGrid->setText("Layout: Grid"); pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid); pVariableSettingsLayout->insertWidget(0, pShowVariables); QPushButton* pAcceptButton = new QPushButton; QPushButton* pCloseButton = new QPushButton; QBoxLayout* pButtonLayout = new QHBoxLayout; pAcceptButton->setText("Accept"); connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept())); pCloseButton->setText("Close"); connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close())); pButtonLayout->insertWidget(0, pAcceptButton, 1); pButtonLayout->insertWidget(1, pCloseButton, 1); QBoxLayout* pMainLayout = new QVBoxLayout; pMainLayout->setSizeConstraint(QLayout::SetFixedSize); setLayout(pMainLayout); pMainLayout->insertWidget(0, pExpressionSettings, 1); pMainLayout->insertWidget(1, pVariableSettings, 1); pMainLayout->insertLayout(2, pButtonLayout, 0); }
QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent ) : QWidget( parent ) , mMapCanvas( canvas ) , mBlockAutoApply( false ) , mCurrentLayer( nullptr ) , mVectorStyleWidget( nullptr ) { QBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins( 0, 0, 0, 0 ); this->setLayout( layout ); mAutoApplyTimer = new QTimer( this ); mAutoApplyTimer->setSingleShot( true ); connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) ); mStackedWidget = new QStackedWidget( this ); mMapStyleTabs = new QTabWidget( this ); mMapStyleTabs->setDocumentMode( true ); mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) ); mVectorPage = mStackedWidget->addWidget( mMapStyleTabs ); // create undo widget mUndoWidget = new QgsUndoWidget( this->mMapStyleTabs, mMapCanvas ); mUndoWidget->setObjectName( "Undo Styles" ); mLayerTitleLabel = new QLabel(); mLayerTitleLabel->setAlignment( Qt::AlignHCenter ); layout->addWidget( mLayerTitleLabel ); layout->addWidget( mStackedWidget ); mButtonBox = new QDialogButtonBox( QDialogButtonBox::Apply ); mLiveApplyCheck = new QCheckBox( "Live update" ); mLiveApplyCheck->setChecked( true ); mUndoButton = new QToolButton( this ); mUndoButton->setIcon( QgsApplication::getThemeIcon( "mActionUndo.png" ) ); mRedoButton = new QToolButton( this ); mRedoButton->setIcon( QgsApplication::getThemeIcon( "mActionRedo.png" ) ); connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) ); connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) ); QHBoxLayout* bottomLayout = new QHBoxLayout( ); bottomLayout->addWidget( mUndoButton ); bottomLayout->addWidget( mRedoButton ); bottomLayout->addWidget( mButtonBox ); bottomLayout->addWidget( mLiveApplyCheck ); layout->addLayout( bottomLayout ); mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, this ); mLabelingWidget->setDockMode( true ); connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); // Only labels for now but styles and diagrams will come later QScrollArea* stylescroll = new QScrollArea; stylescroll->setWidgetResizable( true ); stylescroll->setFrameStyle( QFrame::NoFrame ); QScrollArea* labelscroll = new QScrollArea; labelscroll->setWidgetResizable( true ); labelscroll->setFrameStyle( QFrame::NoFrame ); labelscroll->setWidget( mLabelingWidget ); mStyleTabIndex = mMapStyleTabs->addTab( stylescroll, QgsApplication::getThemeIcon( "propertyicons/symbology.png" ), "Styles" ); mLabelTabIndex = mMapStyleTabs->addTab( labelscroll, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "Labeling" ); mMapStyleTabs->addTab( mUndoWidget, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "History" ); // int diagramTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), "Diagrams" ); // mMapStyleTabs->setTabEnabled( styleTabIndex, false ); // mMapStyleTabs->setTabEnabled( diagramTabIndex, false ); mMapStyleTabs->setCurrentIndex( mStyleTabIndex ); connect( mMapStyleTabs, SIGNAL( currentChanged( int ) ), this, SLOT( updateCurrentWidgetLayer( int ) ) ); connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) ); connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false ); }
void ExtDatePicker::init( const ExtDate &dt ) { d = new ExtDatePickerPrivate(); d->calendar = new ExtCalendarSystemGregorian(); QBoxLayout * topLayout = new QVBoxLayout(this); d->navigationLayout = new QHBoxLayout(topLayout); d->navigationLayout->addStretch(); yearBackward = new QToolButton(this); yearBackward->setAutoRaise(true); d->navigationLayout->addWidget(yearBackward); monthBackward = new QToolButton(this); monthBackward ->setAutoRaise(true); d->navigationLayout->addWidget(monthBackward); d->navigationLayout->addSpacing(KDialog::spacingHint()); selectMonth = new QToolButton(this); selectMonth ->setAutoRaise(true); d->navigationLayout->addWidget(selectMonth); selectYear = new QToolButton(this); selectYear->setToggleButton(true); selectYear->setAutoRaise(true); d->navigationLayout->addWidget(selectYear); d->navigationLayout->addSpacing(KDialog::spacingHint()); monthForward = new QToolButton(this); monthForward ->setAutoRaise(true); d->navigationLayout->addWidget(monthForward); yearForward = new QToolButton(this); yearForward ->setAutoRaise(true); d->navigationLayout->addWidget(yearForward); d->navigationLayout->addStretch(); line = new KLineEdit(this); val = new ExtDateValidator(this); table = new ExtDateTable(this); fontsize = KGlobalSettings::generalFont().pointSize(); if (fontsize == -1) fontsize = QFontInfo(KGlobalSettings::generalFont()).pointSize(); fontsize++; // Make a little bigger d->selectWeek = new QComboBox(false, this); // read only week selection d->todayButton = new QToolButton(this); d->todayButton->setIconSet(SmallIconSet("today")); QToolTip::add(yearForward, i18n("Next year")); QToolTip::add(yearBackward, i18n("Previous year")); QToolTip::add(monthForward, i18n("Next month")); QToolTip::add(monthBackward, i18n("Previous month")); QToolTip::add(d->selectWeek, i18n("Select a week")); QToolTip::add(selectMonth, i18n("Select a month")); QToolTip::add(selectYear, i18n("Select a year")); QToolTip::add(d->todayButton, i18n("Select the current day")); // ----- setFontSize(fontsize); line->setValidator(val); line->installEventFilter( this ); if ( QApplication::reverseLayout() ) { yearForward->setIconSet(BarIconSet(QString::fromLatin1("2leftarrow"))); yearBackward->setIconSet(BarIconSet(QString::fromLatin1("2rightarrow"))); monthForward->setIconSet(BarIconSet(QString::fromLatin1("1leftarrow"))); monthBackward->setIconSet(BarIconSet(QString::fromLatin1("1rightarrow"))); } else { yearForward->setIconSet(BarIconSet(QString::fromLatin1("2rightarrow"))); yearBackward->setIconSet(BarIconSet(QString::fromLatin1("2leftarrow"))); monthForward->setIconSet(BarIconSet(QString::fromLatin1("1rightarrow"))); monthBackward->setIconSet(BarIconSet(QString::fromLatin1("1leftarrow"))); } connect(table, SIGNAL(dateChanged(const ExtDate&)), SLOT(dateChangedSlot(const ExtDate&))); connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); connect(d->selectWeek, SIGNAL(activated(int)), SLOT(weekSelected(int))); connect(d->todayButton, SIGNAL(clicked()), SLOT(todayButtonClicked())); connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(toggled(bool)), SLOT(selectYearClicked())); connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); table->setFocus(); topLayout->addWidget(table); QBoxLayout * bottomLayout = new QHBoxLayout(topLayout); bottomLayout->addWidget(d->todayButton); bottomLayout->addWidget(line); bottomLayout->addWidget(d->selectWeek); table->setDate(dt); dateChangedSlot(dt); // needed because table emits changed only when newDate != oldDate }
void ResourceSelection::initGUI() { QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); QBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing( KDialog::spacingHint() ); topLayout->addLayout( buttonLayout ); QLabel *abLabel = new QLabel( i18n( "Address Books" ), this ); buttonLayout->addWidget( abLabel ); buttonLayout->addStretch( 1 ); mAddButton = new QToolButton( this ); mAddButton->setIcon( KIcon( "list-add" ) ); mAddButton->setToolTip( i18n( "Add address book" ) ); buttonLayout->addWidget( mAddButton ); mEditButton = new QToolButton( this ); mEditButton->setIcon( KIcon( "document-properties" ) ); mEditButton->setEnabled( false ); mEditButton->setToolTip( i18n( "Edit address book settings" ) ); buttonLayout->addWidget( mEditButton ); mRemoveButton = new QToolButton( this ); mRemoveButton->setIcon( KIcon( "edit-delete" ) ); mRemoveButton->setEnabled( false ); mRemoveButton->setToolTip( i18n( "Remove address book" ) ); buttonLayout->addWidget( mRemoveButton ); mListView = new QTreeWidget( this ); mListView->setRootIsDecorated( false ); mListView->setHeaderLabel( i18n( "Address Books" ) ); mListView->header()->hide(); topLayout->addWidget( mListView ); }
LocalePage::LocalePage( QWidget* parent ) : QWidget() , m_blockTzWidgetSet( false ) { QBoxLayout* mainLayout = new QVBoxLayout; QBoxLayout* tzwLayout = new QHBoxLayout; mainLayout->addLayout( tzwLayout ); m_tzWidget = new TimeZoneWidget( this ); tzwLayout->addStretch(); tzwLayout->addWidget( m_tzWidget ); tzwLayout->addStretch(); setMinimumWidth( m_tzWidget->width() ); QBoxLayout* bottomLayout = new QHBoxLayout; mainLayout->addLayout( bottomLayout ); QLabel* cityLabel = new QLabel( tr( "Region:" ), this ); bottomLayout->addWidget( cityLabel ); m_regionCombo = new QComboBox( this ); bottomLayout->addWidget( m_regionCombo ); m_regionCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); cityLabel->setBuddy( m_regionCombo ); bottomLayout->addSpacing( 20 ); QLabel* timezoneLabel = new QLabel( tr( "Zone:" ), this ); bottomLayout->addWidget( timezoneLabel ); m_timezoneCombo = new QComboBox( this ); m_timezoneCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); bottomLayout->addWidget( m_timezoneCombo ); timezoneLabel->setBuddy( m_timezoneCombo ); mainLayout->addStretch(); setLayout( mainLayout ); connect( m_regionCombo, static_cast< void ( QComboBox::* )( const QString& ) >( &QComboBox::currentIndexChanged ), [this]( const QString& current ) { QHash< QString, QList< LocaleGlobal::Location > > regions = LocaleGlobal::getLocations(); if ( !regions.contains( current ) ) return; m_timezoneCombo->blockSignals( true ); m_timezoneCombo->clear(); QList< LocaleGlobal::Location > zones = regions.value( current ); foreach ( const LocaleGlobal::Location& zone, zones ) { m_timezoneCombo->addItem( zone.zone ); } m_timezoneCombo->model()->sort( 0 ); m_timezoneCombo->blockSignals( false ); m_timezoneCombo->currentIndexChanged( m_timezoneCombo->currentText() ); });
TupCanvas::TupCanvas(QWidget *parent, Qt::WindowFlags flags, TupGraphicsScene *scene, const QPointF centerPoint, const QSize &screenSize, TupProject *project, double scaleFactor, int angle, TupBrushManager *brushManager) : QFrame(parent, flags), k(new Private) { setWindowTitle(tr("Tupi: 2D Magic")); setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/animation_mode.png"))); k->scene = scene; k->size = project->dimension(); k->currentColor = brushManager->penColor(); k->brushManager = brushManager; k->project = project; graphicsView = new TupCanvasView(this, screenSize, k->size, project->bgColor()); graphicsView->setScene(scene); graphicsView->centerOn(centerPoint); graphicsView->scale(scaleFactor, scaleFactor); graphicsView->rotate(angle); TImageButton *pencil = new TImageButton(QPixmap(THEME_DIR + "icons/pencil_big.png"), 40, this, true); pencil->setToolTip(tr("Pencil")); connect(pencil, SIGNAL(clicked()), this, SLOT(wakeUpPencil())); TImageButton *ink = new TImageButton(QPixmap(THEME_DIR + "icons/ink_big.png"), 40, this, true); ink->setToolTip(tr("Ink")); connect(ink, SIGNAL(clicked()), this, SLOT(wakeUpInk())); /* TImageButton *polyline = new TImageButton(QPixmap(THEME_DIR + "icons/polyline_big.png"), 40, this, true); polyline->setToolTip(tr("Polyline")); connect(polyline, SIGNAL(clicked()), this, SLOT(wakeUpPolyline())); */ TImageButton *ellipse = new TImageButton(QPixmap(THEME_DIR + "icons/ellipse_big.png"), 40, this, true); ellipse->setToolTip(tr("Ellipse")); connect(ellipse, SIGNAL(clicked()), this, SLOT(wakeUpEllipse())); TImageButton *rectangle = new TImageButton(QPixmap(THEME_DIR + "icons/square_big.png"), 40, this, true); rectangle->setToolTip(tr("Rectangle")); connect(rectangle, SIGNAL(clicked()), this, SLOT(wakeUpRectangle())); TImageButton *images = new TImageButton(QPixmap(THEME_DIR + "icons/bitmap_big.png"), 40, this, true); images->setToolTip(tr("Images")); connect(images, SIGNAL(clicked()), this, SLOT(wakeUpLibrary())); TImageButton *objects = new TImageButton(QPixmap(THEME_DIR + "icons/selection_big.png"), 40, this, true); objects->setToolTip(tr("Object Selection")); connect(objects, SIGNAL(clicked()), this, SLOT(wakeUpObjectSelection())); TImageButton *nodes = new TImageButton(QPixmap(THEME_DIR + "icons/nodes_big.png"), 40, this, true); nodes->setToolTip(tr("Line Selection")); connect(nodes, SIGNAL(clicked()), this, SLOT(wakeUpNodeSelection())); TImageButton *trash = new TImageButton(QPixmap(THEME_DIR + "icons/delete_big.png"), 40, this, true); trash->setToolTip(tr("Delete Selection")); connect(trash, SIGNAL(clicked()), this, SLOT(wakeUpDeleteSelection())); TImageButton *zoomIn = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_in_big.png"), 40, this, true); zoomIn->setToolTip(tr("Zoom In")); connect(zoomIn, SIGNAL(clicked()), this, SLOT(wakeUpZoomIn())); TImageButton *zoomOut = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_out_big.png"), 40, this, true); zoomOut->setToolTip(tr("Zoom Out")); connect(zoomOut, SIGNAL(clicked()), this, SLOT(wakeUpZoomOut())); TImageButton *hand = new TImageButton(QPixmap(THEME_DIR + "icons/hand_big.png"), 40, this, true); hand->setToolTip(tr("Hand")); connect(hand, SIGNAL(clicked()), this, SLOT(wakeUpHand())); TImageButton *undo = new TImageButton(QPixmap(THEME_DIR + "icons/undo_big.png"), 40, this, true); undo->setToolTip(tr("Undo")); connect(undo, SIGNAL(clicked()), this, SLOT(undo())); TImageButton *redo = new TImageButton(QPixmap(THEME_DIR + "icons/redo_big.png"), 40, this, true); redo->setToolTip(tr("Redo")); connect(redo, SIGNAL(clicked()), this, SLOT(redo())); TImageButton *colors = new TImageButton(QPixmap(THEME_DIR + "icons/color_palette_big.png"), 40, this, true); colors->setToolTip(tr("Color Palette")); connect(colors, SIGNAL(clicked()), this, SLOT(colorDialog())); TImageButton *pen = new TImageButton(QPixmap(THEME_DIR + "icons/pen_properties.png"), 40, this, true); pen->setToolTip(tr("Pen Size")); connect(pen, SIGNAL(clicked()), this, SLOT(penDialog())); TImageButton *exposure = new TImageButton(QPixmap(THEME_DIR + "icons/exposure_sheet_big.png"), 40, this, true); exposure->setToolTip(tr("Exposure Sheet")); connect(exposure, SIGNAL(clicked()), this, SLOT(exposureDialog())); QBoxLayout *controls = new QBoxLayout(QBoxLayout::TopToBottom); controls->setAlignment(Qt::AlignHCenter | Qt::AlignTop); controls->setContentsMargins(3, 3, 3, 3); controls->setSpacing(7); controls->addWidget(pencil); controls->addWidget(ink); // controls->addWidget(polyline); controls->addWidget(ellipse); controls->addWidget(rectangle); controls->addWidget(images); controls->addWidget(objects); controls->addWidget(nodes); controls->addWidget(trash); controls->addWidget(zoomIn); controls->addWidget(zoomOut); controls->addWidget(hand); controls->addWidget(undo); controls->addWidget(redo); controls->addWidget(colors); controls->addWidget(pen); controls->addWidget(exposure); QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(2); layout->addLayout(controls); layout->addWidget(graphicsView); setLayout(layout); }
Player::Player(QWidget *parent) : QWidget(parent) , videoWidget(0) , coverLabel(0) , slider(0) , colorDialog(0) { //! [create-objs] player = new QMediaPlayer; playlist = new QMediaPlaylist(player); //! [create-objs] connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64))); connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64))); connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged())); connect(playlist, SIGNAL(playlistPositionChanged(int)), SLOT(playlistPositionChanged(int))); connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus))); connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int))); videoWidget = new VideoWidget(player); playlistModel = new PlaylistModel(this); playlistModel->setPlaylist(playlist); playlistView = new QListView; playlistView->setModel(playlistModel); playlistView->setCurrentIndex(playlistModel->index(playlist->currentPosition(), 0)); connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); slider = new QSlider(Qt::Horizontal); slider->setRange(0, player->duration() / 1000); connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int))); QPushButton *openButton = new QPushButton(tr("Open")); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); PlayerControls *controls = new PlayerControls; controls->setState(player->state()); controls->setVolume(player->volume()); controls->setMuted(controls->isMuted()); connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); connect(controls, SIGNAL(previous()), playlist, SLOT(previous())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls, SLOT(setState(QMediaPlayer::State))); connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int))); connect(player, SIGNAL(mutingChanged(bool)), controls, SLOT(setMuted(bool))); QPushButton *fullScreenButton = new QPushButton(tr("FullScreen")); fullScreenButton->setCheckable(true); if (videoWidget != 0) { connect(fullScreenButton, SIGNAL(clicked(bool)), videoWidget, SLOT(setFullScreen(bool))); connect(videoWidget, SIGNAL(fullScreenChanged(bool)), fullScreenButton, SLOT(setChecked(bool))); } else { fullScreenButton->setEnabled(false); } QPushButton *colorButton = new QPushButton(tr("Color Options...")); if (videoWidget) connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); else colorButton->setEnabled(false); QBoxLayout *displayLayout = new QHBoxLayout; if (videoWidget) displayLayout->addWidget(videoWidget, 2); else displayLayout->addWidget(coverLabel, 2); displayLayout->addWidget(playlistView); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(controls); controlLayout->addStretch(1); controlLayout->addWidget(fullScreenButton); controlLayout->addWidget(colorButton); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(displayLayout); layout->addWidget(slider); layout->addLayout(controlLayout); setLayout(layout); metaDataChanged(); }
void qt_tm_widget_rep::update_visibility () { #define XOR(exp1,exp2) (((!exp1) && (exp2)) || ((exp1) && (!exp2))) bool old_mainVisibility = mainToolBar->isVisible(); bool old_modeVisibility = modeToolBar->isVisible(); bool old_focusVisibility = focusToolBar->isVisible(); bool old_userVisibility = userToolBar->isVisible(); bool old_sideVisibility = sideTools->isVisible(); bool old_bottomVisibility = bottomTools->isVisible(); bool old_statusVisibility = mainwindow()->statusBar()->isVisible(); bool new_mainVisibility = visibility[1] && visibility[0]; bool new_modeVisibility = visibility[2] && visibility[0]; bool new_focusVisibility = visibility[3] && visibility[0]; bool new_userVisibility = visibility[4] && visibility[0]; bool new_statusVisibility = visibility[5]; bool new_sideVisibility = visibility[6]; bool new_bottomVisibility = visibility[7]; if ( XOR(old_mainVisibility, new_mainVisibility) ) mainToolBar->setVisible (new_mainVisibility); if ( XOR(old_modeVisibility, new_modeVisibility) ) modeToolBar->setVisible (new_modeVisibility); if ( XOR(old_focusVisibility, new_focusVisibility) ) focusToolBar->setVisible (new_focusVisibility); if ( XOR(old_userVisibility, new_userVisibility) ) userToolBar->setVisible (new_userVisibility); if ( XOR(old_sideVisibility, new_sideVisibility) ) sideTools->setVisible (new_sideVisibility); if ( XOR(old_bottomVisibility, new_bottomVisibility) ) bottomTools->setVisible (new_bottomVisibility); if ( XOR(old_statusVisibility, new_statusVisibility) ) mainwindow()->statusBar()->setVisible (new_statusVisibility); #ifndef Q_WS_MAC bool old_menuVisibility = mainwindow()->menuBar()->isVisible(); bool new_menuVisibility = visibility[0]; if ( XOR(old_menuVisibility, new_menuVisibility) ) mainwindow()->menuBar()->setVisible (new_menuVisibility); #endif //#if 0 #ifdef UNIFIED_TOOLBAR // do modifications only if needed to reduce flicker if ( XOR(old_mainVisibility, new_mainVisibility) || XOR(old_modeVisibility, new_modeVisibility) ) { // ensure that the topmost visible toolbar is always unified on Mac // (actually only for main and mode toolbars, unifying focus is not // appropriate) QBoxLayout *bl = qobject_cast<QBoxLayout*>(mainwindow()->centralWidget()->layout()); if (modeToolBarAction) modeToolBarAction->setVisible(modeToolBar->isVisible()); mainToolBarAction->setVisible(mainToolBar->isVisible()); //WARNING: jugglying around bugs in Qt unified toolbar implementation //do not try to change the order of the following operations.... if (mainToolBar->isVisible()) { bool tmp = modeToolBar->isVisible(); dumbToolBar->removeAction(modeToolBarAction); dumbToolBar->addAction(mainToolBarAction); bl->insertWidget(0, rulerWidget); bl->insertWidget(0, modeToolBar); mainToolBarAction->setVisible(true); rulerWidget->setVisible(true); modeToolBar->setVisible(tmp); if (modeToolBarAction) modeToolBarAction->setVisible(tmp); dumbToolBar->setVisible(true); } else { dumbToolBar->removeAction(mainToolBarAction); if (modeToolBar->isVisible()) { bl->removeWidget(rulerWidget); rulerWidget->setVisible(false); bl->removeWidget(modeToolBar); if (modeToolBarAction == NULL) { modeToolBarAction = dumbToolBar->addWidget(modeToolBar); } else { dumbToolBar->addAction(modeToolBarAction); } dumbToolBar->setVisible(true); } else { dumbToolBar->setVisible(false); dumbToolBar->removeAction(modeToolBarAction); } } } #endif // UNIFIED_TOOLBAR #undef XOR { QFont f = leftLabel->font(); int fs = as_int (get_preference ("gui:mini-fontsize", QTM_MINI_FONTSIZE)); f.setPixelSize (fs > 0 ? fs : QTM_MINI_FONTSIZE); leftLabel->setFont(f); rightLabel->setFont(f); } }
MediaWidget::MediaWidget(KMenu *menu_, KToolBar *toolBar, KActionCollection *collection, QWidget *parent) : QWidget(parent), menu(menu_), displayMode(NormalMode), automaticResize(ResizeOff), blockBackendUpdates(false), muted(false), screenSaverSuspended(false), showElapsedTime(true) { dummySource.reset(new MediaSource()); source = dummySource.data(); QBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); QPalette palette = QWidget::palette(); palette.setColor(backgroundRole(), Qt::black); setPalette(palette); setAutoFillBackground(true); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); backend = VlcMediaWidget::createVlcMediaWidget(this); if (backend == NULL) { backend = new DummyMediaWidget(this); } backend->connectToMediaWidget(this); layout->addWidget(backend); osdWidget = new OsdWidget(this); actionPrevious = new KAction(KIcon(QLatin1String("media-skip-backward")), i18n("Previous"), this); actionPrevious->setShortcut(KShortcut(Qt::Key_PageUp, Qt::Key_MediaPrevious)); connect(actionPrevious, SIGNAL(triggered()), this, SLOT(previous())); toolBar->addAction(collection->addAction(QLatin1String("controls_previous"), actionPrevious)); menu->addAction(actionPrevious); actionPlayPause = new KAction(this); actionPlayPause->setShortcut(KShortcut(Qt::Key_Space, Qt::Key_MediaPlay)); textPlay = i18n("Play"); textPause = i18n("Pause"); iconPlay = KIcon(QLatin1String("media-playback-start")); iconPause = KIcon(QLatin1String("media-playback-pause")); connect(actionPlayPause, SIGNAL(triggered(bool)), this, SLOT(pausedChanged(bool))); toolBar->addAction(collection->addAction(QLatin1String("controls_play_pause"), actionPlayPause)); menu->addAction(actionPlayPause); actionStop = new KAction(KIcon(QLatin1String("media-playback-stop")), i18n("Stop"), this); actionStop->setShortcut(KShortcut(Qt::Key_Backspace, Qt::Key_MediaStop)); connect(actionStop, SIGNAL(triggered()), this, SLOT(stop())); toolBar->addAction(collection->addAction(QLatin1String("controls_stop"), actionStop)); menu->addAction(actionStop); actionNext = new KAction(KIcon(QLatin1String("media-skip-forward")), i18n("Next"), this); actionNext->setShortcut(KShortcut(Qt::Key_PageDown, Qt::Key_MediaNext)); connect(actionNext, SIGNAL(triggered()), this, SLOT(next())); toolBar->addAction(collection->addAction(QLatin1String("controls_next"), actionNext)); menu->addAction(actionNext); menu->addSeparator(); fullScreenAction = new KAction(KIcon(QLatin1String("view-fullscreen")), i18nc("'Playback' menu", "Full Screen Mode"), this); fullScreenAction->setShortcut(Qt::Key_F); connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); menu->addAction(collection->addAction(QLatin1String("view_fullscreen"), fullScreenAction)); minimalModeAction = new KAction(KIcon(QLatin1String("view-fullscreen")), i18nc("'Playback' menu", "Minimal Mode"), this); minimalModeAction->setShortcut(Qt::Key_Period); connect(minimalModeAction, SIGNAL(triggered()), this, SLOT(toggleMinimalMode())); menu->addAction(collection->addAction(QLatin1String("view_minimal_mode"), minimalModeAction)); audioStreamBox = new KComboBox(toolBar); connect(audioStreamBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentAudioStreamChanged(int))); toolBar->addWidget(audioStreamBox); audioStreamModel = new QStringListModel(toolBar); audioStreamBox->setModel(audioStreamModel); subtitleBox = new KComboBox(toolBar); textSubtitlesOff = i18nc("subtitle selection entry", "off"); connect(subtitleBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentSubtitleChanged(int))); toolBar->addWidget(subtitleBox); subtitleModel = new QStringListModel(toolBar); subtitleBox->setModel(subtitleModel); KMenu *audioMenu = new KMenu(i18nc("'Playback' menu", "Audio"), this); KAction *action = new KAction(KIcon(QLatin1String("audio-volume-high")), i18nc("'Audio' menu", "Increase Volume"), this); action->setShortcut(KShortcut(Qt::Key_Plus, Qt::Key_VolumeUp)); connect(action, SIGNAL(triggered()), this, SLOT(increaseVolume())); audioMenu->addAction(collection->addAction(QLatin1String("controls_increase_volume"), action)); action = new KAction(KIcon(QLatin1String("audio-volume-low")), i18nc("'Audio' menu", "Decrease Volume"), this); action->setShortcut(KShortcut(Qt::Key_Minus, Qt::Key_VolumeDown)); connect(action, SIGNAL(triggered()), this, SLOT(decreaseVolume())); audioMenu->addAction(collection->addAction(QLatin1String("controls_decrease_volume"), action)); muteAction = new KAction(i18nc("'Audio' menu", "Mute Volume"), this); mutedIcon = KIcon(QLatin1String("audio-volume-muted")); unmutedIcon = KIcon(QLatin1String("audio-volume-medium")); muteAction->setIcon(unmutedIcon); muteAction->setShortcut(KShortcut(Qt::Key_M, Qt::Key_VolumeMute)); connect(muteAction, SIGNAL(triggered()), this, SLOT(mutedChanged())); toolBar->addAction(collection->addAction(QLatin1String("controls_mute_volume"), muteAction)); audioMenu->addAction(muteAction); menu->addMenu(audioMenu); KMenu *videoMenu = new KMenu(i18nc("'Playback' menu", "Video"), this); menu->addMenu(videoMenu); menu->addSeparator(); deinterlaceAction = new KAction(KIcon(QLatin1String("format-justify-center")), i18nc("'Video' menu", "Deinterlace"), this); deinterlaceAction->setCheckable(true); deinterlaceAction->setChecked( KGlobal::config()->group("MediaObject").readEntry("Deinterlace", true)); deinterlaceAction->setShortcut(Qt::Key_I); connect(deinterlaceAction, SIGNAL(toggled(bool)), this, SLOT(deinterlacingChanged(bool))); backend->setDeinterlacing(deinterlaceAction->isChecked()); videoMenu->addAction(collection->addAction(QLatin1String("controls_deinterlace"), deinterlaceAction)); KMenu *aspectMenu = new KMenu(i18nc("'Video' menu", "Aspect Ratio"), this); QActionGroup *aspectGroup = new QActionGroup(this); connect(aspectGroup, SIGNAL(triggered(QAction*)), this, SLOT(aspectRatioChanged(QAction*))); action = new KAction(i18nc("'Aspect Ratio' menu", "Automatic"), aspectGroup); action->setCheckable(true); action->setChecked(true); action->setData(AspectRatioAuto); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_auto"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "Fit to Window"), aspectGroup); action->setCheckable(true); action->setData(AspectRatioWidget); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_widget"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "4:3"), aspectGroup); action->setCheckable(true); action->setData(AspectRatio4_3); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_4_3"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "16:9"), aspectGroup); action->setCheckable(true); action->setData(AspectRatio16_9); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_16_9"), action)); // Changes aspect ratio "a la VLC" currentAspectRatio=AspectRatioAuto; action = new KAction(KIcon(QLatin1String("chainAspectRatio")), i18nc("'Aspect Ratio' menu", "Chain ratio"), this); action->setShortcut(Qt::CTRL+Qt::Key_A); connect(action, SIGNAL(triggered()), this, SLOT(chainAspectRatio())); aspectMenu->addAction(collection->addAction(QLatin1String("chainAspectRatio"), action)); // Switches scale "a la VLC" currentAspectRatio=AspectRatioAuto; action = new KAction(KIcon(QLatin1String("switchScale")), i18nc("'Aspect Ratio' menu", "Switch scale"), this); action->setShortcut(Qt::SHIFT+Qt::Key_O); connect(action, SIGNAL(triggered()), this, SLOT(switchScale())); aspectMenu->addAction(collection->addAction(QLatin1String("switchScale"), action)); videoMenu->addMenu(aspectMenu); KMenu *autoResizeMenu = new KMenu(i18n("Automatic Resize"), this); QActionGroup *autoResizeGroup = new QActionGroup(this); // we need an event even if you select the currently selected item autoResizeGroup->setExclusive(false); connect(autoResizeGroup, SIGNAL(triggered(QAction*)), this, SLOT(autoResizeTriggered(QAction*))); action = new KAction(i18nc("automatic resize", "Off"), autoResizeGroup); action->setCheckable(true); action->setData(0); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_off"), action)); action = new KAction(i18nc("automatic resize", "Original Size"), autoResizeGroup); action->setCheckable(true); action->setData(1); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_original"), action)); action = new KAction(i18nc("automatic resize", "Double Size"), autoResizeGroup); action->setCheckable(true); action->setData(2); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_double"), action)); int autoResizeFactor = KGlobal::config()->group("MediaObject").readEntry("AutoResizeFactor", 0); switch (autoResizeFactor) { case 1: automaticResize = OriginalSize; autoResizeGroup->actions().at(1)->setChecked(true); break; case 2: automaticResize = DoubleSize; autoResizeGroup->actions().at(2)->setChecked(true); break; default: automaticResize = ResizeOff; autoResizeGroup->actions().at(0)->setChecked(true); break; } videoMenu->addMenu(autoResizeMenu); action = new KAction(i18n("Volume Slider"), this); volumeSlider = new QSlider(toolBar); volumeSlider->setFocusPolicy(Qt::NoFocus); volumeSlider->setOrientation(Qt::Horizontal); volumeSlider->setRange(0, 100); volumeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); volumeSlider->setToolTip(action->text()); volumeSlider->setValue(KGlobal::config()->group("MediaObject").readEntry("Volume", 100)); connect(volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int))); backend->setVolume(volumeSlider->value()); action->setDefaultWidget(volumeSlider); toolBar->addAction(collection->addAction(QLatin1String("controls_volume_slider"), action)); jumpToPositionAction = new KAction(KIcon(QLatin1String("go-jump")), i18nc("@action:inmenu", "Jump to Position..."), this); jumpToPositionAction->setShortcut(Qt::CTRL + Qt::Key_J); connect(jumpToPositionAction, SIGNAL(triggered()), this, SLOT(jumpToPosition())); menu->addAction(collection->addAction(QLatin1String("controls_jump_to_position"), jumpToPositionAction)); navigationMenu = new KMenu(i18nc("playback menu", "Skip"), this); menu->addMenu(navigationMenu); menu->addSeparator(); int shortSkipDuration = Configuration::instance()->getShortSkipDuration(); int longSkipDuration = Configuration::instance()->getLongSkipDuration(); connect(Configuration::instance(), SIGNAL(shortSkipDurationChanged(int)), this, SLOT(shortSkipDurationChanged(int))); connect(Configuration::instance(), SIGNAL(longSkipDurationChanged(int)), this, SLOT(longSkipDurationChanged(int))); longSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")), i18nc("submenu of 'Skip'", "Skip %1s Backward", longSkipDuration), this); longSkipBackwardAction->setShortcut(Qt::SHIFT + Qt::Key_Left); connect(longSkipBackwardAction, SIGNAL(triggered()), this, SLOT(longSkipBackward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_long_skip_backward"), longSkipBackwardAction)); shortSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")), i18nc("submenu of 'Skip'", "Skip %1s Backward", shortSkipDuration), this); shortSkipBackwardAction->setShortcut(Qt::Key_Left); connect(shortSkipBackwardAction, SIGNAL(triggered()), this, SLOT(shortSkipBackward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_skip_backward"), shortSkipBackwardAction)); shortSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")), i18nc("submenu of 'Skip'", "Skip %1s Forward", shortSkipDuration), this); shortSkipForwardAction->setShortcut(Qt::Key_Right); connect(shortSkipForwardAction, SIGNAL(triggered()), this, SLOT(shortSkipForward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_skip_forward"), shortSkipForwardAction)); longSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")), i18nc("submenu of 'Skip'", "Skip %1s Forward", longSkipDuration), this); longSkipForwardAction->setShortcut(Qt::SHIFT + Qt::Key_Right); connect(longSkipForwardAction, SIGNAL(triggered()), this, SLOT(longSkipForward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_long_skip_forward"), longSkipForwardAction)); toolBar->addAction(KIcon(QLatin1String("player-time")), i18n("Seek Slider"))->setEnabled(false); action = new KAction(i18n("Seek Slider"), this); seekSlider = new SeekSlider(toolBar); seekSlider->setFocusPolicy(Qt::NoFocus); seekSlider->setOrientation(Qt::Horizontal); seekSlider->setToolTip(action->text()); connect(seekSlider, SIGNAL(valueChanged(int)), this, SLOT(seek(int))); action->setDefaultWidget(seekSlider); toolBar->addAction(collection->addAction(QLatin1String("controls_position_slider"), action)); menuAction = new KAction(KIcon(QLatin1String("media-optical-video")), i18nc("dvd navigation", "DVD Menu"), this); connect(menuAction, SIGNAL(triggered()), this, SLOT(toggleMenu())); menu->addAction(collection->addAction(QLatin1String("controls_toggle_menu"), menuAction)); titleMenu = new KMenu(i18nc("dvd navigation", "Title"), this); titleGroup = new QActionGroup(this); connect(titleGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentTitleChanged(QAction*))); menu->addMenu(titleMenu); chapterMenu = new KMenu(i18nc("dvd navigation", "Chapter"), this); chapterGroup = new QActionGroup(this); connect(chapterGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentChapterChanged(QAction*))); menu->addMenu(chapterMenu); angleMenu = new KMenu(i18nc("dvd navigation", "Angle"), this); angleGroup = new QActionGroup(this); connect(angleGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentAngleChanged(QAction*))); menu->addMenu(angleMenu); action = new KAction(i18n("Switch between elapsed and remaining time display"), this); timeButton = new QPushButton(toolBar); timeButton->setFocusPolicy(Qt::NoFocus); timeButton->setToolTip(action->text()); connect(timeButton, SIGNAL(clicked(bool)), this, SLOT(timeButtonClicked())); action->setDefaultWidget(timeButton); toolBar->addAction(collection->addAction(QLatin1String("controls_time_button"), action)); QTimer *timer = new QTimer(this); timer->start(50000); connect(timer, SIGNAL(timeout()), this, SLOT(checkScreenSaver())); }
FunkytownConfigDialog::FunkytownConfigDialog( QWidget *parent ) : QDialog( parent ) , mpProxyWidget( new ProxyWidget( this ) ) , mpLogList( new QListWidget( this ) ) , mpHelpText( new QTextBrowser( this ) ) , mpGlobalConfigWidget( new GlobalConfigWidget( this ) ) , mpOverwrite( new QCheckBox( tr("Overwrite Files During Download"), this ) ) , mpCoverArt( new QCheckBox( tr("Download Cover-Like Artwork"), this ) ) , mpTollKeep( new QCheckBox( tr("Count Downloaded Files And Bytes"), this ) ) , mpDownloadedFiles( new QLabel( this ) ) , mpDownloadedBytes( new QLabel( this ) ) , mpClearButton( new QPushButton( tr("Clear"), this ) ) { setWindowTitle( QApplication::applicationName() + ": " + tr("Settings") ); setWindowIcon( QIcon( ":/Funkytown/Icon.png" ) ); mpHelpText->setReadOnly( true ); mpHelpText->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); mpHelpText->setOpenExternalLinks( true ); mpHelpText->setSource( QUrl("qrc:/Usage.html") ); AboutWidget *about( new AboutWidget( this ) ); QPushButton *okButton( new QPushButton(tr("OK"), this) ); QPushButton *cancelButton( new QPushButton(tr("Cancel"), this) ); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget( okButton ); buttonLayout->addWidget( cancelButton ); QWidget *settingsTab = new QWidget( this ); QGridLayout *settingsLayout = new QGridLayout( settingsTab ); settingsLayout->addWidget( mpOverwrite, 0, 0, 1, 3 ); settingsLayout->addWidget( mpCoverArt, 1, 0, 1, 3 ); settingsLayout->addWidget( mpTollKeep, 2, 0, 1, 3 ); settingsLayout->addWidget( new QLabel( tr("Downloaded Files:"), this ), 3, 0 ); settingsLayout->addWidget( mpDownloadedFiles, 3, 1 ); settingsLayout->addWidget( new QLabel( tr("Downloaded Bytes:"), this ), 4, 0 ); settingsLayout->addWidget( mpDownloadedBytes, 4, 1 ); settingsLayout->addWidget( mpClearButton, 3, 2, 2, 1 ); settingsLayout->setRowStretch( 5, 1 ); QBoxLayout *mainLayout = new QVBoxLayout( this ); QTabWidget *tabs = new QTabWidget( this ); tabs->addTab( mpHelpText, tr("Help") ); tabs->addTab( settingsTab, tr("Funkytown") ); tabs->addTab( mpProxyWidget, tr("Proxy") ); tabs->addTab( mpGlobalConfigWidget, tr("Global") ); tabs->addTab( mpLogList, tr("Log") ); mainLayout->addWidget( about ); mainLayout->addWidget( tabs ); mainLayout->addLayout( buttonLayout ); setLayout( mainLayout ); connect( mpClearButton, SIGNAL(clicked()), this, SLOT(handleClear()) ); connect( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) ); connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) ); connect( this, SIGNAL(rejected()), this, SLOT(readSettings()) ); readSettings(); }
/** * This function will intialize the playlist window. */ void PlaylistWindow::init() { DEBUG_BLOCK //this function is necessary because amaroK::actionCollection() returns our actionCollection //via the App::m_pPlaylistWindow pointer since App::m_pPlaylistWindow is not defined until //the above ctor returns it causes a crash unless we do the initialisation in 2 stages. m_browsers = new BrowserBar( this ); //<Dynamic Mode Status Bar /> DynamicBar *dynamicBar = new DynamicBar( m_browsers->container()); { //<Search LineEdit> KToolBar *bar = new KToolBar( m_browsers->container(), "NotMainToolBar" ); bar->setIconSize( 22, false ); //looks more sensible bar->setFlat( true ); //removes the ugly frame bar->setMovingEnabled( false ); //removes the ugly frame QWidget *button = new KToolBarButton( "locationbar_erase", 1, bar ); QLabel *filter_label = new QLabel( i18n("S&earch:") + " ", bar ); m_lineEdit = new ClickLineEdit( i18n( "Enter search terms here" ), bar ); filter_label->setBuddy( m_lineEdit ); bar->setStretchableWidget( m_lineEdit ); m_lineEdit->setFrame( QFrame::Sunken ); m_lineEdit->installEventFilter( this ); //we intercept keyEvents connect( button, SIGNAL(clicked()), m_lineEdit, SLOT(clear()) ); QToolTip::add( button, i18n( "Clear filter" ) ); QString filtertip = i18n( "Enter space-separated terms to filter the playlist.\n\n" "Advanced, Google-esque syntax is also available;\n" "see the handbook (The Playlist section of chapter 4) for details." ); QToolTip::add( filter_label, filtertip ); QToolTip::add( m_lineEdit, filtertip ); } //</Search LineEdit> QFrame *playlist = new Playlist( m_browsers->container() ); dynamicBar->init(); m_toolbar = new amaroK::ToolBar( m_browsers->container(), "mainToolBar" ); m_toolbar->setShown( AmarokConfig::showToolbar() ); QWidget *statusbar = new amaroK::StatusBar( this ); KAction* repeatAction = amaroK::actionCollection()->action( "repeat" ); connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) ); connect( m_lineEdit, SIGNAL(textChanged( const QString& )), playlist, SLOT(setFilterSlot( const QString& )) ); m_menubar = new KMenuBar( this ); m_menubar->setShown( AmarokConfig::showMenuBar() ); //BEGIN Actions menu KPopupMenu *actionsMenu = new KPopupMenu( m_menubar ); actionCollection()->action("playlist_playmedia")->plug( actionsMenu ); actionCollection()->action("play_audiocd")->plug( actionsMenu ); actionsMenu->insertSeparator(); actionCollection()->action("prev")->plug( actionsMenu ); actionCollection()->action("play_pause")->plug( actionsMenu ); actionCollection()->action("stop")->plug( actionsMenu ); actionCollection()->action("next")->plug( actionsMenu ); actionsMenu->insertSeparator(); actionCollection()->action(KStdAction::name(KStdAction::Quit))->plug( actionsMenu ); connect( actionsMenu, SIGNAL( aboutToShow() ), SLOT( actionsMenuAboutToShow() ) ); //END Actions menu //BEGIN Playlist menu KPopupMenu *playlistMenu = new KPopupMenu( m_menubar ); actionCollection()->action("playlist_add")->plug( playlistMenu ); actionCollection()->action("playlist_save")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("playlist_undo")->plug( playlistMenu ); actionCollection()->action("playlist_redo")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("playlist_clear")->plug( playlistMenu ); actionCollection()->action("playlist_shuffle")->plug( playlistMenu ); actionCollection()->action("playlist_show")->plug( playlistMenu ); //this one has no real context with regard to the menu //actionCollection()->action("playlist_copy")->plug( playlistMenu ); playlistMenu->insertSeparator(); actionCollection()->action("queue_selected")->plug( playlistMenu ); actionCollection()->action("playlist_remove_duplicates")->plug( playlistMenu ); actionCollection()->action("playlist_select_all")->plug( playlistMenu ); //END Playlist menu //BEGIN Mode menu KPopupMenu *modeMenu = new KPopupMenu( m_menubar ); actionCollection()->action("repeat")->plug( modeMenu ); KSelectAction *random = static_cast<KSelectAction*>( actionCollection()->action("random_mode") ); random->plug( modeMenu ); random->popupMenu()->insertSeparator(); actionCollection()->action("favor_tracks")->plug( random->popupMenu() ); //END Mode menu //BEGIN Tools menu m_toolsMenu = new KPopupMenu( m_menubar ); m_toolsMenu->insertItem( SmallIconSet( "covermanager" ), i18n("&Cover Manager"), amaroK::Menu::ID_SHOW_COVER_MANAGER ); actionCollection()->action("queue_manager")->plug( m_toolsMenu ); m_toolsMenu->insertItem( SmallIconSet( "visualizations"), i18n("&Visualizations"), amaroK::Menu::ID_SHOW_VIS_SELECTOR ); m_toolsMenu->insertItem( SmallIconSet( "equalizer"), i18n("&Equalizer"), kapp, SLOT( slotConfigEqualizer() ), 0, amaroK::Menu::ID_CONFIGURE_EQUALIZER ); actionCollection()->action("script_manager")->plug( m_toolsMenu ); actionCollection()->action("statistics")->plug( m_toolsMenu ); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem( SmallIconSet( "wizard"), i18n("&First-Run Wizard"), amaroK::Menu::ID_SHOW_WIZARD ); m_toolsMenu->insertItem( SmallIconSet( amaroK::icon( "rescan" ) ), i18n("&Rescan Collection"), amaroK::Menu::ID_RESCAN_COLLECTION ); #if defined HAVE_XMMS || defined HAVE_LIBVISUAL m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, true ); #else m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, false ); #endif connect( m_toolsMenu, SIGNAL( aboutToShow() ), SLOT( toolsMenuAboutToShow() ) ); connect( m_toolsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) ); //END Tools menu //BEGIN Settings menu m_settingsMenu = new KPopupMenu( m_menubar ); //TODO use KStdAction or KMainWindow static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->setChecked( AmarokConfig::showMenuBar() ); actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar))->plug( m_settingsMenu ); m_settingsMenu->insertItem( AmarokConfig::showToolbar() ? i18n( "Hide Toolbar" ) : i18n("Show Toolbar"), ID_SHOW_TOOLBAR ); m_settingsMenu->insertItem( AmarokConfig::showPlayerWindow() ? i18n("Hide Player &Window") : i18n("Show Player &Window"), ID_SHOW_PLAYERWINDOW ); m_settingsMenu->insertSeparator(); actionCollection()->action("options_configure_globals")->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::KeyBindings))->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::ConfigureToolbars))->plug( m_settingsMenu ); actionCollection()->action(KStdAction::name(KStdAction::Preferences))->plug( m_settingsMenu ); connect( m_settingsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) ); //END Settings menu m_menubar->insertItem( i18n( "&Actions" ), actionsMenu ); m_menubar->insertItem( i18n( "&Playlist" ), playlistMenu ); m_menubar->insertItem( i18n( "&Mode" ), modeMenu ); m_menubar->insertItem( i18n( "&Tools" ), m_toolsMenu ); m_menubar->insertItem( i18n( "&Settings" ), m_settingsMenu ); m_menubar->insertItem( i18n( "&Help" ), amaroK::Menu::helpMenu() ); QBoxLayout *layV = new QVBoxLayout( this ); layV->addWidget( m_menubar ); layV->addWidget( m_browsers, 1 ); layV->addWidget( m_toolbar ); layV->addSpacing( 2 ); layV->addWidget( statusbar ); //The volume slider later becomes our FocusProxy, so all wheelEvents get redirected to it m_toolbar->setFocusPolicy( QWidget::WheelFocus ); m_toolbar->setFlat( true ); m_toolbar->setMovingEnabled( false ); playlist->setMargin( 2 ); playlist->installEventFilter( this ); //we intercept keyEvents //<XMLGUI> { QString xmlFile = amaroK::config()->readEntry( "XMLFile", "amarokui.rc" ); if ( xmlFile == "amarokui_first.rc" ) // this bug can bite you if you are a pre 1.2 user, we // deleted amarokui_first.rc, but we must still support it xmlFile = "amarokui.rc"; setXMLFile( xmlFile ); createGUI(); //NOTE we implement this } //</XMLGUI> //<Browsers> { Debug::Block block( "Creating browsers. Please report long start times!" ); #define addBrowserMacro( Type, name, text, icon ) { \ Debug::Block block( name ); \ m_browsers->addBrowser( new Type( name ), text, icon ); } #define addInstBrowserMacro( Type, name, text, icon ) { \ Debug::Block block( name ); \ m_browsers->addBrowser( Type::instance(), text, icon ); } addBrowserMacro( ContextBrowser, "ContextBrowser", i18n( "Context" ), amaroK::icon( "info" ) ) addBrowserMacro( CollectionBrowser, "CollectionBrowser", i18n( "Collection" ), amaroK::icon( "collection" ) ) addInstBrowserMacro( PlaylistBrowser, "PlaylistBrowser", i18n( "Playlists" ), amaroK::icon( "playlist" ) ) //DEBUG: Comment out the addBrowserMacro line and uncomment the m_browsers line (passing in a vfat device name) to see the "virtual root" functionality addBrowserMacro( FileBrowser, "FileBrowser", i18n( "Files" ), "folder" ) //m_browsers->addBrowser( new FileBrowser( "FileBrowser", DeviceManager::instance()->getDevice( "hda5" ) ), i18n( "Files" ), "folder" ); new MediaBrowser( "MediaBrowser" ); if( MediaBrowser::isAvailable() ) addInstBrowserMacro( MediaBrowser, "MediaBrowser", i18n( "Media Device" ), amaroK::icon( "device" ) ) #undef addBrowserMacro #undef addInstBrowserMacro } //</Browsers> connect( Playlist::instance()->qscrollview(), SIGNAL( dynamicModeChanged( const DynamicMode* ) ), PlaylistBrowser::instance(), SLOT( loadDynamicItems() ) ); qApp->installEventFilter( this ); // keyboards shortcuts for the browsers connect( playlist, SIGNAL( itemCountChanged( int, int, int, int, int, int ) ), statusbar, SLOT( slotItemCountChanged( int, int, int, int, int, int ) ) ); connect( playlist, SIGNAL( queueChanged( const PLItemList &, const PLItemList & ) ), statusbar, SLOT( updateQueueLabel() ) ); connect( playlist, SIGNAL( aboutToClear() ), m_lineEdit, SLOT( clear() ) ); amaroK::MessageQueue::instance()->sendMessages(); }
KOEditorFreeBusy::KOEditorFreeBusy( int spacing, QWidget *parent, const char *name ) : KOAttendeeEditor( parent, name ) { QVBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( spacing ); initOrganizerWidgets( this, topLayout ); // Label for status summary information // Uses the tooltip palette to highlight it mIsOrganizer = false; // Will be set later. This is just valgrind silencing mStatusSummaryLabel = new QLabel( this ); mStatusSummaryLabel->setPalette( QToolTip::palette() ); mStatusSummaryLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); mStatusSummaryLabel->setLineWidth( 1 ); mStatusSummaryLabel->hide(); // Will be unhidden later if you are organizer topLayout->addWidget( mStatusSummaryLabel ); // The control panel for the gantt widget QBoxLayout *controlLayout = new QHBoxLayout( topLayout ); QString whatsThis = i18n("Sets the zoom level on the Gantt chart. " "'Hour' shows a range of several hours, " "'Day' shows a range of a few days, " "'Week' shows a range of a few months, " "and 'Month' shows a range of a few years, " "while 'Automatic' selects the range most " "appropriate for the current event or to-do."); QLabel *label = new QLabel( i18n( "Scale: " ), this ); QWhatsThis::add( label, whatsThis ); controlLayout->addWidget( label ); scaleCombo = new QComboBox( this ); QWhatsThis::add( scaleCombo, whatsThis ); scaleCombo->insertItem( i18n( "Hour" ) ); scaleCombo->insertItem( i18n( "Day" ) ); scaleCombo->insertItem( i18n( "Week" ) ); scaleCombo->insertItem( i18n( "Month" ) ); scaleCombo->insertItem( i18n( "Automatic" ) ); scaleCombo->setCurrentItem( 0 ); // start with "hour" connect( scaleCombo, SIGNAL( activated( int ) ), SLOT( slotScaleChanged( int ) ) ); controlLayout->addWidget( scaleCombo ); QPushButton *button = new QPushButton( i18n( "Center on Start" ), this ); QWhatsThis::add( button, i18n("Centers the Gantt chart on the start time " "and day of this event.") ); connect( button, SIGNAL( clicked() ), SLOT( slotCenterOnStart() ) ); controlLayout->addWidget( button ); button = new QPushButton( i18n( "Zoom to Fit" ), this ); QWhatsThis::add( button, i18n("Zooms the Gantt chart so that you can see the " "entire duration of the event on it.") ); connect( button, SIGNAL( clicked() ), SLOT( slotZoomToTime() ) ); controlLayout->addWidget( button ); controlLayout->addStretch( 1 ); button = new QPushButton( i18n( "Pick Date" ), this ); QWhatsThis::add( button, i18n("Moves the event to a date and time when all the " "attendees are free.") ); connect( button, SIGNAL( clicked() ), SLOT( slotPickDate() ) ); controlLayout->addWidget( button ); controlLayout->addStretch( 1 ); button = new QPushButton( i18n("Reload"), this ); QWhatsThis::add( button, i18n("Reloads Free/Busy data for all attendees from " "the corresponding servers.") ); controlLayout->addWidget( button ); connect( button, SIGNAL( clicked() ), SLOT( manualReload() ) ); mGanttView = new KDGanttView( this, "mGanttView" ); QWhatsThis::add( mGanttView, i18n("Shows the free/busy status of all attendees. " "Double-clicking on an attendees entry in the " "list will allow you to enter the location of their " "Free/Busy Information.") ); topLayout->addWidget( mGanttView ); // Remove the predefined "Task Name" column mGanttView->removeColumn( 0 ); mGanttView->addColumn( i18n("Attendee") ); if ( KOPrefs::instance()->mCompactDialogs ) { mGanttView->setFixedHeight( 78 ); } mGanttView->setHeaderVisible( true ); mGanttView->setScale( KDGanttView::Hour ); mGanttView->setShowHeaderPopupMenu( true, true, true, false, false, true ); // Initially, show 15 days back and forth // set start to even hours, i.e. to 12:AM 0 Min 0 Sec QDateTime horizonStart = QDateTime( QDateTime::currentDateTime() .addDays( -15 ).date() ); QDateTime horizonEnd = QDateTime::currentDateTime().addDays( 15 ); mGanttView->setHorizonStart( horizonStart ); mGanttView->setHorizonEnd( horizonEnd ); mGanttView->setCalendarMode( true ); //mGanttView->setDisplaySubitemsAsGroup( true ); mGanttView->setShowLegendButton( false ); // Initially, center to current date mGanttView->centerTimelineAfterShow( QDateTime::currentDateTime() ); if ( KGlobal::locale()->use12Clock() ) mGanttView->setHourFormat( KDGanttView::Hour_12 ); else mGanttView->setHourFormat( KDGanttView::Hour_24_FourDigit ); // mEventRectangle is the colored rectangle representing the event being modified mEventRectangle = new KDIntervalColorRectangle( mGanttView ); mEventRectangle->setColor( Qt::magenta ); mGanttView->addIntervalBackgroundColor( mEventRectangle ); connect( mGanttView, SIGNAL ( timeIntervalSelected( const QDateTime &, const QDateTime & ) ), mGanttView, SLOT( zoomToSelection( const QDateTime &, const QDateTime & ) ) ); connect( mGanttView, SIGNAL( lvItemDoubleClicked( KDGanttViewItem * ) ), SLOT( editFreeBusyUrl( KDGanttViewItem * ) ) ); connect( mGanttView, SIGNAL( intervalColorRectangleMoved( const QDateTime&, const QDateTime& ) ), this, SLOT( slotIntervalColorRectangleMoved( const QDateTime&, const QDateTime& ) ) ); connect( mGanttView, SIGNAL(lvSelectionChanged(KDGanttViewItem*)), this, SLOT(updateAttendeeInput()) ); connect( mGanttView, SIGNAL(lvItemLeftClicked(KDGanttViewItem*)), this, SLOT(showAttendeeStatusMenu()) ); connect( mGanttView, SIGNAL(lvItemRightClicked(KDGanttViewItem*)), this, SLOT(showAttendeeStatusMenu()) ); connect( mGanttView, SIGNAL(lvMouseButtonClicked(int, KDGanttViewItem*, const QPoint&, int)), this, SLOT(listViewClicked(int, KDGanttViewItem*)) ); FreeBusyManager *m = KOGroupware::instance()->freeBusyManager(); connect( m, SIGNAL( freeBusyRetrieved( KCal::FreeBusy *, const QString & ) ), SLOT( slotInsertFreeBusy( KCal::FreeBusy *, const QString & ) ) ); connect( &mReloadTimer, SIGNAL( timeout() ), SLOT( autoReload() ) ); initEditWidgets( this, topLayout ); connect( mRemoveButton, SIGNAL(clicked()), SLOT(removeAttendee()) ); }
GDBOutputWidget::GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent) : QWidget(parent), m_userGDBCmdEditor(0), m_Interrupt(0), m_gdbView(0), showInternalCommands_(false), maxLines_(5000) { setWindowIcon(QIcon::fromTheme("dialog-scripts", windowIcon())); setWindowTitle(i18n("GDB Output")); setWhatsThis(i18n("<b>GDB output</b><p>" "Shows all gdb commands being executed. " "You can also issue any other gdb command while debugging.</p>")); m_gdbView = new OutputTextEdit(this); m_gdbView->setReadOnly(true); m_userGDBCmdEditor = new KHistoryComboBox (this); QLabel *label = new QLabel(i18n("&GDB cmd:"), this); label->setBuddy(m_userGDBCmdEditor); m_Interrupt = new QToolButton( this ); m_Interrupt->setIcon ( QIcon::fromTheme( "media-playback-pause" ) ); m_Interrupt->setToolTip( i18n ( "Pause execution of the app to enter gdb commands" ) ); QVBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(m_gdbView); topLayout->setStretchFactor(m_gdbView, 1); topLayout->setMargin(0); QBoxLayout *userGDBCmdEntry = new QHBoxLayout(); userGDBCmdEntry->addWidget(label); userGDBCmdEntry->addWidget(m_userGDBCmdEditor); userGDBCmdEntry->setStretchFactor(m_userGDBCmdEditor, 1); userGDBCmdEntry->addWidget(m_Interrupt); topLayout->addLayout(userGDBCmdEntry); setLayout(topLayout); slotStateChanged(s_none, s_dbgNotStarted); connect(m_userGDBCmdEditor, static_cast<void(KHistoryComboBox::*)()>(&KHistoryComboBox::returnPressed), this, &GDBOutputWidget::slotGDBCmd); connect(m_Interrupt, &QToolButton::clicked, this, &GDBOutputWidget::breakInto); updateTimer_.setSingleShot(true); connect(&updateTimer_, &QTimer::timeout, this, &GDBOutputWidget::flushPending); connect(KDevelop::ICore::self()->debugController(), &KDevelop::IDebugController::currentSessionChanged, this, &GDBOutputWidget::currentSessionChanged); connect(plugin, &CppDebuggerPlugin::reset, this, &GDBOutputWidget::clear); connect(plugin, &CppDebuggerPlugin::raiseGdbConsoleViews, this, &GDBOutputWidget::requestRaise); currentSessionChanged(KDevelop::ICore::self()->debugController()->currentSession()); // TODO Port to KF5 // connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), // this, SLOT(updateColors())); updateColors(); }
void TupInfoWidget::setUIContext() { k->table = new QTableWidget(k->currencyList.count() - 1, 2); k->table->setSelectionMode(QAbstractItemView::SingleSelection); k->table->horizontalHeader()->hide(); k->table->verticalHeader()->hide(); k->table->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); k->table->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); k->table->setMaximumWidth(250); k->table->setMaximumHeight((k->currencyList.count() - 1)*30); // k->table->verticalHeader()->setResizeMode(QHeaderView::Stretch); // k->table->horizontalHeader()->setResizeMode(QHeaderView::Stretch); k->table->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); k->table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); QBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setContentsMargins(1, 1, 1, 1); mainLayout->setSpacing(5); QLabel *titleLabel = new QLabel(tr("Currency Converter")); QFont font = this->font(); font.setPointSize(12); font.setBold(true); titleLabel->setFont(font); // titleLabel->setFont(QFont("Arial", 12, QFont::Bold, false)); titleLabel->setAlignment(Qt::AlignHCenter); QLabel *currencyLabel = new QLabel(tr("Currency")); QComboBox *currency = new QComboBox(); for (int i=0; i<k->currencyList.count(); i++) currency->addItem(tr("%1").arg(k->currencyList.at(i))); connect(currency, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentCurrency(int))); currency->setCurrentIndex(k->currencyList.indexOf("USD")); currencyLabel->setBuddy(currency); QHBoxLayout *currencyLayout = new QHBoxLayout; currencyLayout->addWidget(currencyLabel); currencyLayout->addWidget(currency); QLabel *sourceLabel = new QLabel(tr("Source")); QLineEdit *source = new QLineEdit("http://www.webservicex.net"); updateMoneyTable(); QHBoxLayout *sourceLayout = new QHBoxLayout; sourceLayout->addWidget(sourceLabel); sourceLayout->addWidget(source); QLabel *checkerLabel = new QLabel(tr("Update data every")); QComboBox *minutesCombo = new QComboBox(); minutesCombo->addItem(tr("1") + " " + tr("minute")); for (int i=5; i< 20; i+=5) minutesCombo->addItem(tr("%1").arg(i) + " " + tr("minutes")); QHBoxLayout *checkerLayout = new QHBoxLayout; checkerLayout->addWidget(checkerLabel); checkerLayout->addWidget(minutesCombo); mainLayout->addWidget(titleLabel); mainLayout->addLayout(currencyLayout); mainLayout->addLayout(sourceLayout); mainLayout->addWidget(k->table); mainLayout->addLayout(checkerLayout); k->innerLayout->addLayout(mainLayout); getDataFromNet(); }
WPInfoWidget::WPInfoWidget( QWidget *parent ) : QWidget(parent) { setObjectName("WPInfoWidget"); setWindowTitle( tr("Point Info") ); setWindowFlags( Qt::Tool ); setWindowModality( Qt::WindowModal ); setAttribute(Qt::WA_DeleteOnClose); m_returnView = MainWindow::mapView; m_homeChanged = false; m_editedWpIsTarget = false; if( parent ) { resize( parent->size() ); } QFont bfont = font(); bfont.setBold(true); QBoxLayout *topLayout = new QVBoxLayout(this); text = new QTextEdit(this); text->setReadOnly( true ); #ifdef QSCROLLER QScroller::grabGesture( text->viewport(), QScroller::LeftMouseButtonGesture ); #endif #ifdef QTSCROLLER QtScroller::grabGesture( text->viewport(), QtScroller::LeftMouseButtonGesture ); #endif topLayout->addWidget(text, 10); buttonrow2 = new QHBoxLayout; topLayout->addLayout(buttonrow2); cmdAddWaypoint = new QPushButton(tr("Add Waypoint"), this); cmdAddWaypoint->setFont(bfont); buttonrow2->addWidget(cmdAddWaypoint); connect(cmdAddWaypoint, SIGNAL(clicked()), SLOT(slot_addAsWaypoint())); cmdHome = new QPushButton(tr("Home"), this); cmdHome->setFont(bfont); buttonrow2->addWidget(cmdHome); connect(cmdHome, SIGNAL(clicked()), SLOT(slot_setNewHome())); cmdArrival = new QPushButton(tr("Arrival"), this); cmdArrival->setFont(bfont); buttonrow2->addWidget(cmdArrival); connect(cmdArrival, SIGNAL(clicked()), SLOT(slot_arrival())); cmdEdit = new QPushButton(tr("Edit"), this); cmdEdit->setFont(bfont); buttonrow2->addWidget(cmdEdit); connect(cmdEdit, SIGNAL(clicked()), SLOT(slot_edit())); cmdDelete = new QPushButton(tr("Delete"), this); cmdDelete->setFont(bfont); buttonrow2->addWidget(cmdDelete); connect(cmdDelete, SIGNAL(clicked()), SLOT(slot_delete())); buttonrow1=new QHBoxLayout; topLayout->addLayout(buttonrow1); cmdClose = new QPushButton(tr("Close"), this); cmdClose->setFont(bfont); buttonrow1->addWidget(cmdClose); connect(cmdClose, SIGNAL(clicked()), SLOT(slot_SwitchBack())); // Activate keyboard shortcut cancel to close the window too scClose = new QShortcut( this ); #ifndef ANDROID scClose->setKey( Qt::Key_Escape ); connect( scClose, SIGNAL(activated()), SLOT( slot_SwitchBack() )); #endif cmdKeep = new QPushButton(tr("Stop"), this); cmdKeep->setFont(bfont); buttonrow1->addWidget(cmdKeep); connect(cmdKeep, SIGNAL(clicked()), SLOT(slot_KeepOpen())); cmdUnselectWaypoint = new QPushButton(tr("Unselect"), this); cmdUnselectWaypoint->setFont(bfont); buttonrow1->addWidget(cmdUnselectWaypoint); connect(cmdUnselectWaypoint, SIGNAL(clicked()), SLOT(slot_unselectWaypoint())); cmdSelectWaypoint = new QPushButton(tr("Select"), this); cmdSelectWaypoint->setFont(bfont); buttonrow1->addWidget(cmdSelectWaypoint); connect(cmdSelectWaypoint, SIGNAL(clicked()), SLOT(slot_selectWaypoint())); m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), SLOT(slot_timeout())); }
SalesOrderManager::SalesOrderManager(QWidget* parent) : QSplitter(parent) { model = new SalesOrderModel(this); proxyModel = new SalesOrderProxyModel(this); proxyModel->setSourceModel(model); QWidget* container = new QWidget(this); QBoxLayout* containerLayout = new QVBoxLayout(container); containerLayout->setMargin(0); QString actionTooltip("%1<br><b>%2</b>"); QToolBar* toolBar = new QToolBar(container); toolBar->setIconSize(QSize(16, 16)); QAction* refreshAction = toolBar->addAction(QIcon(":/resources/icons/refresh.png"), "&Muat Ulang", this, SLOT(refresh())); refreshAction->setShortcut(QKeySequence("F5")); refreshAction->setToolTip(actionTooltip.arg("Muat ulang daftar pesanan").arg(refreshAction->shortcut().toString())); QAction* newAction = toolBar->addAction(QIcon(":/resources/icons/plus.png"), "&Baru", this, SLOT(openEditor())); newAction->setShortcut(QKeySequence("Ctrl+N")); newAction->setToolTip(actionTooltip.arg("Pesanan baru").arg(newAction->shortcut().toString())); QAction* closeTabAction = new QAction(this); closeTabAction->setShortcuts(QList<QKeySequence>({QKeySequence("Esc"), QKeySequence("Ctrl+W")})); addAction(closeTabAction); QAction* closeAllTabsAction = new QAction(this); closeAllTabsAction->setShortcut(QKeySequence("Ctrl+Shift+W")); addAction(closeAllTabsAction); containerLayout->addWidget(toolBar); QLabel* spacer = new QLabel(toolBar); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); toolBar->addWidget(spacer); stateComboBox = new QComboBox(toolBar); stateComboBox->setToolTip("Saring daftar pesanan berdasarkan status"); stateComboBox->addItem("Semua"); stateComboBox->addItem("Aktif"); stateComboBox->addItem("Selesai"); stateComboBox->addItem("Dibatalkan"); stateComboBox->setCurrentIndex(1); toolBar->addWidget(stateComboBox); searchEdit = new QLineEdit(toolBar); searchEdit->setToolTip("Cari di daftar pesanan"); searchEdit->setPlaceholderText("Cari"); searchEdit->setClearButtonEnabled(true); searchEdit->setMaxLength(100); searchEdit->setMaximumWidth(150); toolBar->addWidget(searchEdit); view = new QTableView(container); view->setToolTip("Klik ganda atau ketuk Enter untuk membuka pesanan"); view->setModel(proxyModel); view->setAlternatingRowColors(true); view->setSortingEnabled(true); view->setSelectionMode(QAbstractItemView::SingleSelection); view->setSelectionBehavior(QAbstractItemView::SelectRows); view->setTabKeyNavigation(false); QHeaderView* header = view->verticalHeader(); header->setVisible(false); header->setMinimumSectionSize(20); header->setMaximumSectionSize(20); header->setDefaultSectionSize(20); header = view->horizontalHeader(); header->setToolTip("Klik pada header kolom untuk mengurutkan"); header->setHighlightSections(false); containerLayout->addWidget(view); infoLabel = new QLabel(container); infoLabel->setStyleSheet("font-style:italic;padding-bottom:1px;"); infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); containerLayout->addWidget(infoLabel); tabWidget = new QTabWidget(this); tabWidget->setDocumentMode(true); tabWidget->setTabsClosable(true); tabWidget->setMovable(true); tabWidget->hide(); setCollapsible(0, false); setCollapsible(1, false); connect(closeTabAction, SIGNAL(triggered(bool)), SLOT(closeCurrentTab())); connect(closeAllTabsAction, SIGNAL(triggered(bool)), SLOT(closeAllTabs())); connect(tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int))); connect(stateComboBox, SIGNAL(currentIndexChanged(int)), SLOT(refresh())); connect(searchEdit, SIGNAL(textChanged(QString)), SLOT(applyFilter())); connect(view, SIGNAL(activated(QModelIndex)), SLOT(edit())); QTimer::singleShot(0, this, SLOT(init())); }
// +----------------------------------------------------------- bool gc::Questionnaire::addQuestion(const QuestionType eType, uint iOptions) { Q_ASSERT(!(eType == Likert && iOptions == 0)); QWidget *pField = NULL; switch(eType) { case Integer: pField = new QSpinBox(this); static_cast<QSpinBox*>(pField)->setButtonSymbols(QAbstractSpinBox::NoButtons); pField->setCursor(Qt::PointingHandCursor); connect(static_cast<QSpinBox*>(pField), static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_pMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map)); break; case String: pField = new QLineEdit(this); connect(static_cast<QLineEdit*>(pField), &QLineEdit::editingFinished, m_pMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map)); break; case Likert: pField = new LikertScale(iOptions, this); connect(static_cast<LikertScale*>(pField), &LikertScale::selectionChanged, m_pMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map)); break; default: return false; } // Create the row area QWidget *pQuestionBg = new QWidget(this); pQuestionBg->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_pQuestionsArea->layout()->addWidget(pQuestionBg); QBoxLayout *pQuestionLayout = new QVBoxLayout(pQuestionBg); pQuestionLayout->setAlignment(Qt::AlignLeft); // Create the question label QLabel *pLabel = new QLabel(this); pLabel->setObjectName("questionnaireQuestion"); pLabel->setProperty("undefined", true); pLabel->style()->unpolish(pLabel); pLabel->style()->polish(pLabel); pQuestionLayout->addWidget(pLabel); // Create the question field QHBoxLayout *pFieldLayout = new QHBoxLayout(); pFieldLayout->setAlignment(Qt::AlignLeft); pQuestionLayout->addLayout(pFieldLayout); pFieldLayout->addSpacing(40); pFieldLayout->addWidget(pField); // Save the question created m_vQuestionTypes.push_back(eType); m_vQuestionLabels.push_back(pLabel); m_vQuestionFields.push_back(pField); if(m_vQuestionTypes.size() % 2) pQuestionBg->setObjectName("highlightedRow"); // Connections m_pMapper->setMapping(pField, m_vQuestionFields.length() - 1); return true; }