//------------------------------------------------------------------------------ void CaptureForm::initGui(const QtSerializerWrapper &writer) { setWindowTitle(tr("Recap - Capture Mode")); setGeometry(0, 0, 400, 300); QGridLayout* gl = new QGridLayout(this); QHBoxLayout* line1 = new QHBoxLayout(this); QHBoxLayout* line2 = new QHBoxLayout(this); // Title QLabel* titleLabel = new QLabel(tr("&Title")); line1->addWidget(titleLabel); m_titleEdit = new QLineEdit; line1->addWidget(m_titleEdit); titleLabel->setBuddy(m_titleEdit); gl->addLayout(line1, 0, 0, 1, 4); // Tags QLabel* tagsLabel = new QLabel(tr("T&ags")); line2->addWidget(tagsLabel); line2->addWidget((m_tagsEdit = new TagLineEdit(writer.tags()))); tagsLabel->setBuddy(m_tagsEdit); line2->addWidget((m_tagsBox = new QComboBox)); m_tagsBox->addItems(writer.tags()); gl->addLayout(line2, 1, 0, 1, 4); // Content QLabel* contentLabel = new QLabel(tr("&Notes")); gl->addWidget(contentLabel, 3, 0); gl->addWidget((m_contentEdit = new QPlainTextEdit), 4, 0, 4, 4); contentLabel->setBuddy(m_contentEdit); m_contentEdit->setTabStopWidth(8); m_contentEdit->setWhatsThis(tr("Pasted notes can be formatted (html and rich text are both supported). " "Bullet points can be added by entering the '*' or '-' characters.")); // Encrypt m_encryptCheckBox = new QCheckBox(tr("&Encrypt"), this); m_encryptCheckBox->setToolTip(tr("The notes of the item will be encrypted.")); gl->addWidget(m_encryptCheckBox, 8, 0); m_encryptCheckBox->setVisible(false); m_encryptCheckBox->setEnabled(false); // OK/Cancel gl->addWidget((m_okButton = new QPushButton(tr("&Save"))), 8, 2); gl->addWidget((m_cancelButton = new QPushButton(tr("&Cancel"))), 8, 3); m_okButton->setIcon(QCommonStyle().standardIcon(QCommonStyle::SP_DialogOkButton)); m_cancelButton->setIcon(QCommonStyle().standardIcon(QCommonStyle::SP_DialogCancelButton)); }
void UiTools::moveWindowToScreenCenter(QWidget *dialog) { QRect availableScreen = QApplication::desktop()->availableGeometry(); int titleSize = QCommonStyle().pixelMetric(QStyle::PM_TitleBarHeight); dialog->move(availableScreen.width()/2 - dialog->width()/2, (availableScreen.height() - titleSize)/2 - dialog->height()/2); }
ControlWidget::ControlWidget( Database *database, PartymanConfigDialog *config, PartymanMainWindow *parent ) : QWidget( parent ) , mpConfig( config ) , mpPlaylist( parent ) , mpSatellite( Satellite::get() ) , mpGenericSatelliteHandler( 0 ) , mPartymanIcon( QIcon( ":/Partyman/Icon.png" ) ) , mStopIcon( QCommonStyle().standardIcon(QStyle::SP_MediaStop) /*QIcon(":/Stop.png")*/ ) , mPlayIcon( QCommonStyle().standardIcon(QStyle::SP_MediaPlay) /*QIcon(":/Play.png")*/ ) , mPauseIcon( QCommonStyle().standardIcon(QStyle::SP_MediaPause) /*QIcon(":/Pause.png")*/ ) , mSkipIcon( QCommonStyle().standardIcon(QStyle::SP_MediaSkipForward) /*QIcon(":/Skip.png")*/ ) , mLoadIcon( QIcon( ":/Partyman/Load.png" ) ) , mpSettingsButton( new QPushButton( tr("Settings"), this ) ) , mpStartButton( new QToolButton( /*tr("Connect"),*/ this ) ) , mpSkipButton( new QToolButton( /*mSkipIcon, tr("Next"),*/ this ) ) , mpTrayIcon( new QSystemTrayIcon( this ) ) , mpTrayIconStopMenu( new QMenu( this ) ) , mpTrayIconPlayMenu( new QMenu( this ) ) , mpStartButtonMenu( new QMenu( mpStartButton ) ) , mpPlayAction( mpTrayIconStopMenu->addAction( mPlayIcon, tr("Start" ) ) ) , mpSkipAction( mpTrayIconPlayMenu->addAction( mSkipIcon, tr("Next" ) ) ) , mpPauseAction( mpStartButtonMenu->addAction( mPauseIcon, tr("Pause" ) ) ) , mpStopAction( mpStartButtonMenu->addAction( mStopIcon, tr("Disconnect" ) ) ) , mpLoadAction( mpStartButtonMenu->addAction( mLoadIcon, tr("Load" ) ) ) , mpTrayIconClickTimer( new QTimer( this ) ) , mConnected( false ) , mPaused( false ) , mKioskMode( false ) , mpDerMixDprocess( new QProcess( this ) ) , mpLoggerProcess( new QProcess( this ) ) , mWaitForDerMixD( false ) , mDerMixDstarted( false ) , mLastP0p() { CrashCleanup::addObject( mpDerMixDprocess ); setAcceptDrops( true ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); mpSettingsButton->setObjectName( QString("SettingsButton") ); mpPlayer[0] = new PlayerWidget( 0, database, this ); mpPlayer[1] = new PlayerWidget( 1, database, this ); mpTrayIconClickTimer->setSingleShot( true ); QGridLayout *mainLayout = new QGridLayout( this ); mainLayout->setContentsMargins( 3, 3, 3 ,3 ); mainLayout->setSpacing( 5 ); mainLayout->addWidget( mpPlayer[0], 1, 0, 4, 1 ); mainLayout->addWidget( mpPlayer[1], 1, 2, 4, 1 ); mainLayout->addWidget( mpSettingsButton, 1, 1 ); mainLayout->addWidget( mpStartButton, 3, 1 ); mainLayout->addWidget( mpSkipButton, 4, 1 ); mainLayout->setColumnStretch( 0, 1 ); mainLayout->setColumnStretch( 2, 1 ); mainLayout->setRowStretch( 0, 1 ); mainLayout->setRowStretch( 5, 1 ); setLayout( mainLayout ); mpStartButton->setDefaultAction( mpPlayAction ); mpStartButton->setPopupMode( QToolButton::InstantPopup ); mpStartButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); mpStartButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ); mpPlayAction->setCheckable( true ); mpPlayAction->setDisabled( true ); mpSkipButton->setDefaultAction( mpSkipAction ); mpSkipButton->setPopupMode( QToolButton::InstantPopup ); mpSkipButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); mpSkipButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ); mpSkipAction->setCheckable( true ); mpSkipAction->setDisabled( true ); mpTrayIcon->setIcon( QIcon(":/Partyman/Icon.png") ); mpTrayIcon->setContextMenu( mpTrayIconStopMenu ); mpTrayIconPlayMenu->addAction( mpPauseAction ); mpTrayIconPlayMenu->addAction( mpStopAction ); connect( mpSettingsButton, SIGNAL(clicked()), mpConfig, SLOT(exec()) ); connect( mpStartButton, SIGNAL(clicked()), this, SLOT(initConnect()) ); connect( mpPlayAction, SIGNAL(triggered()), this, SLOT(initConnect()) ); connect( mpPauseAction, SIGNAL(triggered()), this, SLOT(handlePause()) ); connect( mpStopAction, SIGNAL(triggered()), this, SLOT(initDisconnect()) ); connect( mpLoadAction, SIGNAL(triggered()), this, SLOT(handleLoad()) ); connect( mpSkipAction, SIGNAL(triggered()), this, SLOT(handleSkipTrack()) ); connect( mpConfig, SIGNAL(configChanged()), this, SLOT(readConfig()) ); connect( mpPlayer[0], SIGNAL(trackPlaying(TrackInfo)), this, SLOT(handleTrackPlaying(TrackInfo)) ); connect( mpPlayer[1], SIGNAL(trackPlaying(TrackInfo)), this, SLOT(handleTrackPlaying(TrackInfo)) ); connect( mpTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleTrayIcon(QSystemTrayIcon::ActivationReason)) ); connect( mpTrayIconClickTimer, SIGNAL(timeout()), this, SLOT(handlePause()) ); connect( mpDerMixDprocess, SIGNAL(readyReadStandardError()), this, SLOT(handleDerMixDstartup()) ); connect( mpDerMixDprocess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(handleDerMixDfinish(int,QProcess::ExitStatus)) ); connect( mpDerMixDprocess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleDerMixDerror(QProcess::ProcessError)) ); if( mpSatellite ) { mpGenericSatelliteHandler = new GenericSatelliteHandler( mpSatellite, GenericSatelliteHandler::WithPingAndDialog, this ); connect( mpGenericSatelliteHandler, SIGNAL(updateConfig()), mpConfig, SLOT(readSettings()) ); connect( mpGenericSatelliteHandler, SIGNAL(anotherInstance()), this, SLOT(initDisconnect()) ); connect( mpSatellite, SIGNAL(received(QByteArray)), this, SLOT(handleSatellite(QByteArray)) ); } }