void ChatMessageDialog::keyPressEvent(QKeyEvent* e) { if(e->key() == Qt::Key_Return) { onOkClicked(); } }
QuetzalChoiceDialog::QuetzalChoiceDialog(const char *title, const char *primary, const char *secondary, int default_value, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data, va_list choices, QWidget *parent) : QuetzalRequestDialog(title, primary, secondary, PURPLE_REQUEST_CHOICE, user_data, parent) { m_ok_cb = (PurpleRequestChoiceCb) ok_cb; m_cancel_cb = (PurpleRequestChoiceCb) cancel_cb; QPushButton *ok_button = buttonBox()->addButton(ok_text, QDialogButtonBox::AcceptRole); QPushButton *cancel_button = buttonBox()->addButton(cancel_text, QDialogButtonBox::RejectRole); connect(ok_button, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancelClicked())); const char *text; int id; int i = 1; // Label with description is situated at index 0 while (!!(text = va_arg(choices, gchararray))) { id = va_arg(choices, int); QRadioButton *button = new QRadioButton(text, this); m_radios << button; button->setProperty("choiceId", id); boxLayout()->insertWidget(i++, button); if (id == default_value) button->setChecked(true); } }
ExportDialog::ExportDialog(QWidget *parent) : QDialog(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(); QHBoxLayout *lay1 = new QHBoxLayout(); QHBoxLayout *lay2 = new QHBoxLayout(); lay2->addStretch(); mainLayout->addLayout(lay1); mainLayout->addStretch(); mainLayout->addLayout(lay2); cbTimestamps = new QCheckBox("Export Timestamps"); lay1->addWidget(cbTimestamps); cbTimestamps->setChecked(true); bCancel = new QPushButton("Cancel"); lay2->addWidget(bCancel); bOk = new QPushButton("Ok"); lay2->addWidget(bOk); this->setWindowTitle("Export OSC Messages to a CSV file"); this->setLayout(mainLayout); this->setFixedSize(350, 120); connect(bOk, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(bCancel, SIGNAL(clicked()), this, SLOT(onCancelClicked())); connect(cbTimestamps, SIGNAL(stateChanged(int)), this, SLOT(onExportTimestampsChecked(int))); }
FingerprinterProgressBar::FingerprinterProgressBar( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f | Qt::Sheet ), m_stopped( false ) { ui.setupUi( this ); setModal( true ); setRunning( false ); m_totalTracks = m_tracksFingerprinted = m_tracksSkipped = m_tracksWithErrors = 0; m_timer.setInterval( 1000 ); connect(&m_timer, SIGNAL(timeout()), this, SLOT(update())); connect(ui.fingerprintProgressBar, SIGNAL( valueChanged( int ) ), this, SLOT( progressBarChanged( int ) ) ); m_timeElapsed = m_etaCounter = m_timeRemaining = 0; setFixedHeight( sizeHint().height() ); ui.okButton->setVisible( false ); connect( ui.okButton, SIGNAL( clicked() ), this, SLOT( onOkClicked() ) ); connect( ui.stopButton, SIGNAL( clicked() ), this, SLOT( onCancelClicked() ) ); }
InviteContactDialog::InviteContactDialog(const Tp::AccountManagerPtr &accountManager, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent) : KDialog(parent), m_account(account), m_channel(channel), m_contactsModel(new KTp::ContactsListModel(this)) { resize(500,450); m_contactsModel->setAccountManager(accountManager); m_contactGridWidget = new KTp::ContactGridWidget(m_contactsModel, this); m_contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts...")); m_contactGridWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected); m_contactGridWidget->filter()->setAccountFilter(account); setMainWidget(m_contactGridWidget); setWindowTitle(i18n("Select Contacts to Invite to Group Chat")); connect(m_contactGridWidget, SIGNAL(selectionChanged(Tp::AccountPtr,Tp::ContactPtr)), SLOT(onChanged())); button(KDialog::Ok)->setDisabled(true); connect(this, SIGNAL(okClicked()), SLOT(onOkClicked())); connect(this, SIGNAL(rejected()), SLOT(close())); }
void DomainDialog::initDialog() { ui->setupUi(this); //Connect signals to their handlers, and make sure all fields are properly filled connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(ui->nameEdit, SIGNAL(textChanged(QString)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->displayNameEdit, SIGNAL(textChanged(QString)), this, SLOT(onMandatoryFieldsChanged())); connect(ui->iconButton, SIGNAL(clicked()), this, SLOT(onIconClicked())); onMandatoryFieldsChanged(); //Setup the line edits ui->nameEdit->setFocus(Qt::PopupFocusReason); ui->nameEdit->setValidationExpression(".+"); ui->displayNameEdit->setValidationExpression(".+"); //Little hack to make the layout look better for(int i=0; i<ui->gridLayout->rowCount(); ++i) ui->gridLayout->setRowMinimumHeight(i, ui->displayNameEdit->geometry().height()); ui->gridLayout->update(); //Set the range and value of the sliders based on Domain's defaults ui->confidentialitySlider->setRange(Domain::ConfidentialityMin, Domain::ConfidentialityMax); ui->reliabilitySlider->setRange(Domain::ReliabilityMin, Domain::ReliabilityMax); //Another hack to force the sliders' associated labels' text to be updated ui->confidentialityLabel->setNum(ui->confidentialitySlider->value()); ui->reliabilityLabel->setNum(ui->reliabilitySlider->value()); }
ChatMessageDialog::ChatMessageDialog(const QString& addressee, ChatType chatType, QWidget *parent): MyDialog(parent), mChatType(chatType), mAddressee(addressee) { setWindowTitle(tr("Send Message")); QString header = (mChatType == CT_COMMON_CHAT) ? tr("A chat message to ") + mAddressee + ":" : tr("A chat message:"); label = new QLabel(header, this); mEdit = new QLineEdit(this); okButton = new QPushButton(tr("OK"), this); layout = new QVBoxLayout(this); layout->addWidget(label); layout->addWidget(mEdit); layout->addStretch(); layout->addWidget(okButton); this->setLayout(layout); mEdit->setFocus(); connect(okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); }
void Logic::onOkClicked() { QMutexLocker locker(&mutex); switch(state) { case JOIN_TEAM: { TipArea *tipArea = gui->getTipArea(); int chosen = tipArea->getBoxCurrentText().split(".")[0].toInt(); network::JoinTeamRequest *join = new network::JoinTeamRequest(); join->set_team((network::JoinTeamRequest_Team)(chosen - 1)); emit sendCommand(network::MSG_JOIN_TEAM_REQ, join); normal(); break; } case 46: { network::PickBan* pick; TipArea *tipArea = gui->getTipArea(); int chosen = tipArea->getBoxCurrentText().split(".")[0].toInt(); pick = new network::PickBan(); pick->add_role_ids(chosen); pick->set_strategy(network::ROLE_STRATEGY_31); pick->set_is_pick(true); emit sendCommand(network::MSG_PICK_BAN, pick); disconnect(gui->getDecisionArea(),SIGNAL(okClicked()),this,SLOT(onOkClicked())); gui->reset(); break; } /* TODO:BP case 52: bpArea=gui->getBPArea(); roles = bpArea->getSelectedRoles(); emit sendCommand("53;"+QString::number(roles[0])+";"); role= bpArea->getRoleByID(roles[0]); role->setY(role->y()+20); bpArea->reset(); gui->reset(); break; case 55: bpArea=gui->getBPArea(); roles = bpArea->getSelectedRoles(); emit sendCommand("56;"+QString::number(roles[0])+";"); role= bpArea->getRoleByID(roles[0]); role->setY(role->y()+20); bpArea->reset(); gui->reset(); break; */ } }
LogWidget::LogWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(m_log = new QTextEdit()); layout->addWidget(m_okButton = new QPushButton("Ok", this)); this->setLayout(layout); connect(m_okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); }
SetAliasDialog::SetAliasDialog(QWidget* parent) : QDialog(parent) , ui(new Ui::SetAliasDialog) { ui->setupUi(this); connect(ui->okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(onCancelClicked())); }
AboutWidget::AboutWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(m_label = new QLabel()); layout->addWidget(m_okButton = new QPushButton("Ok", this)); layout->addStretch(); this->setLayout(layout); m_label->setAlignment(Qt::AlignCenter); m_label->setText(tr("Wikigps-tracker 0.1.5\n(c) 2010-2011 OSLL")); connect(m_okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); }
void WaveformDialog::onReturn() { size_t count = buttons_.size(); for(size_t i = 0; i < count; ++i) { if (buttons_[i]->hasFocus()) { buttons_[i]->setChecked(true); QApplication::processEvents(); onOkClicked(true); return; } } }
ProfileEditor::ProfileEditor(QWidget *parent) : QDialog(parent) , ui(new Ui::ProfileEditor) , m_tableModel(new QSqlTableModel()) { ui->setupUi(this); connect(ui->addRowButton, SIGNAL(clicked()), this, SLOT(onAddClicked())); connect(ui->deleteRowButton, SIGNAL(clicked()), this, SLOT(onDeleteClicked())); connect(ui->okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); }
void Role::makeConnection() { connect(logic->getClient(),SIGNAL(getMessage(QString)),this,SLOT(decipher(QString))); connect(this,SIGNAL(sendCommand(QString)),logic->getClient(),SLOT(sendMessage(QString))); connect(decisionArea,SIGNAL(okClicked()),this,SLOT(onOkClicked())); connect(decisionArea,SIGNAL(cancelClicked()),this,SLOT(onCancelClicked())); connect(decisionArea,SIGNAL(exchangeClicked()),this,SLOT(exchangeCards())); connect(decisionArea,SIGNAL(resignClicked()),this,SLOT(resign())); connect(buttonArea->getButtons().at(0),SIGNAL(buttonSelected(int)),this,SLOT(buy())); connect(buttonArea->getButtons().at(1),SIGNAL(buttonSelected(int)),this,SLOT(synthetize())); connect(buttonArea->getButtons().at(2),SIGNAL(buttonSelected(int)),this,SLOT(extract())); connect(buttonArea,SIGNAL(buttonUnselected()),this,SLOT(onCancelClicked())); connect(handArea,SIGNAL(cardReady()),this,SLOT(cardAnalyse())); connect(playerArea,SIGNAL(playerReady()),this,SLOT(playerAnalyse())); }
InitSeafileDialog::InitSeafileDialog(QWidget *parent) : QDialog(parent) { setupUi(this); setWindowTitle(tr("Seafile Initialzation")); setWindowIcon(QIcon(":/images/seafile.png")); connect(mChooseDirBtn, SIGNAL(clicked()), this, SLOT(chooseDir())); connect(mOkBtn, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(mCancelBtn, SIGNAL(clicked()), this, SLOT(onCancelClicked())); mLogo->setPixmap(QPixmap(":/images/seafile-32.png")); mDirectory->setText(getInitialPath()); const QRect screen = QApplication::desktop()->screenGeometry(); move(screen.center() - this->rect().center()); }
MyMessageBox::MyMessageBox(QWidget *parent, MyMessageBoxType type, const QString &text): MyDialog(parent) { label = new QLabel(text, this); label->setWordWrap(true); // upperLayout = new QVBoxLayout(); layout = new QVBoxLayout(this); lowerLayout = new QHBoxLayout(); layout->addWidget(label); //upperLayout->addStretch(); switch(type) { case MB_OK: case MB_ERROR: okButton = new QPushButton(tr("OK"), this); lowerLayout->addWidget(okButton); connect(okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); break; case MB_QUESTION: yesButton = new QPushButton(tr("Yes"), this); noButton = new QPushButton(tr("No"), this); lowerLayout->addWidget(yesButton); lowerLayout->addWidget(noButton); connect(yesButton, SIGNAL(clicked()), this, SLOT(onYesClicked())); connect(noButton, SIGNAL(clicked()), this, SLOT(onNoClicked())); break; default: break; } // layout->addLayout(upperLayout); layout->addLayout(lowerLayout); this->setLayout(layout); }
// ----------------------------------------------------------------------------- SettingsDialog::SettingsDialog(QWidget *pp, bool track_en, bool track_btn_en, const TrackSettings &track, const QString &logfile, const int logbufsize) : QDialog(pp), m_devctrls(0), m_rotation(90), m_colortrack_en(track_en) { setupUi(this); // label the color tracking button appropriately if (m_colortrack_en) btnToggleTracking->setText("Disable Tracking"); else btnToggleTracking->setText("Enable Tracking"); //btnToggleTracking->setEnabled(track_btn_en); // add a vertical spacer at some absurdly high row index ((QGridLayout *)deviceControlScrollAreaContents->layout())->addItem( new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding), 99999, 0, 1, 1); // connect primary button events connect(btnLogFile, SIGNAL(released()), this, SLOT(onBrowseClicked())); connect(btnCancel, SIGNAL(released()), this, SLOT(onCancelClicked())); connect(btnOK, SIGNAL(released()), this, SLOT(onOkClicked())); connect(btnApply, SIGNAL(released()), this, SLOT(onApplyClicked())); connect(btnNewColor, SIGNAL(released()), this, SLOT(onNewColorClicked())); // assign specified color and threshold values to dialog widgets /* sbR->setValue(track.color.red()); sbG->setValue(track.color.green()); sbB->setValue(track.color.blue()); sbHt->setValue(track.ht); sbSt->setValue(track.st); sbFt->setValue(track.ft); //Set Initial Tracking FPS sbTrackingFps->setValue(10); */ //TODO: Set LogFile Value editLogFileName->setText(logfile); sbLogBuffer->setValue(logbufsize); }
InitSeafileDialog::InitSeafileDialog(QWidget *parent) : QDialog(parent) { setupUi(this); setWindowTitle(tr("%1 Initialization").arg(getBrand())); setWindowIcon(QIcon(":/images/seafile.png")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); connect(mChooseDirBtn, SIGNAL(clicked()), this, SLOT(chooseDir())); connect(mOkBtn, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(mCancelBtn, SIGNAL(clicked()), this, SLOT(onCancelClicked())); mTitle->setStyleSheet("QLabel { color : #0099EE; }"); //disk42 mLogo->setPixmap(QPixmap(":/images/seafile-32.png")); mDirectory->setText(getInitialPath()); const QRect screen = QApplication::desktop()->screenGeometry(); move(screen.center() - this->rect().center()); }
void Logic::setupRoom(bool isStarted, GameInfo *gameInfo) { if(!init_before_start && !isStarted) { connect(gui->getDecisionArea(),SIGNAL(okClicked()),this,SLOT(onOkClicked())); connect(gui->getDecisionArea(),SIGNAL(cancelClicked()),this,SLOT(onCancelClicked())); connect(gui->getBPArea(),SIGNAL(roleReady()),this,SLOT(roleAnalyse())); dataInterface->setupRoom(isStarted); gui->setupRoom(isStarted); normal(); init_before_start = true; #ifdef DEBUG ready(); #endif } else if(!init_after_start && isStarted){ dataInterface->initPlayerList(gameInfo); dataInterface->setupRoom(isStarted); gui->setupRoom(isStarted); init_after_start = true; } }
void Logic::setupRoom(bool isStarted, GameInfo *gameInfo) { if(!init_before_start && !isStarted) { connect(gui->getDecisionArea(),SIGNAL(okClicked()),this,SLOT(onOkClicked())); dataInterface->setupRoom(isStarted); gui->setupRoom(isStarted); normal(); init_before_start = true; } else if(!init_after_start && isStarted){ dataInterface->initPlayerList(gameInfo); dataInterface->setupRoom(isStarted); gui->setupRoom(isStarted); init_after_start = true; if(myID != GUEST){ network::ReadyForGameRequest* ready = new ReadyForGameRequest; ready->set_type(ReadyForGameRequest_Type_SEAT_READY); emit sendCommand(network::MSG_READY_GAME_REQ, ready); } } }
GameSetup::GameSetup(QWidget *parent) : ui(new Ui::GameSetup) { settings = new GameSettings(); setCaption(i18n("Setup GameOfLife")); setButtons(Ok|Cancel|Help|Default); setDefaultButton(Ok); setModal(true); showButtonSeparator(true); setButtonText(Help, i18n("A&bout")); QWidget *main = new QWidget(this); setMainWidget(main); ui->setupUi(main); ui->boxShapes->addItem("Rectangle"); ui->boxShapes->addItem("Rounded rectangle"); ui->boxShapes->addItem("Ellipse"); cell = QPixmap(71, 21); bkg = QPixmap(71, 21); connect(ui->sliderR, SIGNAL(valueChanged(int)), this, SLOT(onSliderRValueChanged(int))); connect(ui->sliderG, SIGNAL(valueChanged(int)), this, SLOT(onSliderGValueChanged(int))); connect(ui->sliderB, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int))); connect(ui->sliderR_2, SIGNAL(valueChanged(int)), this, SLOT(onSliderR_2ValueChanged(int))); connect(ui->sliderG_2, SIGNAL(valueChanged(int)), this, SLOT(onSliderG_2ValueChanged(int))); connect(ui->sliderB_2, SIGNAL(valueChanged(int)), this, SLOT(onSliderB_2ValueChanged(int))); connect(this, SIGNAL(okClicked()), SLOT(onOkClicked())); connect(this, SIGNAL(helpClicked()), SLOT(onHelpClicked())); connect(this, SIGNAL(defaultClicked()), SLOT(onDefaultClicked())); ShowSettings(); }
LteLicenseToolDialog::LteLicenseToolDialog(QWidget *parent) : QDialog(parent) { hostNameLabel = new QLabel(tr("Host Name:")); hostNameEdit = new QLineEdit; hostNameLabel->setBuddy(hostNameEdit); hardwareNameLabel = new QLabel(tr("Hardware Name:")); hardwareNameEdit = new QLineEdit; hardwareNameLabel->setBuddy(hardwareNameEdit); validPeriodLabel = new QLabel(tr("Valid Period (days):")); validPeriodEdit = new QLineEdit; validPeriodLabel->setBuddy(validPeriodEdit); QGridLayout *layout1 = new QGridLayout; layout1->addWidget(hostNameLabel, 0, 0); layout1->addWidget(hostNameEdit, 0, 1, 1, 2); layout1->addWidget(hardwareNameLabel, 1, 0); layout1->addWidget(hardwareNameEdit, 1, 1, 1, 2); layout1->addWidget(validPeriodLabel, 3, 0); layout1->addWidget(validPeriodEdit, 3, 1, 1, 2); btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(btnBox, SIGNAL(accepted()), this, SLOT(accept())); connect(btnBox, SIGNAL(accepted()), this, SLOT(onOkClicked())); connect(btnBox, SIGNAL(rejected()), this, SLOT(reject())); QVBoxLayout *layout = new QVBoxLayout; layout->addLayout(layout1); layout->addSpacing(10); layout->addWidget(btnBox); log.setFileName("./log.txt"); log.open(QIODevice::Append); setLayout(layout); setWindowTitle(tr("LTE License Tool")); }
void FingerprinterProgressBar::stop( bool finished ) { setRunning( false ); m_timer.stop(); if ( m_stopped ) { m_stopped = false; // If we had asked it to stop, just close the dialog onOkClicked(); ui.stopButton->setEnabled( true ); } else { ui.infoLabel->setText( tr( "Done. Thanks!" ) ); ui.trackLabel->setText( "" ); ui.etaLabel->setText( timeToString( 0 ) ); ui.okButton->setVisible( true ); ui.stopButton->setVisible( false ); } }
void PowerManagementDialog::onButtonChanged(CatalogView *catalog, ContentView *item, int user_data) { if (!item || !item->data()) { return; } OData *selected = item->data(); if(interval_selected_) { interval_selected_->insert(TAG_CHECKED, false); } selected->insert(TAG_CHECKED, true); interval_selected_ = selected; catalog->update(); onyx::screen::watcher().enqueue(catalog, onyx::screen::ScreenProxy::GU); int i = interval_selected_->value(TITLE_INDEX).toInt(); standby_interval_ = DISPLAY_ITEMS[i].standby_seconds; shutdown_interval_ = DISPLAY_ITEMS[i].shutdown_seconds; onOkClicked(); }
void TextInputDialog::onTextAccepted(MyGUI::Edit *_sender) { onOkClicked(_sender); }
ExportGroupTemplateDialog::ExportGroupTemplateDialog(NodeCollection* group, Gui* gui, QWidget* parent) : QDialog(parent) , _imp( new ExportGroupTemplateDialogPrivate(group, gui) ) { _imp->mainLayout = new QGridLayout(this); _imp->idLabel = new Label(tr("Unique ID"), this); QString idTt = GuiUtils::convertFromPlainText(tr("The unique ID is used by " NATRON_APPLICATION_NAME "to identify the plug-in in various " "places in the application. Generally this contains domain and sub-domains names " "such as fr.inria.group.XXX. If 2 plug-ins happen to have the same ID they will be " "gathered by version. If 2 plug-ins have the same ID and version, the first loaded in the" " search-paths will take precedence over the other."), Qt::WhiteSpaceNormal); _imp->idEdit = new LineEdit(this); _imp->idEdit->setPlaceholderText( QString::fromUtf8("org.organization.pyplugs.XXX") ); _imp->idEdit->setToolTip(idTt); _imp->labelLabel = new Label(tr("Label"), this); QString labelTt = GuiUtils::convertFromPlainText(tr("Set the label of the group as the user will see it in the user interface."), Qt::WhiteSpaceNormal); _imp->labelLabel->setToolTip(labelTt); _imp->labelEdit = new LineEdit(this); _imp->labelEdit->setPlaceholderText( QString::fromUtf8("MyPlugin") ); QObject::connect( _imp->labelEdit, SIGNAL(editingFinished()), this, SLOT(onLabelEditingFinished()) ); _imp->labelEdit->setToolTip(labelTt); _imp->groupingLabel = new Label(tr("Grouping"), this); QString groupingTt = GuiUtils::convertFromPlainText(tr("The grouping of the plug-in specifies where the plug-in will be located in the menus. " "E.g: Color/Transform, or Draw. Each sub-level must be separated by a '/'."), Qt::WhiteSpaceNormal); _imp->groupingLabel->setToolTip(groupingTt); _imp->groupingEdit = new LineEdit(this); _imp->groupingEdit->setPlaceholderText( QString::fromUtf8("Color/Transform") ); _imp->groupingEdit->setToolTip(groupingTt); _imp->iconPathLabel = new Label(tr("Icon relative path"), this); QString iconTt = GuiUtils::convertFromPlainText(tr("Set here the file path of an optional icon to identify the plug-in. " "The path is relative to the Python script."), Qt::WhiteSpaceNormal); _imp->iconPathLabel->setToolTip(iconTt); _imp->iconPath = new LineEdit(this); _imp->iconPath->setPlaceholderText( QString::fromUtf8("Label.png") ); _imp->iconPath->setToolTip(iconTt); _imp->descriptionLabel = new Label(tr("Description"), this); QString descTt = GuiUtils::convertFromPlainText(tr("Set here the (optional) plug-in description that the user will see when clicking the " " \"?\" button on the settings panel of the node."), Qt::WhiteSpaceNormal); _imp->descriptionEdit = new PlaceHolderTextEdit(this); _imp->descriptionEdit->setToolTip(descTt); _imp->descriptionEdit->setPlaceHolderText( tr("This plug-in can be used to produce XXX effect...") ); _imp->fileLabel = new Label(tr("Directory"), this); QString fileTt = GuiUtils::convertFromPlainText(tr("Specify here the directory where to export the Python script."), Qt::WhiteSpaceNormal); _imp->fileLabel->setToolTip(fileTt); _imp->fileEdit = new LineEdit(this); _imp->fileEdit->setToolTip(fileTt); QPixmap openPix; appPTR->getIcon(NATRON_PIXMAP_OPEN_FILE, NATRON_MEDIUM_BUTTON_ICON_SIZE, &openPix); _imp->openButton = new Button(QIcon(openPix), QString(), this); _imp->openButton->setFocusPolicy(Qt::NoFocus); _imp->openButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); QObject::connect( _imp->openButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()) ); _imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel), Qt::Horizontal, this); QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(onOkClicked()) ); QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) ); _imp->mainLayout->addWidget(_imp->idLabel, 0, 0, 1, 1); _imp->mainLayout->addWidget(_imp->idEdit, 0, 1, 1, 2); _imp->mainLayout->addWidget(_imp->labelLabel, 1, 0, 1, 1); _imp->mainLayout->addWidget(_imp->labelEdit, 1, 1, 1, 2); _imp->mainLayout->addWidget(_imp->groupingLabel, 2, 0, 1, 1); _imp->mainLayout->addWidget(_imp->groupingEdit, 2, 1, 1, 2); _imp->mainLayout->addWidget(_imp->iconPathLabel, 3, 0, 1, 1); _imp->mainLayout->addWidget(_imp->iconPath, 3, 1, 1, 2); _imp->mainLayout->addWidget(_imp->descriptionLabel, 4, 0, 1, 1); _imp->mainLayout->addWidget(_imp->descriptionEdit, 4, 1, 1, 2); _imp->mainLayout->addWidget(_imp->fileLabel, 5, 0, 1, 1); _imp->mainLayout->addWidget(_imp->fileEdit, 5, 1, 1, 1); _imp->mainLayout->addWidget(_imp->openButton, 5, 2, 1, 1); _imp->mainLayout->addWidget(_imp->buttons, 6, 0, 1, 3); resize( 400, sizeHint().height() ); }
void Logic::getCommand(unsigned short proto_type, google::protobuf::Message* proto) { QMutexLocker locker(&mutex); TipArea *tipArea; DecisionArea* decisionArea; BPArea* bpArea; SafeList<int> roleIDs; PlayerArea* playerArea; int targetID,roleID,howMany,num; QString arg[10]; network::RoleRequest* char_pick; switch (proto_type) { case network::MSG_ROOMLIST_REP: lobby->fill((network::RoomListResponse*) proto); break; case network::MSG_GAME: { network::GameInfo* game_info = (network::GameInfo*) proto; if(game_info->has_player_id()){ myID = game_info->player_id(); dataInterface->setID(myID); cleanRoom(); if(myID == GUEST) gui->logAppend(QStringLiteral("<font color=\'pink\'>房间已满,进入观战模式</font>")); else gui->logAppend(QStringLiteral("<font color=\'pink\'>请准备</font>")); } if(game_info->has_room_id()){ gui->getTeamArea()->setRoomID(game_info->room_id()); } setupRoom(game_info->is_started(), game_info); for (int i = 0; i < game_info->player_infos_size(); ++i) { network::SinglePlayerInfo* player_info = (network::SinglePlayerInfo*)&(game_info->player_infos(i)); targetID = player_info->id(); if(player_info->has_role_id()) { roleID = player_info->role_id(); roles[targetID] = roleID; count++; } if(player_info->has_nickname()){ dataInterface->setNickName(targetID, QString::fromStdString(player_info->nickname())); } if(player_info->has_team()){ dataInterface->getPlayerById(targetID)->setTeam(player_info->team()); } gui->getPlayerArea()->getPlayerItem(targetID)->setReady(player_info->ready()); } if(count==dataInterface->getPlayerMax()) { disconnect(getClient(),0,this,0); disconnect(gui->getDecisionArea(), 0, this, 0); for(int i=0;i<dataInterface->getPlayerMax();i++){ dataInterface->getPlayerList().at(i)->setRole(roles[i]); gui->getPlayerArea()->getPlayerItem(i)->setToolTip(dataInterface->getRoleSkillInfo(roles[i])); } roleID = myID == GUEST ? roles[0] : roles[myID]; setMyRole(roleID); network::GameInfo* toRole = new network::GameInfo; toRole->CopyFrom(*game_info); myRole->decipher(network::MSG_GAME, toRole); } gui->getPlayerArea()->update(); break; } case network::MSG_GOSSIP: if(gui!=NULL) { network::Gossip* gossip = (network::Gossip*) proto; gui->chatAppend(gossip->id(), QString::fromStdString(gossip->txt())); } break; case network::MSG_ERROR: { network::Error* error = (network::Error*)proto; if(error->dst_id() == myID){ gui->reset(); } switch(error->id()) { //GE_DISCONNECTED case GE_DISCONNECTED: { int targetId = error->dst_id(); gui->logAppend(QStringLiteral("<font color=\'red\'>玩家") + QString::number(targetId) + QStringLiteral("离开房间</font>")); dataInterface->setNickName(targetId, ""); dataInterface->getPlayerById(targetId)->setTeam(-1); gui->getPlayerArea()->getPlayerItem(targetId)->setReady(false); gui->getPlayerArea()->update(); break; } case GE_NOT_WELCOME: gui->logAppend(QStringLiteral("<font color=\'red\'>这个房主比较高冷,下个房间见。。</font>")); break; case GE_WRONG_PASSWORD: gui->logAppend(QStringLiteral("<font color=\'red\'>瞎蒙果然是不行的。。</font>")); break; default: gui->logAppend(QStringLiteral("<font color=\'red\'>错误代码") + QString::number(error->id()) + "</font>"); break; } break; } //选择角色 case network::MSG_ROLE_REQ: state=46; char_pick = (network::RoleRequest*) proto; tipArea=gui->getTipArea(); decisionArea=gui->getDecisionArea(); tipArea->reset(); howMany=char_pick->role_ids_size(); for(int i=0;i<howMany;i++){ roleID=char_pick->role_ids(i); tipArea->addBoxItem(QString::number(roleID)+"."+dataInterface->getRoleName(roleID)); } tipArea->setMsg(QStringLiteral("请选择角色:")); tipArea->showBox(); decisionArea->enable(0); gui->alert(); break; case 51: // TODO:BP模式,暂不可用 state = 51; tipArea=gui->getTipArea(); decisionArea=gui->getDecisionArea(); bpArea = gui->getBPArea(); tipArea->reset(); connect(decisionArea,SIGNAL(okClicked()),this,SLOT(onOkClicked())); connect(bpArea,SIGNAL(roleReady()),this,SLOT(roleAnalyse())); num = arg[1].toInt(); for(int i=0;i<num;i++) { roleIDs<<arg[i+2].toInt(); } bpArea->BPStart(num, roleIDs); break; case 52: // TODO:BP模式,暂不可用 state = 52; bpArea = gui->getBPArea(); bpArea->setMsg("请禁用一角色"); bpArea->setQuota(1); bpArea->enableAll(); playerArea = gui->getPlayerArea(); gui->alert(); break; case 55: // TODO:BP模式,暂不可用 state = 55; bpArea = gui->getBPArea(); bpArea->setMsg("请选择一角色"); bpArea->setQuota(1); bpArea->enableAll(); playerArea = gui->getPlayerArea(); gui->alert(); break; case 54: // TODO:BP模式,暂不可用 bpArea = gui->getBPArea(); bpArea->ban(arg[1].toInt(), arg[2].toInt()); break; case 57: // TODO:BP模式,暂不可用 bpArea = gui->getBPArea(); bpArea->choose(arg[1].toInt(), arg[2].toInt()); decisionArea = gui->getDecisionArea(); if(bpArea->checkOver()) { bpArea->setVisible(0); disconnect(decisionArea,SIGNAL(okClicked()),this,SLOT(onOkClicked())); disconnect(bpArea,SIGNAL(roleReady()),this,SLOT(roleAnalyse())); } break; case 59: // TODO:BP模式,暂不可用 if(gui!=NULL) gui->chatAppend(arg[1].toInt(),arg[2]); break; } delete proto; }
ImportTensorWindow::ImportTensorWindow(QWidget *parent, int nDimension, int nCompCount) : QDialog(parent) { setWindowTitle(tr("Enter the tensor")); m_nameLabel = new QLabel(this); m_nameLabel->setText(tr("Enter the name:")); m_nameLine = new QLineEdit(this); m_nameLine->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_importButton = new QPushButton(this); m_importButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_importButton->setText(tr("Import")); m_importButton->setVisible(false); m_okButton = new QPushButton(this); m_okButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_okButton->setText(tr("OK")); m_cancelButton = new QPushButton(this); m_cancelButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_cancelButton->setText(tr("Cancel")); m_inputTabsWidget = new TabsWidget(this); QString matrixName = ""; int matrixNumber = 1; while(matrixNumber < nCompCount + 1) { matrixName.append(tr("Matrix %1").arg(matrixNumber)); m_inputTabsWidget->addTab(new MatrixViewWidget(nDimension, nDimension), matrixName); matrixName.clear(); matrixNumber++; } QFormLayout* nameLayout = new QFormLayout; nameLayout->addRow(m_nameLabel, m_nameLine); QHBoxLayout* importLayout = new QHBoxLayout; importLayout->addWidget(m_importButton); importLayout->setAlignment(Qt::AlignLeft); QHBoxLayout* okCancelLayout = new QHBoxLayout; okCancelLayout->addWidget(m_okButton); okCancelLayout->addWidget(m_cancelButton); okCancelLayout->setAlignment(Qt::AlignRight); QHBoxLayout* buttonLayout = new QHBoxLayout; buttonLayout->addLayout(importLayout); buttonLayout->addLayout(okCancelLayout); QVBoxLayout* mainLayout = new QVBoxLayout; mainLayout->addLayout(nameLayout); mainLayout->addWidget(m_inputTabsWidget); mainLayout->addLayout(buttonLayout); this->setLayout(mainLayout); connect(m_importButton, SIGNAL(clicked()), this, SLOT(onImportClicked())); connect(m_okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(onCancelClicked())); }
void MyMessageBox::onOkClicked() { disconnect(okButton, SIGNAL(clicked()), this, SLOT(onOkClicked())); mRetCode = QDialog::Accepted; close(); }
EditNodeViewerContextDialog::EditNodeViewerContextDialog(const KnobIPtr& knob, QWidget* parent) : QDialog(parent) , _imp(new EditNodeViewerContextDialogPrivate(knob)) { setWindowTitle(tr("Edit %1 viewer interface").arg(QString::fromUtf8(knob->getName().c_str()))); _imp->vLayout = new QVBoxLayout(this); _imp->vLayout->setContentsMargins(0, 0, TO_DPIX(15), 0); _imp->mainContainer = new QWidget(this); _imp->mainLayout = new QFormLayout(_imp->mainContainer); _imp->mainLayout->setLabelAlignment(Qt::AlignVCenter | Qt::AlignRight); _imp->mainLayout->setFormAlignment(Qt::AlignVCenter | Qt::AlignLeft); _imp->mainLayout->setSpacing(TO_DPIX(3)); _imp->mainLayout->setContentsMargins(0, 0, TO_DPIX(15), 0); _imp->vLayout->addWidget(_imp->mainContainer); if (knob->isUserKnob()) { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); _imp->viewerUILabelLabel = new Label(tr("Viewer Interface Label:"), this); _imp->viewerUILabelEdit = new LineEdit(rowContainer); QString labelTooltip = NATRON_NAMESPACE::convertFromPlainText(tr("The text label of the parameter that will appear in its viewer interface"), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->viewerUILabelEdit->setToolTip(labelTooltip); _imp->viewerUILabelLabel->setToolTip(labelTooltip); if (knob) { _imp->viewerUILabelEdit->setText( QString::fromUtf8( knob->getInViewerContextLabel().c_str() ) ); } rowLayout->addWidget(_imp->viewerUILabelEdit); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->viewerUILabelLabel, rowContainer); } KnobButtonPtr isButtonKnob = toKnobButton(knob); if (knob->isUserKnob()) { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); QString text; if (isButtonKnob) { text = tr("Button Checked Icon:"); } else { text = tr("Icon label:"); } QString tooltip; if (isButtonKnob) { tooltip = NATRON_NAMESPACE::convertFromPlainText(tr("The icon of the button when checked"), NATRON_NAMESPACE::WhiteSpaceNormal); } else { tooltip = NATRON_NAMESPACE::convertFromPlainText(tr("This icon will be used instead of the text label"), NATRON_NAMESPACE::WhiteSpaceNormal); } _imp->checkedIconLabel = new Label(text, this); _imp->checkedIconLineEdit = new LineEdit(rowContainer); _imp->checkedIconLineEdit->setToolTip(tooltip); _imp->checkedIconLabel->setToolTip(tooltip); _imp->checkedIconLineEdit->setText( QString::fromUtf8( knob->getInViewerContextIconFilePath(true).c_str() ) ); rowLayout->addWidget(_imp->checkedIconLineEdit); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->checkedIconLabel, rowContainer); } if (isButtonKnob && knob->isUserKnob()) { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); QString text; text = tr("Button Unchecked Icon:"); QString tooltip; tooltip = NATRON_NAMESPACE::convertFromPlainText(tr("The icon of the button when unchecked"), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->uncheckedIconLabel = new Label(text, this); _imp->uncheckedIconLineEdit = new LineEdit(rowContainer); _imp->uncheckedIconLineEdit->setToolTip(tooltip); _imp->uncheckedIconLabel->setToolTip(tooltip); _imp->uncheckedIconLineEdit->setText( QString::fromUtf8( knob->getInViewerContextIconFilePath(false).c_str() ) ); rowLayout->addWidget(_imp->uncheckedIconLineEdit); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->uncheckedIconLabel, rowContainer); } { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); QString text = tr("Layout Type:"); QString tooltip = NATRON_NAMESPACE::convertFromPlainText(tr("The layout type for this parameter"), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->layoutTypeLabel = new Label(text, this); _imp->layoutTypeChoice = new ComboBox(rowContainer); _imp->layoutTypeLabel->setToolTip(tooltip); _imp->layoutTypeChoice->setToolTip(tooltip); _imp->layoutTypeChoice->addItem(tr("Spacing (px)"), QIcon(), QKeySequence(), tr("The spacing in pixels to add after the parameter")); _imp->layoutTypeChoice->addItem(tr("Separator"), QIcon(), QKeySequence(), tr("A vertical line will be added after the parameter")); _imp->layoutTypeChoice->addItem(tr("Stretch After"), QIcon(), QKeySequence(), tr("The layout will be stretched between this parameter and the next")); _imp->layoutTypeChoice->addItem(tr("New Line"), QIcon(), QKeySequence(), tr("A new line will be added after this parameter")); ViewerContextLayoutTypeEnum type = knob->getInViewerContextLayoutType(); _imp->layoutTypeChoice->setCurrentIndex_no_emit((int)type); QObject::connect(_imp->layoutTypeChoice, SIGNAL(currentIndexChanged(int)), this, SLOT(onLayoutTypeChoiceChanged(int))); rowLayout->addWidget(_imp->layoutTypeChoice); _imp->itemSpacingSpinbox = new SpinBox(rowContainer, SpinBox::eSpinBoxTypeInt); _imp->itemSpacingSpinbox->setMinimum(0); _imp->itemSpacingSpinbox->setValue(_imp->knob->getInViewerContextItemSpacing()); _imp->itemSpacingSpinbox->setVisible(_imp->layoutTypeChoice->activeIndex() == 0); _imp->itemSpacingSpinbox->setToolTip(NATRON_NAMESPACE::convertFromPlainText(tr("The spacing in pixels to add after the parameter"), NATRON_NAMESPACE::WhiteSpaceNormal)); rowLayout->addWidget(_imp->itemSpacingSpinbox); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->layoutTypeLabel, rowContainer); } { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); QString text = tr("Hidden:"); QString tooltip = NATRON_NAMESPACE::convertFromPlainText(tr("When checked, the parameter will be hidden from the viewer interface"), NATRON_NAMESPACE::WhiteSpaceNormal); _imp->hiddenLabel = new Label(text, this); _imp->hiddenCheckbox = new AnimatedCheckBox(rowContainer); _imp->hiddenLabel->setToolTip(tooltip); _imp->hiddenCheckbox->setToolTip(tooltip); _imp->hiddenCheckbox->setChecked(knob->getInViewerContextSecret()); rowLayout->addWidget(_imp->hiddenCheckbox); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->hiddenLabel, rowContainer); } /* if (isButtonKnob) { QWidget* rowContainer = new QWidget(this); QHBoxLayout* rowLayout = new QHBoxLayout(rowContainer); rowLayout->setContentsMargins(0, 0, 0, 0); QString text = tr("Add to Shortcut Editor:"); QString tooltip = GuiUtils::convertFromPlainText(tr("When checked, the parameter can be attributed a shortcut from the Shortcut Editor"), Qt::WhiteSpaceNormal); _imp->addToShortcutEditorLabel = new Label(text, this); _imp->addToShortcutEditorCheckbox = new AnimatedCheckBox(rowContainer); _imp->addToShortcutEditorLabel->setToolTip(tooltip); _imp->addToShortcutEditorCheckbox->setToolTip(tooltip); _imp->addToShortcutEditorCheckbox->setChecked(knob->getInViewerContextHasShortcut()); rowLayout->addWidget(_imp->addToShortcutEditorCheckbox); rowLayout->addStretch(); _imp->mainLayout->addRow(_imp->addToShortcutEditorLabel, rowContainer); }*/ QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel), Qt::Horizontal, this); QObject::connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) ); QObject::connect( buttons, SIGNAL(accepted()), this, SLOT(onOkClicked()) ); _imp->vLayout->addWidget(buttons); }