Exemple #1
0
TagDialog::TagDialog( const TrackInfo& track, QWidget *parent )
        : QDialog( parent, Qt::Dialog )
{
    ui.setupUi( this );
    ui.tagEdit->setFocus();
    ui.tagEdit->installEventFilter( this );

    LastFmUserSettings& user = The::currentUser();
    ui.tagTypeBox->setCurrentIndex( user.lastTagType( 1 ) );
    ui.personalTagsList->setSortOrder( (Tags::SortOrder) user.personalTagsListSortOrder() );
    ui.publicTagsList->setSortOrder( (Tags::SortOrder) user.publicTagsListSortOrder() );

    QRegExp rx( "[a-zA-Z0-9\\-:,' ]{1,255}" );
    ui.tagEdit->setValidator( new QRegExpValidator( rx, this ) );

    setTrack( track );

    ui.buttonBox->button( QDialogButtonBox::Ok )->setText( tr("Tag") );
    ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );

    connect( ui.tagTypeBox, SIGNAL( currentIndexChanged( int ) ), SLOT( onTagTypeChanged( int ) ) );
    connect( ui.personalTagsList, SIGNAL( itemActivated( QTreeWidgetItem*, int ) ), SLOT( onTagActivated( QTreeWidgetItem* ) ) );
    connect( ui.publicTagsList, SIGNAL( itemActivated( QTreeWidgetItem*, int ) ), SLOT( onTagActivated( QTreeWidgetItem* ) ) );
    connect( this, SIGNAL( accepted() ), SLOT( onAccepted() ) );

    connect( ui.buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
    connect( ui.buttonBox, SIGNAL( rejected() ), SLOT( reject() ) );

    //needs to stay textEdited() not textChanged() or the completion breaks the filtering
    connect( ui.tagEdit, SIGNAL( textEdited( QString ) ), SLOT( onTagEditChanged() ) );

//////
    requestFactory<UserTagsRequest>()->start();
}
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();
}
Exemple #3
0
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;
	}
}
GenericLookupDialog::GenericLookupDialog( QWidget * parent ):
    QDialog(parent)
{
    addAction(MainWindow::instance()->action(MainWindow::LookupDocumentationForCursor));

    mQueryEdit = new QLineEdit(this);

    mResult = new QTreeView(this);
    mResult->setRootIsDecorated(false);
    mResult->setAllColumnsShowFocus(true);
    mResult->setHeaderHidden(true);
    mResult->header()->setStretchLastSection(false);
  
    mPreviewDocument = new Document(false);
    mPreviewEditor = new ScCodeEditor(mPreviewDocument);
    mPreviewEditor->setReadOnly(true);
    mPreviewEditor->setVisible(false);
    mPreviewEditor->setTabChangesFocus(true);
  
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(1);
    layout->addWidget(mQueryEdit, 0);
    layout->addWidget(mResult, 2);
    layout->addWidget(mPreviewEditor, 1);
  
    setLayout(layout);

    connect(mQueryEdit, SIGNAL(returnPressed()), this, SLOT(performQuery()));
    connect(mResult, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onAccepted(QModelIndex)));
    connect(mResult, SIGNAL(activated(QModelIndex)),     this, SLOT(onAccepted(QModelIndex)));

    mResult->installEventFilter(this);

    QRect bounds(0,0,600,300);
    if (parent) {
        QRect parentRect = parent->rect();
        bounds.moveCenter( parent->mapToGlobal( parentRect.center() ) );
    } else {
        QRect availableBounds = QApplication::desktop()->availableGeometry(this);
        bounds.moveCenter( availableBounds.center() );
    }

    setGeometry(bounds);

    mQueryEdit->setFocus( Qt::OtherFocusReason );
}
CalendarDialog::CalendarDialog(const QDate & date) : QDialog(), _date(date)
{
    Ui::UiCalendarDialog::setupUi(this);
    if(date >= ui_calendar->minimumDate() && date <= ui_calendar->maximumDate())
        ui_calendar->setSelectedDate(date);
    ui_calendar->setSelectedDate(date);
    connect(ui_promptValidator, SIGNAL(accepted()),
            this, SLOT(onAccepted()));
}
SnapshotDialog::SnapshotDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SnapshotDialog)
{
    ui->setupUi(this);
	connect(this , SIGNAL(accepted()) , this , SLOT(onAccepted()));
	this->setWindowOpacity(0.4);
    this->setModal(true);
}
ProjectPropertiesDialog::ProjectPropertiesDialog(ProjectProperties* properties, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ProjectPropertiesDialog),
    properties_(properties)
{
    ui->setupUi(this);

    ui->scaleMode->setCurrentIndex(properties_->scaleMode);

    ui->logicalWidth->setText(QString::number(properties_->logicalWidth));
    ui->logicalHeight->setText(QString::number(properties_->logicalHeight));

    ui->logicalWidth->setValidator(new QIntValidator());
    ui->logicalHeight->setValidator(new QIntValidator());

    ui->windowWidth->setText(QString::number(properties_->windowWidth));
    ui->windowHeight->setText(QString::number(properties_->windowHeight));

    ui->windowWidth->setValidator(new QIntValidator());
    ui->windowHeight->setValidator(new QIntValidator());

    for (size_t i = 0; i < properties_->imageScales.size(); ++i)
    {
        QTreeWidgetItem* item = new QTreeWidgetItem;
        item->setFlags(item->flags() | Qt::ItemIsEditable);
        item->setText(0, properties_->imageScales[i].first);
        item->setText(1, QString::number(properties_->imageScales[i].second));
        ui->imageScales->addTopLevelItem(item);
    }

    ui->orientation->setCurrentIndex(properties_->orientation);

    switch (properties_->fps)
    {
    case 60:
        ui->fps->setCurrentIndex(0);
        break;
    case 30:
        ui->fps->setCurrentIndex(1);
        break;
    }

    ui->retinaDisplay->setCurrentIndex(properties_->retinaDisplay);
    ui->autorotation->setCurrentIndex(properties_->autorotation);

    ui->mouseToTouch->setChecked(properties_->mouseToTouch);
    ui->touchToMouse->setChecked(properties_->touchToMouse);
    ui->mouseTouchOrder->setCurrentIndex(properties_->mouseTouchOrder);

    connect(ui->add, SIGNAL(clicked()), this, SLOT(add()));
    connect(ui->remove, SIGNAL(clicked()), this, SLOT(remove()));

    connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
}
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);
}
Exemple #9
0
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;
}
Exemple #10
0
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()));
}
Exemple #11
0
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);
}
Exemple #12
0
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()));
}
Exemple #13
0
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()));
}
Exemple #14
0
NetworkDialog::NetworkDialog(QWidget *parent)
    : QDialog(parent)
{
    ui.setupUi(this);

#if !USE_TUIO
    ui.labelUDPPort->setVisible(false);
    ui.comboBoxUDPPort->setVisible(false);
#endif

    // The contents of the combo boxes is only updated if the combo box
    // has the keyboard focus. Update manually.
    connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));

    readConfig();
}
AMExtendedControlEditorStyledInputDialog::AMExtendedControlEditorStyledInputDialog( QStringList enumNames, QWidget * parent, Qt::WindowFlags flags ) : QDialog(parent, flags) {
	setObjectName("styledDialog");
	setStyleSheet("#styledDialog { background-color: rgb(31,62,125); border: 2px outset white; border-radius: 10px; }  QLabel { color: white; font: bold " AM_FONT_REGULAR_ " \"Helvetica\"; } QPushButton { color: white; border: 1px outset rgb(158,158,158); border-radius: 5px; min-height: 24px; padding: 3px; width: 80px; margin: 3px;} #okButton { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(191, 218, 178, 255), stop:0.34 rgba(135, 206, 96, 255), stop:1 rgba(65, 157, 0, 255));} #cancelButton { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(232, 209, 209, 255), stop:0.34 rgba(229, 112, 119, 255), stop:1 rgba(197, 20, 32, 255)); } QDoubleSpinBox { padding: 3px; color: black; font: bold " AM_FONT_REGULAR_ " \"Helvetica\"; border: 1px outset rgb(158,158,158); selection-background-color: rgb(205, 220, 243); selection-color: black;}");// TODO: continue here...

	label_ = new QLabel("New value:");
	label_->setAlignment(Qt::AlignCenter);
	enumNames_ = enumNames;

	isEnum_ = false; //IS THIS THE MISSING PIECE?
	if(enumNames_.count() > 0)
		isEnum_ = true;
	spinBox_ = new QDoubleSpinBox();
	spinBox_->setObjectName("valueEntry");
	spinBox_->setButtonSymbols(QAbstractSpinBox::NoButtons);
	comboBox_ = new QComboBox();
	comboBox_->setObjectName("valueEntry");
	comboBox_->addItems(enumNames_);
	okButton_ = new QPushButton("Ok");
	okButton_->setObjectName("okButton");
	cancelButton_ = new QPushButton("Cancel");
	cancelButton_->setObjectName("cancelButton");

	vl_ = new QVBoxLayout();
	vl_->addWidget(label_);
	if(!isEnum_){
		vl_->addWidget(spinBox_);
		comboBox_->hide();
	}
	else{
		vl_->addWidget(comboBox_);
		spinBox_->hide();
	}

	hl_ = new QHBoxLayout();
	hl_->addWidget(cancelButton_);
	hl_->addWidget(okButton_);
	vl_->addLayout(hl_);

	setLayout(vl_);

	connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
	connect(okButton_, SIGNAL(clicked()), this, SLOT(accept()));
	connect(cancelButton_, SIGNAL(clicked()), this, SLOT(reject()));

	okButton_->setDefault(true);
}
Exemple #16
0
GTFSDialog::GTFSDialog(QString pathname, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::GTFSDialog),
    _pathname(pathname)
{
    ui->setupUi(this);

    // Set default values
    ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Import"));
    ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true);
    ui->lineEditTrace->setText((new QFileInfo(pathname))->fileName());

    // check whether the shape file exists
    QFileInfo checkShapeFileTXT(pathname+"/shapes.txt");
    QFileInfo checkShapeFileCSV(pathname+"/shapes.csv");
    if((checkShapeFileCSV.exists() && checkShapeFileCSV.isFile()) || (checkShapeFileTXT.exists() && checkShapeFileTXT.isFile())) {
        ui->snapToShapeCheckBox->setEnabled(true);
        ui->snapToShapeCheckBox->setChecked(true);
    } else {
        ui->snapToShapeCheckBox->setEnabled(false);
        ui->snapToShapeCheckBox->setChecked(false);
    }

    QSettings settings;

    _projIns = settings.value("savedProjInsGTFS", QStringList()).toStringList();
    if(_projIns.count() > 0) {
        ui->comboBoxInputProj->addItems(_projIns);
    }
    _projIn = ui->comboBoxInputProj->currentText();

    _projOuts = settings.value("savedProjOutsGTFS", QStringList()).toStringList();
    if(_projOuts.count() > 0) {
        ui->comboBoxOutputProj->addItems(_projOuts);
    }
    _projOut = ui->comboBoxOutputProj->currentText();

    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onAccepted()));
    connect(ui->comboBoxInputProj,  SIGNAL(editTextChanged(QString)), this, SLOT(projInEdited(QString)));
    connect(ui->comboBoxOutputProj, SIGNAL(editTextChanged(QString)), this, SLOT(projOutEdited(QString)));
    connect(ui->snapToShapeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(snapToShapeChanged()));

    projInEdited(_projIn);
    projOutEdited(_projOut);
}
Exemple #17
0
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);
}
Exemple #18
0
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);
}
EngineConfigurationDialog::EngineConfigurationDialog(
	EngineConfigurationDialog::DialogMode mode, QWidget* parent)
	: QDialog(parent),
	  m_engineOptionModel(new EngineOptionModel(this)),
	  m_engine(0),
	  ui(new Ui::EngineConfigurationDialog)
{
	ui->setupUi(this);

	if (mode == EngineConfigurationDialog::AddEngine)
		setWindowTitle(tr("Add Engine"));
	else
		setWindowTitle(tr("Configure Engine"));

	ui->m_progressBar->setRange(0, 0);
	ui->m_progressBar->hide();

	ui->m_protocolCombo->addItems(EngineFactory::protocols());

	ui->m_optionsView->setModel(m_engineOptionModel);
	ui->m_optionsView->setItemDelegate(new EngineOptionDelegate());

	m_optionDetectionTimer = new QTimer(this);
	m_optionDetectionTimer->setSingleShot(true);
	m_optionDetectionTimer->setInterval(5000);

	connect(ui->m_browseCmdBtn, SIGNAL(clicked(bool)),
		this, SLOT(browseCommand()));
	connect(ui->m_browseWorkingDirBtn, SIGNAL(clicked(bool)),
		this, SLOT(browseWorkingDir()));
	connect(ui->m_detectBtn, SIGNAL(clicked()),
		this, SLOT(detectEngineOptions()));
	connect(ui->m_restoreBtn, SIGNAL(clicked()),
		this, SLOT(restoreDefaults()));
	connect(ui->m_tabs, SIGNAL(currentChanged(int)),
		this, SLOT(onTabChanged(int)));
	connect(ui->m_buttonBox, SIGNAL(accepted()),
		this, SLOT(onAccepted()));
}
KoExistingDocumentPane::KoExistingDocumentPane(QWidget* parent, const QStringList& mimeFilter)
        : QWidget(parent)
        , m_seen(false)
{
    QGridLayout* layout = new QGridLayout(this);
    layout->setMargin(0);

    m_fileWidget = new KFileWidget(KUrl("kfiledialog:///OpenDialog"), this);
    m_fileWidget->setOperationMode(KFileWidget::Opening);
    m_fileWidget->setFilter(mimeFilter.join(" "));
    layout->addWidget(m_fileWidget, 0, 0, 1, -1);

    layout->setColumnStretch(0, 10);

    m_openButton = new KPushButton(i18n("Open Document"), this);
    layout->addWidget(m_openButton, 1, 1);

    connect(m_openButton, SIGNAL(clicked()),
            m_fileWidget, SLOT(slotOk()));
    connect(m_fileWidget, SIGNAL(accepted()),
            this, SLOT(onAccepted()));
}
orderPlaceDialog::orderPlaceDialog(ClientServiceClient *csc, QouteTrans *qt, bool is_close, LongShortType ls, QWidget *parent) :
    QDialog(parent),
    rpc(csc),
    qt(qt),
    ui(new Ui::orderPlaceDialog)
{
    ui->setupUi(this);
    instr_code = QString::fromStdString(qt->instr_code);
    ask_price = qt->ask_price;
    ask_volume = qt->ask_volume;
    bid_price = qt->bid_price;
    bid_volume = qt->bid_volume;
    ui->clientidLineEdit->setText(QString::number(ClientId));
    ui->instrCodeLineEdit->setText(instr_code);
    ui->priceDoubleSpinBox->setValue(ui->longRadioButton->isChecked()?ask_price:bid_price);
    ui->quantSpinBox->setMaximum(ui->longRadioButton->isChecked()?ask_volume:bid_volume);
    ui->quantSpinBox->setMinimum(1);
    if (is_close) {
        if (ls == LONG_ORDER) {
            ui->longRadioButton->setVisible(false);
            ui->shortRadioButton->setChecked(true);
            ui->shortRadioButton->setDisabled(true);
        }  else {
            ui->shortRadioButton->setVisible(false);
            ui->longRadioButton->setChecked(true);
            ui->longRadioButton->setDisabled(true);
        }
        ui->openRadioButton->setVisible(false);
        ui->offsetRadioButton->setChecked(true);
        ui->offsetRadioButton->setDisabled(true);

    }

    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onAccepted()));
    connect(ui->buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onLongShortRadioButtonClicked(int)));
}
Exemple #22
0
HatPrompt::HatPrompt(int currentIndex, QWidget* parent) : QDialog(parent)
{
    setModal(true);
    setWindowFlags(Qt::Sheet);
    setWindowModality(Qt::WindowModal);
    setMinimumSize(550, 430);
    resize(550, 430);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    setStyleSheet("QPushButton { padding: 5px; margin-top: 10px; }");

    // Hat model, and a model for setting a filter
    HatModel * hatModel = DataManager::instance().hatModel();
    filterModel = new QSortFilterProxyModel();
    filterModel->setSourceModel(hatModel);
    filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);

    // Grid
    QGridLayout * dialogLayout = new QGridLayout(this);
    dialogLayout->setSpacing(0);
    dialogLayout->setColumnStretch(1, 1);

    QHBoxLayout * topLayout = new QHBoxLayout();

    // Help/prompt message at top
    QLabel * lblDesc = new QLabel(tr("Search for a hat:"));
    lblDesc->setObjectName("lblDesc");
    lblDesc->setStyleSheet("#lblDesc { color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-top-left-radius: 10px; padding: 4px 10px;}");
    lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    lblDesc->setFixedHeight(24);
    lblDesc->setMinimumWidth(0);

    // Filter text box
    QWidget * filterContainer = new QWidget();
    filterContainer->setFixedHeight(24);
    filterContainer->setObjectName("filterContainer");
    filterContainer->setStyleSheet("#filterContainer { background: #F6CB1C; border-top-right-radius: 10px; padding: 3px; }");
    filterContainer->setFixedWidth(150);
    txtFilter = new LineEditCursor(filterContainer);
    txtFilter->setFixedWidth(150);
    txtFilter->setFocus();
    txtFilter->setFixedHeight(22);
    txtFilter->setStyleSheet("LineEditCursor { border-width: 0px; border-radius: 6px; margin-top: 3px; margin-right: 3px; padding-left: 4px; padding-bottom: 2px; background-color: rgb(23, 11, 54); } LineEditCursor:hover, LineEditCursor:focus { background-color: rgb(13, 5, 68); }");
    connect(txtFilter, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged(const QString &)));
    connect(txtFilter, SIGNAL(moveUp()), this, SLOT(moveUp()));
    connect(txtFilter, SIGNAL(moveDown()), this, SLOT(moveDown()));
    connect(txtFilter, SIGNAL(moveLeft()), this, SLOT(moveLeft()));
    connect(txtFilter, SIGNAL(moveRight()), this, SLOT(moveRight()));

    // Corner widget
    QLabel * corner = new QLabel();
    corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png")));
    corner->setFixedSize(10, 10);

    // Add widgets to top layout
    topLayout->addWidget(lblDesc);
    topLayout->addWidget(filterContainer);
    topLayout->addWidget(corner, 0, Qt::AlignBottom);
    topLayout->addStretch(1);

    // Cancel button (closes dialog)
    QPushButton * btnCancel = new QPushButton(tr("Cancel"));
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));

    // Select button
    QPushButton * btnSelect = new QPushButton(tr("Use selected hat"));
    btnSelect->setDefault(true);
    connect(btnSelect, SIGNAL(clicked()), this, SLOT(onAccepted()));

    // Add hats
    list = new HatListView();
    list->setModel(filterModel);
    list->setViewMode(QListView::IconMode);
    list->setResizeMode(QListView::Adjust);
    list->setMovement(QListView::Static);
    list->setEditTriggers(QAbstractItemView::NoEditTriggers);
    list->setSpacing(8);
    list->setWordWrap(true);
    list->setSelectionMode(QAbstractItemView::SingleSelection);
    list->setObjectName("hatList");
    list->setCurrentIndex(filterModel->index(currentIndex, 0));
    connect(list, SIGNAL(activated(const QModelIndex &)), this, SLOT(hatChosen(const QModelIndex &)));
    connect(list, SIGNAL(clicked(const QModelIndex &)), this, SLOT(hatChosen(const QModelIndex &)));

    // Add elements to layouts
    dialogLayout->addLayout(topLayout, 0, 0, 1, 3);
    dialogLayout->addWidget(list, 1, 0, 1, 3);
    dialogLayout->addWidget(btnCancel, 2, 0, 1, 1, Qt::AlignLeft);
    dialogLayout->addWidget(btnSelect, 2, 2, 1, 1, Qt::AlignRight);
}
void housedialog::on_housedialog_accepted()
{
    //qDebug()<<"2";
    if( onAccepted() )//添加判断是否有非法输入,有则退回重输
		QDialog::accept();
}
void housedialog::accept()
{
    //qDebug()<<"!!!!";
    onAccepted();
    QDialog::accept();
}
PluginsSettingsDialog::PluginsSettingsDialog(PluginAbstract* plugin, QWidget* parent, Qt::WindowFlags flags):
QDialog(parent, flags),
mPlugin(plugin)
{
    QString title = plugin->getName() + " " + tr("Settings");
    setWindowTitle(title);
    
    /*mLangHelpLab = new QLabel(tr("The following parameters can "), this);
    QFont f;
    f.setPointSize(pointSize(11));
    mLangHelpLab->setFont(f);
    mLangHelpLab->setAlignment(Qt::AlignCenter);
    mLangHelpLab->setWordWrap(true);*/
    
    // ----------------------------------------
    //  Common form for all plugins
    // ----------------------------------------
    mColorLab = new Label(tr("Color") + " :", this);
    mColorPicker = new ColorPicker(mPlugin->getColor(), this);
    
    mMethodLab = new QLabel(tr("Method") + " :", this);
    mMethodCombo = new QComboBox(this);
    mMethodCombo->addItem(ModelUtilities::getDataMethodText(Date::eMHSymetric));
    mMethodCombo->addItem(ModelUtilities::getDataMethodText(Date::eInversion));
    mMethodCombo->addItem(ModelUtilities::getDataMethodText(Date::eMHSymGaussAdapt));
    
    
    // ----------------------------------------
    //  This form is plugin specific
    // ----------------------------------------
    mView = plugin->getSettingsView();
    if(mView){
        // useless using a layout below...
        mView->setParent(this);
        mView->setVisible(true);
    }
    
    // ----------------------------------------
    //  Connections
    // ----------------------------------------
    connect(this, SIGNAL(accepted()), mView, SLOT(onAccepted()));
    connect(mColorPicker, SIGNAL(colorChanged(QColor)), this, SLOT(updateColor(QColor)));
    
    // ----------------------------------------
    //  Buttons
    // ----------------------------------------
    mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
    
    // ----------------------------------------
    //  Layout
    // ----------------------------------------
    QGridLayout* grid = new QGridLayout();
    grid->setContentsMargins(0, 0, 0, 0);
    grid->addWidget(mColorLab, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mColorPicker, 0, 1);
    grid->addWidget(mMethodLab, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mMethodCombo, 1, 1);
    
    QVBoxLayout* layout = new QVBoxLayout();
    layout->addLayout(grid);
    if(mView){
        QFrame* line1 = new QFrame();
        line1->setFrameShape(QFrame::HLine);
        line1->setFrameShadow(QFrame::Sunken);
        layout->addWidget(line1);
        layout->addWidget(mView);
    }
    layout->addWidget(mButtonBox);
    
    setLayout(layout);
    
    setFixedWidth(450);
}
void shelfdialog::accept()
{
    onAccepted();
    QDialog::accept();
}