NewProfileCommentDialog::NewProfileCommentDialog(QWidget *aParent,
        MController* aController,
        const QString& aCommentedProfile,
        const QString& aSubject,
        Profile& aSelectedProfile,
        ProfileCommentListingModel& aCommentListingModel,
        const Hash& aReferencesMsg,
        const Hash& aReferencesCa,
        const Hash& aRecipientsNode)
    : TextEdit(aParent,
               aController,
               aSelectedProfile),
    iRecipientsNode(aRecipientsNode),
    iCommentListingModel(aCommentListingModel) {
    ui.setupUi(this) ;
    initializeTextEditor(ui.messageEdit,
                         ui.gridLayout,
                         ui.toolBoxLayoutUpper,
                         ui.toolBoxLayoutLower) ;
    iReferencesMsg = aReferencesMsg ;
    iReferencesCa = aReferencesCa ;

    ui.subjectEdit->setText(aSubject) ;
    ui.commentedProfileEdit->setText(aCommentedProfile) ;
    iAttachmentListLabel = ui.attahcmentsListLabel ;
    connect(ui.attachButton, SIGNAL(clicked()),
            this, SLOT(attachButtonClicked()));
    connect(ui.bottomButtonsBox, SIGNAL(accepted()), this, SLOT(okButtonClicked()));
    connect(ui.bottomButtonsBox, SIGNAL(rejected()), this, SLOT(cancelButtonClicked()));
    ui.messageEdit->setFocus(Qt::PopupFocusReason) ;
}
RKDebugConsole::RKDebugConsole (QWidget *parent, bool tool_window, const char *name) : RKMDIWindow (parent, DebugConsoleWindow, tool_window, name) {
	RK_TRACE (APP);

	QVBoxLayout *main_layout = new QVBoxLayout (this);
	main_layout->setContentsMargins (0, 0, 0, 0);
	QHBoxLayout *upper_layout = new QHBoxLayout ();
	main_layout->addLayout (upper_layout);

	context_view = new QTextEdit (this);
	context_view->setReadOnly (true);
	context_view->setAcceptRichText (false);
	upper_layout->addWidget (context_view);

	QVBoxLayout *button_layout = new QVBoxLayout ();
	upper_layout->addLayout (button_layout);
	step_button = new QPushButton (i18n ("Next"), this);
	connect (step_button, SIGNAL (clicked()), this, SLOT (stepButtonClicked()));
	button_layout->addWidget (step_button);
	step_out_button = new QPushButton (i18n ("Step out"), this);
	connect (step_out_button, SIGNAL (clicked()), this, SLOT (stepOutButtonClicked()));
	RKCommonFunctions::setTips (i18n ("<p>Continue until the caller of this function is reached (unless another debug statement is hit, earlier)</p>"
	                                  "<p><b>Note:</b> In some cases, the calling function will never be reached, because the call was the last step in the caller."
	                                  "In these cases, the behavior is identical to 'Continue'.</p>"), step_out_button);
	button_layout->addWidget (step_out_button);
	continue_button = new QPushButton (i18n ("Continue"), this);
	connect (continue_button, SIGNAL (clicked()), this, SLOT (continueButtonClicked()));
	button_layout->addWidget (continue_button);
	cancel_button = new QPushButton (i18n ("Cancel"), this);
	connect (cancel_button, SIGNAL (clicked()), this, SLOT (cancelButtonClicked()));
	button_layout->addWidget (cancel_button);
	button_layout->addStretch ();

	QHBoxLayout *lower_layout = new QHBoxLayout ();
	main_layout->addLayout (lower_layout);

	prompt_label = new QLabel (this);
	lower_layout->addWidget (prompt_label);
	reply_edit = new KHistoryComboBox (this);
	reply_edit->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
	connect (reply_edit, SIGNAL (returnPressed()), this, SLOT (sendReply()));
	lower_layout->addWidget (reply_edit);
	setFocusProxy (reply_edit);

	setFocusPolicy (Qt::StrongFocus);

	setPart (new RKDummyPart (this, this));
	initializeActivationSignals ();

	connect (RKDebugHandler::instance (), SIGNAL (newDebugState()), this, SLOT (newDebugState()));
	newDebugState ();
}
void ZmdServerDialog::initGUI()
{

  layout = new QVBoxLayout(this);
  nameLabel = new QLabel(i18n("Please enter server name below"), this);
  serverLabel = new QLabel(i18n("Please enter server URL below"), this);
  nameEdit = new KLineEdit(this);
  serverEdit = new KLineEdit(this);
  typeGroup = new QButtonGroup(2, Qt::Vertical, i18n("Server Type"), this);
  QRadioButton *zButton = new QRadioButton("ZYPP", typeGroup);
  QRadioButton *yButton = new QRadioButton("YUM", typeGroup);
  QRadioButton *aButton = new QRadioButton("ZENworks", typeGroup);
  QRadioButton *mButton = new QRadioButton("Mount", typeGroup);
  QRadioButton *nButton = new QRadioButton(i18n("NU Server"), typeGroup);
  QRadioButton *rButton = new QRadioButton(i18n("RCE Server"), typeGroup);
  cancelButton = new KPushButton(KStdGuiItem::cancel(), this);
  addButton = new KPushButton(KStdGuiItem::add(), this);

  layout->addWidget(nameLabel, 0, 0);
  layout->addWidget(nameEdit, 0, 0);
  layout->addWidget(serverLabel, 0, 0);
  layout->addWidget(serverEdit, 0, 0);
  layout->addWidget(typeGroup, 0, 0);
  layout->setMargin(10);
  layout->setSpacing(5);

  typeGroup->setExclusive(true);
  typeGroup->insert(zButton, TYPE_ZYPP);
  typeGroup->insert(yButton, TYPE_YUM);
  typeGroup->insert(aButton, TYPE_ZEN);
  typeGroup->insert(mButton, TYPE_MOUNT);
  typeGroup->insert(nButton, TYPE_NU);
  typeGroup->insert(rButton, TYPE_RCE);
  typeGroup->setButton(TYPE_ZYPP);

  buttonLayout = new QHBoxLayout(layout);
  buttonLayout->addWidget(cancelButton, 0, Qt::AlignLeft);
  buttonLayout->addSpacing(100);
  buttonLayout->addWidget(addButton, 0, Qt::AlignRight);
  addButton->setDefault(true);

  connect(addButton, SIGNAL(clicked()),
          this, SLOT(addButtonClicked()));

  connect(cancelButton, SIGNAL(clicked()),
          this, SLOT(cancelButtonClicked()));

  layout->setMargin(20);
  setCaption(i18n("Add Server"));
  show();
}
示例#4
0
TrackExportDlg::TrackExportDlg(QWidget *parent,
                               UserSettingsPointer pConfig,
                               TrackExportWorker* worker)
        : QDialog(parent),
          Ui::DlgTrackExport(),
          m_pConfig(pConfig),
          m_worker(worker) {
    setupUi(this);
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
    exportProgress->setMinimum(0);
    exportProgress->setMaximum(1);
    exportProgress->setValue(0);
    statusLabel->setText("");
    setModal(true);

    connect(m_worker, SIGNAL(progress(QString, int, int)), this,
            SLOT(slotProgress(QString, int, int)));
    connect(m_worker,
            SIGNAL(askOverwriteMode(QString, std::promise<TrackExportWorker::OverwriteAnswer>*)),
            this,
            SLOT(slotAskOverwriteMode(QString, std::promise<TrackExportWorker::OverwriteAnswer>*)));
    connect(m_worker, SIGNAL(canceled()), this, SLOT(cancelButtonClicked()));
}
InteractiveObjectDetectionFrame::InteractiveObjectDetectionFrame( QWidget *parent )
  : QWidget( parent )
  , user_cmd_action_client_("object_detection_user_command", true)
  , action_requested_(false)
  , root_nh_("")
  , priv_nh_("~")
  , executing_thread_(0)
  , ui_( new Ui::MainFrame )
{
  ui_->setupUi( this );
  connect( ui_->seg_button_, SIGNAL( clicked() ), this, SLOT( segButtonClicked() ));
  connect( ui_->rec_button_, SIGNAL( clicked() ), this, SLOT( recButtonClicked() ));
  connect( ui_->det_button_, SIGNAL( clicked() ), this, SLOT( detButtonClicked() ));
  connect( ui_->cancel_button_, SIGNAL( clicked() ), this, SLOT( cancelButtonClicked() ));
}
PreferencesDialog::PreferencesDialog(QWidget *parent) :
    QDialog(parent)
{
    okButtonPressed = false;
    setWindowTitle(tr("User Settings"));
    mainLayout = new QVBoxLayout();
    setLayout(mainLayout);

    tabs = new QTabWidget(this);
    mainLayout->addWidget(tabs);
    this->setFont(global.getGuiFont(font()));

    this->setupAppearancePanel();
    this->setupLocalePanel();
    this->setupSyncPanel();
    this->setupSearchPanel();
    this->setupDebugPanel();

    cancelButton = new QPushButton(tr("Cancel"), this);
    okButton = new QPushButton(tr("OK"), this);

    connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));

    QSpacerItem *spacer1 = new QSpacerItem(0,0,QSizePolicy::MinimumExpanding);
    QSpacerItem *spacer2 = new QSpacerItem(0,0,QSizePolicy::MinimumExpanding);


    buttonLayout = new QHBoxLayout();
    buttonLayout->addSpacerItem(spacer1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addSpacerItem(spacer2);
    buttonLayout->setStretch(0,100);
    buttonLayout->setStretch(3,100);

    mainLayout->addLayout(buttonLayout);

    connect(appearancePanel->showTrayIcon, SIGNAL(clicked(bool)),
            syncPanel->enableSyncNotifications, SLOT(setEnabled(bool)));
    syncPanel->enableSyncNotifications->setEnabled(appearancePanel->showTrayIcon->isChecked());
}
CheckUpdatesWorker::CheckUpdatesWorker(ProgramOptions *programOptions, QWidget *parentForm, QLabel *caption,
									   QProgressBar *progressBar, QAbstractButton *cancelButton, bool isUser)
	: QObject()
{
	this->programOptions = programOptions;
	this->parentForm = parentForm;
	this->caption = caption;
	this->progressBar = progressBar;
	this->cancelButton = cancelButton;
	this->isUser = isUser;
	// init updater
	updates = new Updates(programOptions->getApplicationPath());
	// signals
	connect(updates, SIGNAL(progressCheckUpdate(int)), this, SLOT(progressCheckUpdate(int)));
	connect(updates, SIGNAL(updatesChecked(bool)), this, SLOT(updatesChecked(bool)));
	connect(updates, SIGNAL(updatesCancelled()), this, SLOT(updatesCancelled()));
	connect(updates, SIGNAL(updateMessage(QString, QString)), this, SLOT(updateMessage(QString, QString)));
	//
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
}
void FeedDialog::initGUI() {
	layout = new QGridLayout(this);
	feedLabel = new QLabel(i18n("URL Of RSS Feed: "), this);
	feedEdit = new KLineEdit(this);
	okButton = new KPushButton(KStdGuiItem::ok(), this);
	cancelButton = new KPushButton(KStdGuiItem::cancel(), this);

	connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));

	layout->addMultiCellWidget(feedLabel, 0, 0, 0, 1);
	layout->addMultiCellWidget(feedEdit, 1, 1, 0, 1);
	layout->addWidget(okButton, 2, 0);
	layout->addWidget(cancelButton, 2, 1);
	layout->setSpacing(10);
	layout->setMargin(10);
	setCaption(i18n("Add Package Server Feed"));
	resize(350,50);
	show();
}
示例#9
0
文件: settings.cpp 项目: hhrt/tranrem
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) {

  okButton = new QPushButton(tr("&OK"));
  connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
  okButton->setEnabled(false);
  cancelButton = new QPushButton(tr("&Cancel"));
  connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));

  host = "";
  port = "";
  url  = "";
  autoRefresh = Qt::Unchecked;
  interval = 3;

  hostLineEdit = new QLineEdit();
  hostLineEdit->setText(host);
  connect(hostLineEdit, SIGNAL(textChanged(QString)), this, SLOT(hostChanged(QString)));
  portLineEdit = new QLineEdit();
  portLineEdit->setText(port);
  connect(portLineEdit, SIGNAL(textChanged(QString)), this, SLOT(portChanged(QString)));
  urlLineEdit  = new QLineEdit();
  urlLineEdit->setText(url);
  connect(urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(urlChanged(QString)));
  intervalSpinBox = new QSpinBox();
  intervalSpinBox->setMaximum(600);
  intervalSpinBox->setMinimum(3);
  intervalSpinBox->setValue(interval);
  intervalSpinBox->setEnabled(false);
  connect(intervalSpinBox, SIGNAL(valueChanged(int)), this, SLOT(intervalChanged(int)));
  autoRefreshCheckBox = new QCheckBox();
  autoRefreshCheckBox->setCheckState(autoRefresh); 
  connect(autoRefreshCheckBox, SIGNAL(stateChanged(int)), this, SLOT(autoRefreshChanged(int)));
  

  hostLabel = new QLabel(tr("Host name: "));
  hostLabel->setBuddy(hostLineEdit);
  portLabel = new QLabel(tr("Port: "));
  portLabel->setBuddy(portLineEdit);
  urlLabel  = new QLabel(tr("URL: "));
  urlLabel->setBuddy(urlLineEdit);
  intervalLabel = new QLabel(tr("Interval: "));
  intervalLabel->setBuddy(intervalSpinBox);
  autoRefreshLabel = new QLabel(tr("Auto Refresh: "));
  autoRefreshLabel->setBuddy(autoRefreshCheckBox);


  //Layouts
  QHBoxLayout *buttonsLayout = new QHBoxLayout();
  buttonsLayout->addWidget(okButton);
  buttonsLayout->addWidget(cancelButton);

  QHBoxLayout *hostLayout = new QHBoxLayout();
  hostLayout->addWidget(hostLabel);
  hostLayout->addWidget(hostLineEdit);

  QHBoxLayout *portLayout = new QHBoxLayout();
  portLayout->addWidget(portLabel);
  portLayout->addWidget(portLineEdit);

  QHBoxLayout *urlLayout = new QHBoxLayout();
  urlLayout->addWidget(urlLabel);
  urlLayout->addWidget(urlLineEdit);

  QHBoxLayout *autoRefreshLayout = new QHBoxLayout();
  autoRefreshLayout->addWidget(autoRefreshLabel);
  autoRefreshLayout->addWidget(autoRefreshCheckBox);

  QHBoxLayout *intervalLayout = new QHBoxLayout();
  intervalLayout->addWidget(intervalLabel);
  intervalLayout->addWidget(intervalSpinBox);

  QVBoxLayout *itemsLayout = new QVBoxLayout();
  itemsLayout->addLayout(hostLayout);
  itemsLayout->addLayout(portLayout);
  itemsLayout->addLayout(urlLayout);
  itemsLayout->addLayout(autoRefreshLayout);
  itemsLayout->addLayout(intervalLayout);
  
  QVBoxLayout *mainLayout = new QVBoxLayout();
  mainLayout->addLayout(itemsLayout);
  mainLayout->addLayout(buttonsLayout);

  setLayout(mainLayout);
};
示例#10
0
void ProxyEditWindow::createGui()
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QHBoxLayout *contentLayout = new QHBoxLayout();
    mainLayout->addItem(contentLayout);

    ProxyView = new QListView(this);
    ProxyView->setMinimumWidth(150);
    contentLayout->addWidget(ProxyView);

    ProxyModel = m_injectedFactory->makeInjected<NetworkProxyModel>(ProxyView);
    ProxyProxyModel = new NetworkProxyProxyModel(ProxyView);
    ProxyProxyModel->setSourceModel(ProxyModel);

    QAction *separator = new QAction(this);
    separator->setSeparator(true);

    AddProxyAction = new QAction(tr("Add new proxy"), this);

    ActionListModel *actionsModel = new ActionListModel(this);
    actionsModel->appendAction(separator);
    actionsModel->appendAction(AddProxyAction);

    QList<QAbstractItemModel *> models;
    models.append(ProxyProxyModel);
    models.append(actionsModel);

    ActionFilterProxyModel *actionProxyModel = new ActionFilterProxyModel(this);
    actionProxyModel->setSourceModel(MergedProxyModelFactory::createInstance(models, this));
    actionProxyModel->setModel(ProxyProxyModel);
    actionProxyModel->addHideWhenModelEmpty(separator);

    ProxyView->setModel(actionProxyModel);
    ProxyView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    ProxyView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    ProxyView->setIconSize(QSize(32, 32));
    connect(ProxyView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
            this, SLOT(proxySelectionChanged(const QItemSelection &, const QItemSelection &)));

    QWidget *editPanel = new QWidget(this);
    contentLayout->addWidget(editPanel);

    QFormLayout *editLayout = new QFormLayout(editPanel);

    Type = new QComboBox(editPanel);
    Type->addItem(tr("HTTP CONNECT method"), "http");
    Type->addItem(tr("SOCKS Version 5"), "socks");
    Type->addItem(tr("HTTP Polling"), "poll");
    connect(Type, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
    editLayout->addRow(tr("Type (for Jabber)"), Type);

    PollingUrl = new QLineEdit(editPanel);
    connect(PollingUrl, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
    editLayout->addRow(tr("Polling URL"), PollingUrl);

    Host = new QLineEdit(editPanel);
    connect(Host, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
    editLayout->addRow(tr("Host"), Host);

    Port = new QLineEdit(editPanel);
    connect(Port, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
    Port->setValidator(new QIntValidator(1, 65535, Port));
    editLayout->addRow(tr("Port"), Port);

    User = new QLineEdit(editPanel);
    connect(User, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
    editLayout->addRow(tr("User"), User);

    Password = new QLineEdit(editPanel);
    connect(Password, SIGNAL(textChanged(QString)), this, SLOT(dataChanged()));
    Password->setEchoMode(QLineEdit::Password);
    editLayout->addRow(tr("Password"), Password);

    QDialogButtonBox *editButtons = new QDialogButtonBox(Qt::Horizontal, editPanel);
    editLayout->addRow(editButtons);

    SaveButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add"), editButtons);
    connect(SaveButton, SIGNAL(clicked()), this, SLOT(saveProxyButtonClicked()));
    CancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), editButtons);
    connect(CancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
    RemoveButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Remove"), editButtons);
    connect(RemoveButton, SIGNAL(clicked(bool)), this, SLOT(removeButtonClicked()));

    editButtons->addButton(SaveButton, QDialogButtonBox::ApplyRole);
    editButtons->addButton(CancelButton, QDialogButtonBox::RejectRole);
    editButtons->addButton(RemoveButton, QDialogButtonBox::DestructiveRole);

    QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);
    mainLayout->addWidget(buttons);

    QPushButton *closeButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Close"), buttons);

    connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(close()));
    buttons->addButton(closeButton, QDialogButtonBox::RejectRole);
}
示例#11
0
void KviTalWizard::closeEvent(QCloseEvent * e)
{
	e->ignore();
	cancelButtonClicked();
}
示例#12
0
KviTalWizard::KviTalWizard(QWidget * pParent)
: QDialog(pParent)
{
	m_p = new KviTalWizardPrivate;
	m_p->pPageList = new KviPointerList<KviTalWizardPageData>;
	m_p->pPageList->setAutoDelete(true);
	m_p->pCurrentPage = NULL;
	m_p->iEnabledPageCount = 0;
	m_p->pLayout = new QGridLayout(this);

	m_p->pTitleLabel = new QLabel(this);
	m_p->pLayout->addWidget(m_p->pTitleLabel,0,0,1,3);

	m_p->pStepsLabel = new QLabel(this);
	m_p->pStepsLabel->setMinimumWidth(80);
	m_p->pStepsLabel->setAlignment(Qt::AlignRight);
	m_p->pLayout->addWidget(m_p->pStepsLabel,0,4,1,3);

	QFrame * f1 = new QFrame(this);
	f1->setFrameStyle(QFrame::Sunken | QFrame::HLine);
	m_p->pLayout->addWidget(f1,1,0,1,7);

	m_p->pWidgetStack = new QStackedWidget(this);
	m_p->pLayout->addWidget(m_p->pWidgetStack,2,0,1,7);

	QFrame * f2 = new QFrame(this);
	f2->setFrameStyle(QFrame::Sunken | QFrame::HLine);
	m_p->pLayout->addWidget(f2,3,0,1,7);

	KviTalHBox * pButtonBox = new KviTalHBox(this);
	m_p->pLayout->addWidget(pButtonBox,4,0,1,7);

	pButtonBox->setMargin(0);
	pButtonBox->setSpacing(0);


	m_p->pCancelButton = new QPushButton(__tr("Cancel"),pButtonBox);
	m_p->pCancelButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pCancelButton,
			SIGNAL(clicked()),
			this,
			SLOT(cancelButtonClicked())
		);

	QWidget * pSpacer = new QWidget(pButtonBox);
	pSpacer->setFixedWidth(4);

	m_p->pHelpButton = new QPushButton(__tr("Help"),pButtonBox);
	m_p->pHelpButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pHelpButton,
			SIGNAL(clicked()),
			this,
			SLOT(helpButtonClicked())
		);

	QWidget * pLargeSpacer = new QWidget(pButtonBox);
	pLargeSpacer->setMinimumWidth(50);
	pButtonBox->setStretchFactor(pLargeSpacer,100);

	QString szText = "< ";
	szText += __tr("Back");
	m_p->pBackButton = new QPushButton(szText,pButtonBox);
	m_p->pBackButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pBackButton,
			SIGNAL(clicked()),
			this,
			SLOT(backButtonClicked())
		);

	m_p->pNextSpacer = new QWidget(pButtonBox);
	m_p->pNextSpacer->setFixedWidth(4);

	szText = __tr("Next");
	szText += " >";
	m_p->pNextButton = new QPushButton(szText,pButtonBox);
	m_p->pNextButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pNextButton,
			SIGNAL(clicked()),
			this,
			SLOT(nextButtonClicked())
		);

	m_p->pFinishSpacer = new QWidget(pButtonBox);
	m_p->pFinishSpacer->setFixedWidth(4);

	m_p->pFinishButton = new QPushButton(__tr("Finish"),pButtonBox);
	m_p->pFinishButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pFinishButton,
			SIGNAL(clicked()),
			this,
			SLOT(finishButtonClicked())
		);

	m_p->pLayout->setMargin(8);
	m_p->pLayout->setSpacing(4);
	m_p->pLayout->setRowStretch(2,1);
	m_p->pLayout->setColumnStretch(0,1);
}
示例#13
0
void TextEditBox::handleCancelButtonClicked()
{
    emit cancelButtonClicked();
    this->deleteLater();
}
void MainWindow::calculate(int pluginNum)
{
    lockGUI();
    if (placesListChanged)
    {
        //std::vector<Place*> v_places;
        std::vector<QListWidgetItem*> items = list.getAllItems();
        int size = items.size();
        if(size==0)
        {
            return;
        }
        if(v_places.size()>0)
        {
            for(int i = 0; i < (int)v_places.size(); ++i)
            {
                delete[] routes[i];
            }
            delete[] routes;
        }
        v_places.clear();
        for(int i=0; i<size; i++)
        {
            QListWidgetItem* item = items.at(i);
            GeoListItem* geoItem = dynamic_cast<GeoListItem*>(item);
            v_places.push_back(geoItem->getPlace());
        }
        std::unordered_map<std::pair<Coordinates, Coordinates>, Route, pairhash> unordered_map;
        routes = new Marble::Route*[size];
        for(int i = 0; i < size; ++i)
        {
            routes[i] =  new Marble::Route[size];
            for(int j = 0; j < size; ++j)
            {
                Coordinates from = v_places[i]->getCoordinates();
                Coordinates to = v_places[j]->getCoordinates();
                std::pair<Coordinates, Coordinates> pair = std::make_pair(from, to);
                std::unordered_map<std::pair<Coordinates, Coordinates>, Route, pairhash>::const_iterator got = m_routesUnorderedMap.find(pair);
                Route route;
//               if(got == m_routesUnorderedMap.end())
                {
                    route = getRoute(from, to);
                    if(!(from == to) && route.distance() == 0)
                    {
                        writeLog(QString("There is posibility there is no route from position %1 to %2").arg(i).arg(j));
                    }
                    else
                    {
                        writeLog(QString("Found route from position %1 to %2").arg(i).arg(j));
                    }
                }
//                else
//                {
//                    route = got->second;
//                    if(!(from == to) && route.distance() == 0)
//                    {
//                        writeLog(QString("There is posibility there is no route from position %1 to %2").arg(i).arg(j));
//                    }
//                    else
//                    {
//                        writeLog(QString("Already have route from position %1 to %2").arg(i).arg(j));
//                    }
//                }

                routes[i][j] = route;
                //unordered_map[pair] = route;

            }
        }
        placesListChanged = false;
        m_routesUnorderedMap.clear();
        m_routesUnorderedMap = std::move(unordered_map);
    }
    this->m_progBarDial->show();
    this->m_progBarDial->setProgress(0);
    this->m_progBarDial->update();
    this->m_progBarDial->repaint();
    this->repaint();
    KomiwojazerPluginInterface* interface = pluginManager.getPluginByIndex(pluginNum);
    interface->connectToSLOT(m_progBarDial, SIGNAL(cancelButtonClicked()), true);
    v_places = interface->calculate(v_places, routes);
    interface->connectToSLOT(m_progBarDial, SIGNAL(cancelButtonClicked()), true);
    this->m_progBarDial->hide();
    this->m_progBarDial->update();
    this->m_progBarDial->repaint();
    this->repaint();
    setMarkerNumber();
    unlockGUI();
}