PreferencesDialog::PreferencesDialog( QMenuBar* menuBar, QWidget* parent ) :unicorn::MainWindow( menuBar, parent ), ui( new Ui::PreferencesDialog ) { // Disable the minimize and maximize buttons. Qt::WindowFlags flags = this->windowFlags(); flags &= ~Qt::WindowMinMaxButtonsHint; setWindowFlags(flags); ui->setupUi( this ); setAttribute( Qt::WA_DeleteOnClose, true ); static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionGeneral ) )->setAutoExclusive( true ); static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionScrobbling ) )->setAutoExclusive( true ); static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionDevices ) )->setAutoExclusive( true ); static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAccounts ) )->setAutoExclusive( true ); static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAdvanced ) )->setAutoExclusive( true ); connect( ui->toolBar->widgetForAction( ui->actionGeneral ), SIGNAL(toggled(bool)), ui->actionGeneral, SLOT(setChecked(bool)) ); connect( ui->toolBar->widgetForAction( ui->actionScrobbling ), SIGNAL(toggled(bool)), ui->actionScrobbling, SLOT(setChecked(bool)) ); connect( ui->toolBar->widgetForAction( ui->actionDevices ), SIGNAL(toggled(bool)), ui->actionDevices, SLOT(setChecked(bool)) ); connect( ui->toolBar->widgetForAction( ui->actionAccounts ), SIGNAL(toggled(bool)), ui->actionAccounts, SLOT(setChecked(bool)) ); connect( ui->toolBar->widgetForAction( ui->actionAdvanced ), SIGNAL(toggled(bool)), ui->actionAdvanced, SLOT(setChecked(bool)) ); connect( this, SIGNAL( saveNeeded() ), ui->general, SLOT( saveSettings() ) ); connect( this, SIGNAL( saveNeeded() ), ui->scrobbling, SLOT( saveSettings() ) ); connect( this, SIGNAL( saveNeeded() ), ui->ipod, SLOT( saveSettings() ) ); connect( this, SIGNAL( saveNeeded() ), ui->accounts, SLOT( saveSettings() ) ); connect( this, SIGNAL( saveNeeded() ), ui->advanced, SLOT( saveSettings() ) ); connect( ui->general, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) ); connect( ui->scrobbling, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) ); connect( ui->ipod, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) ); connect( ui->accounts, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) ); connect( ui->advanced, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) ); connect( ui->actionGeneral, SIGNAL(triggered()), SLOT(onTabButtonClicked())); connect( ui->actionScrobbling, SIGNAL(triggered()), SLOT(onTabButtonClicked())); connect( ui->actionDevices, SIGNAL(triggered()), SLOT(onTabButtonClicked())); connect( ui->actionAccounts, SIGNAL(triggered()), SLOT(onTabButtonClicked())); connect( ui->actionAdvanced, SIGNAL(triggered()), SLOT(onTabButtonClicked())); connect( ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(onStackCurrentChanged(int)), Qt::QueuedConnection ); #ifdef Q_OS_MAC ui->buttonBox->hide(); #endif connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( onAccepted() ) ); connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( onRejected() ) ); QAbstractButton* applyButton = ui->buttonBox->button( QDialogButtonBox::Apply ); applyButton->setEnabled( false ); connect( applyButton, SIGNAL( clicked() ), SLOT( onApplyButtonClicked() ) ); setFixedWidth( 550 ); ui->stackedWidget->setCurrentWidget( ui->accounts ); ui->actionGeneral->trigger(); }
void AuthService::handleReply(Reply *reply) { debug() << "New reply" << reply->replyType(); switch(reply->replyType()) { case Reply::New: { AuthDialogPrivate *dialog = new AuthDialogPrivate(); connect(dialog,SIGNAL(accepted()), SLOT(onAccepted())); connect(dialog,SIGNAL(rejected()), SLOT(onRejected())); dialog->show(reply->contact(), reply->body(), true); break; } case Reply::Accepted: case Reply::Rejected: { NotificationRequest request(Notification::System); request.setObject(reply->contact()); request.setText(reply->body()); request.send(); break; } default: break; } }
foreach (PieceDownloader* pd,pdown) { pd->release(); sendCancels(pd); disconnect(pd,SIGNAL(timedout(bt::Request)),this,SLOT(onTimeout(bt::Request))); disconnect(pd,SIGNAL(rejected(bt::Request)),this,SLOT(onRejected(bt::Request))); }
void DatabaseNameDialog::createWidgets() { QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(new QLabel(tr("The suffix of database \".sqlite\" will append automatically"))); lineEdit_ = new QLineEdit; layout->addWidget(lineEdit_); QDialogButtonBox* buttonGroup = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); connect(buttonGroup, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(buttonGroup, SIGNAL(rejected()), this, SLOT(onRejected())); layout->addWidget(buttonGroup); }
QLayout* AccountDialog::buttonPart() { QHBoxLayout* layout = new QHBoxLayout; QDialogButtonBox* box = new QDialogButtonBox; box->addButton(QDialogButtonBox::Ok); box->addButton(QDialogButtonBox::Cancel); layout->addWidget(box); connect(box, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(box, SIGNAL(rejected()), this, SLOT(onRejected())); return layout; }
GomTVAccountDialog::GomTVAccountDialog(const QString & gomUsername, const QString & gomPassword) : QDialog() { UiGomTVDialog::setupUi(this); ui_gomUsername->setText(gomUsername); ui_gomPassword->setText(gomPassword); connect(ui_promptValidator, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(ui_promptValidator, SIGNAL(rejected()), this, SLOT(onRejected())); }
HostChangerDialog::HostChangerDialog(const QString & _address, const quint16 _port) : QDialog() { UiHostDialog::setupUi(this); ui_inputAddress->setText(_address); ui_inputPort->setValue(_port); connect(ui_promptValidator, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(ui_promptValidator, SIGNAL(rejected()), this, SLOT(onRejected())); }
Lvk::FE::NewUpdateDialog::NewUpdateDialog(const DAS::UpdateInfo &info, QWidget *parent) : QDialog(parent), m_url(info.url()), m_downloadAccepted(false) { setModal(true); setMinimumWidth(600); setMaximumWidth(600); setWindowTitle(tr("New Update")); m_label = new QLabel(this); m_label->setWordWrap(true); m_label->setOpenExternalLinks(true); m_hash = new QLabel(this); m_hash->setTextInteractionFlags(m_label->textInteractionFlags() | Qt::TextSelectableByMouse); m_hash->setCursor(QCursor(Qt::IBeamCursor)); m_copy = new QToolButton(this); m_copy->setAutoRaise(true); m_copy->setIcon(QIcon(":/icons/copy.png")); m_copy->setToolTip(tr("Copy signature")); m_later = new QPushButton(tr("Later"), this); m_download = new QPushButton(tr("Download Now!"), this); m_download->setDefault(true); m_download->setFocus(); QGridLayout *mainLayout = new QGridLayout(this); setLayout(mainLayout); QHBoxLayout *hashLayout = new QHBoxLayout(); QSpacerItem *vspacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); QSpacerItem *hspacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed); mainLayout->addWidget (m_label, 0, 0, 1, 3); mainLayout->addLayout (hashLayout, 1, 0, 1, 3); mainLayout->addItem (vspacer, 2, 0, 1, 3); mainLayout->addItem (hspacer, 3, 0); mainLayout->addWidget (m_later, 3, 1); mainLayout->addWidget (m_download, 3, 2); hashLayout->setMargin(0); hashLayout->addWidget(m_hash); hashLayout->addWidget(m_copy); hashLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed)); connect(m_download, SIGNAL(clicked()), SLOT(onAccepted())); connect(m_later, SIGNAL(clicked()), SLOT(onRejected())); connect(m_copy, SIGNAL(clicked()), SLOT(onCopyHash())); setUpdateInfo(info); }
PathChangerDialog::PathChangerDialog(const QString & _path) : QDialog() { UiPathDialog::setupUi(this); ui_inputPath->setText(_path); connect(ui_pathBrowse, SIGNAL(clicked()), this, SLOT(onBrowse())); connect(ui_promptValidator, SIGNAL(accepted()), this, SLOT(onAccepted())); connect(ui_promptValidator, SIGNAL(rejected()), this, SLOT(onRejected())); }
bool AuthService::event(QEvent *event) { if(event->type() == Request::eventType()) { debug() << "New request"; Request *request = static_cast<Request*>(event); AuthDialogPrivate *dialog = new AuthDialogPrivate(); connect(dialog,SIGNAL(accepted()), SLOT(onAccepted())); connect(dialog,SIGNAL(rejected()), SLOT(onRejected())); dialog->show(request->contact(), request->body(), false); return true; } else if(event->type() == Reply::eventType()) { handleReply(static_cast<Reply*>(event)); return true; } return QObject::event(event); }
GtkFileDialog::GtkFileDialog(QWidget *parent, const QString &caption, const QString &directory, const QString &filter) : QDialog(parent) , _windowTitle(caption) , _initialDirectory(directory) { auto filters = qt_make_filter_list(filter); const int numFilters = filters.count(); _nameFilters.reserve(numFilters); for (int i = 0; i < numFilters; ++i) { _nameFilters << filters[i].simplified(); } d.reset(new QGtkDialog(Libs::gtk_file_chooser_dialog_new("", nullptr, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL))); connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted())); connect(d.data(), SIGNAL(reject()), this, SLOT(onRejected())); Libs::g_signal_connect_helper(Libs::gtk_file_chooser_cast(d->gtkDialog()), "selection-changed", G_CALLBACK(onSelectionChanged), this); Libs::g_signal_connect_swapped_helper(Libs::gtk_file_chooser_cast(d->gtkDialog()), "current-folder-changed", G_CALLBACK(onCurrentFolderChanged), this); }
FirstRunWizard::FirstRunWizard( bool startFromTour, QWidget* parent ) :QDialog( parent ), ui( new Ui::FirstRunWizard ), m_commitPage( false ), m_showWelcome( false ), m_bootstrapState( NoBootstrap ) { #ifdef Q_OS_WIN32 m_plugins = new unicorn::PluginList; #endif ui->setupUi( this ); ui->welcome->hide(); for ( int i = 0 ; i < ui->stackedWidget->count() ; ++i ) { qobject_cast<WizardPage*>(ui->stackedWidget->widget( i ))->setWizard( this ); } connect( ui->next, SIGNAL(clicked()), SLOT(next())); connect( ui->back, SIGNAL(clicked()), SLOT(back())); connect( ui->skip, SIGNAL(clicked()), SLOT(skip())); connect( ui->finish, SIGNAL(clicked()), SLOT(accept())); connect( this, SIGNAL( rejected() ), this, SLOT( onRejected() ) ); connect( this, SIGNAL( accepted() ), this, SLOT( onWizardCompleted() ) ); connect( aApp, SIGNAL(bootstrapStarted(QString)), SLOT(onBootstrapStarted(QString))); connect( aApp, SIGNAL(bootstrapDone(AbstractBootstrapper::BootstrapStatus)), SLOT(onBootstrapDone(AbstractBootstrapper::BootstrapStatus))); if ( startFromTour ) ui->stackedWidget->setCurrentWidget( ui->tourScrobblesPage ); else ui->stackedWidget->setCurrentWidget( ui->loginPage ); initializePage( ui->stackedWidget->currentWidget() ); setFixedSize( 750, 450 ); }
SettingsDialog::SettingsDialog( QWidget *parent ) : QDialog( parent ) , ui( new Ui_StackedSettingsDialog ) , m_proxySettings( this ) , m_rejected( false ) , m_sipModel( 0 ) , m_resolversModel( 0 ) { ui->setupUi( this ); TomahawkSettings* s = TomahawkSettings::instance(); ui->checkBoxHttp->setChecked( s->httpEnabled() ); ui->checkBoxStaticPreferred->setChecked( s->preferStaticHostPort() ); ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp ); ui->checkBoxUpnp->setEnabled( !s->preferStaticHostPort() ); createIcons(); #ifdef Q_WS_X11 ui->listWidget->setFrameShape( QFrame::StyledPanel ); ui->listWidget->setFrameShadow( QFrame::Sunken ); setContentsMargins( 4, 4, 4, 4 ); #else ui->verticalLayout->removeItem( ui->verticalSpacer_3 ); #endif #ifdef Q_WS_MAC // Avoid resize handles on sheets on osx m_proxySettings.setSizeGripEnabled( true ); QSizeGrip* p = m_proxySettings.findChild< QSizeGrip* >(); p->setFixedSize( 0, 0 ); #endif // SIP PLUGINS SipConfigDelegate* sipdel = new SipConfigDelegate( this ); ui->accountsView->setItemDelegate( sipdel ); ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu ); connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) ); connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) ); connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) ); m_sipModel = new SipModel( this ); ui->accountsView->setModel( m_sipModel ); setupSipButtons(); ui->staticHostName->setText( s->externalHostname() ); ui->staticPort->setValue( s->externalPort() ); ui->proxyButton->setVisible( true ); // MUSIC SCANNER //FIXME: MULTIPLECOLLECTIONDIRS if ( s->scannerPaths().count() ) ui->lineEditMusicPath_2->setText( s->scannerPaths().first() ); else { ui->lineEditMusicPath_2->setText( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ); } // WATCH CHANGES // FIXME: QFileSystemWatcher is broken (as we know) and deprecated. Find another way. ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() ); ui->checkBoxWatchForChanges->setVisible( false ); // LAST FM ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() ); ui->lineEditLastfmUsername->setText( s->lastFmUsername() ); ui->lineEditLastfmPassword->setText(s->lastFmPassword() ); connect( ui->pushButtonTestLastfmLogin, SIGNAL( clicked( bool) ), this, SLOT( testLastFmLogin() ) ); // SCRIPT RESOLVER ui->removeScript->setEnabled( false ); ResolverConfigDelegate* del = new ResolverConfigDelegate( this ); connect( del, SIGNAL( openConfig( QString ) ), this, SLOT( openResolverConfig( QString ) ) ); ui->scriptList->setItemDelegate( del ); m_resolversModel = new ResolversModel( s->allScriptResolvers(), s->enabledScriptResolvers(), this ); ui->scriptList->setModel( m_resolversModel ); connect( ui->scriptList->selectionModel(), SIGNAL( selectionChanged( QItemSelection,QItemSelection ) ), this, SLOT( scriptSelectionChanged() ) ); connect( ui->addScript, SIGNAL( clicked( bool ) ), this, SLOT( addScriptResolver() ) ); connect( ui->removeScript, SIGNAL( clicked( bool ) ), this, SLOT( removeScriptResolver() ) ); connect( ui->buttonBrowse_2, SIGNAL( clicked() ), SLOT( showPathSelector() ) ); connect( ui->proxyButton, SIGNAL( clicked() ), SLOT( showProxySettings() ) ); connect( ui->checkBoxStaticPreferred, SIGNAL( toggled(bool) ), SLOT( toggleUpnp(bool) ) ); connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) ); ui->listWidget->setCurrentRow( 0 ); }