예제 #1
0
void DialogManager::init()
{
    QString fileName=GameConfigurator::instance()->getDialogConfigFileName();
    QString path=QDir::currentPath()+QDir::separator()+fileName;

    QFile file(path);

    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug()<<"can not open "<<fileName<<endl;
        return ;
    }
    reader.setDevice(&file);

    reader.readNextStartElement();//<DialogBox>

    reader.readNextStartElement();//<TotalDialogNumber>
    int totalDialogNumber=reader.readElementText().toInt();

    for(int i=0;i<totalDialogNumber;i++)
    {
        Dialog* dialog=makeDialog();

        addDialog(dialog->getName(),dialog);
    }
    file.close();
}
예제 #2
0
void IMEditorWidget::slotAdd()
{
  KDialog addDialog( this );
  addDialog.setCaption( i18nc( "Instant messaging", "Add Address" ) );
  addDialog.setButtons( KDialog::Ok | KDialog::Cancel );
  addDialog.setDefaultButton( KDialog::Ok );
  addDialog.setObjectName( "addaddress" );

  IMAddressWidget *addressWid = new IMAddressWidget( &addDialog, mProtocols );
  addDialog.enableButtonOk( false );
  connect( addressWid, SIGNAL( inValidState( bool ) ),
           &addDialog, SLOT( enableButtonOk( bool ) ) );
  addDialog.setMainWidget( addressWid );

  if ( addDialog.exec() == QDialog::Accepted ) {
    // add the new item
    IMAddressLVI *imaddresslvi =
      new IMAddressLVI( mWidget->lvAddresses, addressWid->protocol(),
                        addressWid->address() /*, addressWid->context() */ );

    // If it's a new address, set is as preferred.
    if ( mPreferred.isEmpty() ) {
      imaddresslvi->setPreferred( true );
      mPreferred = addressWid->address();
    }

    if ( !mChangedProtocols.contains( addressWid->protocol() )  ) {
      mChangedProtocols.append( addressWid->protocol() );
    }

    mWidget->lvAddresses->sortItems( 0, Qt::AscendingOrder );

    setModified( true );
  }
}
예제 #3
0
void LandmarkBrowser::on_addLandmark_clicked()
{
    LandmarkAddDialog addDialog(this);
#ifndef Q_OS_SYMBIAN
    addDialog.resize(this->width(), this->height());
#endif
    if (!addDialog.exec()) {
        return;
    }

    QLandmark lm = addDialog.landmark();
    manager->saveLandmark(&lm);
}
예제 #4
0
파일: mainwindow.cpp 프로젝트: wulinfa/qdl2
void MainWindow::showAddUrlsDialog(const QStringList &urls) {
    AddUrlsDialog addDialog(this);
    addDialog.setUrls(urls);

    if (addDialog.exec() == QDialog::Accepted) {
        const QStringList urls = addDialog.urls();

        if (!urls.isEmpty()) {
            UrlCheckDialog checkDialog(this);
            checkDialog.addUrls(urls);
            checkDialog.exec();
        }
    }
}
예제 #5
0
void LandmarkBrowser::on_editLandmarkButton_clicked()
{
    QItemSelectionModel *selection = table->selectionModel();
    QModelIndexList selectedIndexes = selection->selectedRows();
    if (selectedIndexes.count()  > 0) {
        LandmarkAddDialog addDialog(this, 0, landmarks.at(selectedIndexes.at(0).row()));

        if (!addDialog.exec()) {
            return;
        }

        QLandmark lm = addDialog.landmark();
        manager->saveLandmark(&lm);
    }
}
예제 #6
0
파일: World.cpp 프로젝트: gasbank/poolg
Dialog* World::getDialogByName( const char* dialogName )
{
    DialogList::iterator it = m_scriptedDialog.begin();
    for ( ; it != m_scriptedDialog.end(); ++it )
    {
        if ( (*it)->getDialogName() == dialogName )
            return (*it);
    }

    // Dialog not found! Configure at runtime.
    OutputDebugString( _T( " - INFO: Requested dialog is not found on World. Trying to generate and register new one...\n" ) );
    Dialog* newDlg = Dialog::createDialogByScript( dialogName );
    newDlg->init();
    addDialog( newDlg );
    return getDialogByName( dialogName );
}
예제 #7
0
	void KeywordsManagerWidget::on_Add__released ()
	{
		EditKeywordDialog addDialog("", "");

		if (addDialog.exec () == QDialog::Accepted)
		{
			const QString& keyword = addDialog.GetKeyword ();
			const QString& url = addDialog.GetUrl ();

			if (url.isEmpty () || keyword.isEmpty ())
				return;

			bool alreadyExists = Keywords_.allKeys ().contains (keyword);

			if (alreadyExists)
				if (QMessageBox::question (this, 
						tr ("Keyword already exists"), 
						tr ("Entered keyword already exists. Change url for this keyword?"),
						QMessageBox::Yes || QMessageBox::No,
						QMessageBox::Yes) == QMessageBox::No)
							return;

			Keywords_.setValue (keyword, url);
			
			if (alreadyExists) 
			{
				for (int i = 0; i < Model_->rowCount (); i++)
				{
					if (Model_->item (i, 0)->text () == keyword)
					{
						Model_->item (i, 1)->setText (url);
						break;
					}
				}
			}
			else 
			{
				QStandardItem *keywordItem = new QStandardItem (keyword);
				QStandardItem *urlItem = new QStandardItem (url);
				QList<QStandardItem*> items; 
				
				items << keywordItem << urlItem;
				Model_->appendRow (items);
			}
			Plugin_->UpdateKeywords (keyword, url);
		}
	}
예제 #8
0
파일: World.cpp 프로젝트: gasbank/poolg
UINT World::preloadDialogs()
{
    char scriptCommand[512];
    ConstCharList dialogNameList;
    StringCchPrintfA( scriptCommand, 512, "%s::dialogNameList", m_worldName );
    GetScriptManager().readCharPtrList( scriptCommand, dialogNameList );

    ConstCharList::iterator itDlg = dialogNameList.begin();
    for ( ; itDlg != dialogNameList.end(); ++itDlg )
    {
        StringCchPrintfA( scriptCommand, 512, "%s::%s", m_worldName, *itDlg );
        Dialog* newDlg = Dialog::createDialogByScript( scriptCommand );
        newDlg->init();
        addDialog( newDlg );
    }

    return dialogNameList.size();
}
예제 #9
0
파일: mainwindow.cpp 프로젝트: wulinfa/qdl2
void MainWindow::showAddUrlsDialog() {
    AddUrlsDialog addDialog(this);

    if (addDialog.exec() == QDialog::Accepted) {
        const QStringList urls = addDialog.urls();

        if (!urls.isEmpty()) {
            if (addDialog.usePlugins()) {
                UrlCheckDialog checkDialog(this);
                checkDialog.addUrls(urls);
                checkDialog.exec();
            }
            else {
                TransferModel::instance()->append(urls, addDialog.requestMethod(), addDialog.requestHeaders(),
                                                  addDialog.postData());
            }
        }
    }
}
예제 #10
0
/** 
 * Loads all call trees according to the list of files 
 * @param	sProjPath	The project's directory
 * @param	slFiles		A list of file names to open
 */
void CallTreeManager::loadOpenDialogs(const QString& sProjPath,
	const QStringList& slFiles)
{
	QStringList::ConstIterator itr;
	CallTreeDlg *pDlg;

	for (itr = slFiles.begin(); itr != slFiles.end(); ++itr) {
		// Create a new dialogue for this file
		pDlg = addDialog();

		// Try to load the graph from the file
		if (!pDlg->load(sProjPath, *itr)) {
			slotRemoveDialog(pDlg);
			continue;
		}

		// Show the call tree
		pDlg->show();
	}
}
예제 #11
0
void PortMappingDialog::onAddButtonClick()
{
  EditPortMappingDialog addDialog(EditPortMappingDialog::Add);

  PortMapping newPM;

  addDialog.setMapping(&newPM);
  addDialog.setParent(&m_ctrlThis);

  if (addDialog.showModal() == IDOK) {
    {
      StringStorage mappingString;
      newPM.toString(&mappingString);
      m_exPortsListBox.addString(mappingString.getString());
    }

    m_extraPorts->pushBack(newPM);

    ((ConfigDialog *)m_parent)->updateApplyButtonState();
  }
}
예제 #12
0
void QgsComposerLegendWidget::on_mAddToolButton_clicked()
{
  if ( !mLegend )
  {
    return;
  }

  QStandardItemModel* itemModel = qobject_cast<QStandardItemModel *>( mItemTreeView->model() );
  if ( !itemModel )
  {
    return;
  }

  QgisApp* app = QgisApp::instance();
  if ( !app )
  {
    return;
  }

  QgsMapCanvas* canvas = app->mapCanvas();
  if ( canvas )
  {
    QList<QgsMapLayer*> layers = canvas->layers();

    QgsComposerLegendLayersDialog addDialog( layers );
    if ( addDialog.exec() == QDialog::Accepted )
    {
      QgsMapLayer* layer = addDialog.selectedLayer();
      if ( layer )
      {
        mLegend->beginCommand( "Legend item added" );
        mLegend->model()->addLayer( layer );
        mLegend->endCommand();
      }
    }
  }
}
예제 #13
0
void ClipboardUrlsDialog::addUrls() {
    AddUrlsDialog addDialog(this);
    addDialog.setUrls(selectedUrls());

    if (addDialog.exec() == QDialog::Accepted) {
        const QStringList urls = addDialog.urls();

        if (!urls.isEmpty()) {
            if (addDialog.usePlugins()) {
                UrlCheckDialog checkDialog(this);
                checkDialog.addUrls(urls, addDialog.category(), addDialog.createSubfolder(), addDialog.priority(),
                        addDialog.customCommand(), addDialog.customCommandOverrideEnabled(),
                        addDialog.startAutomatically());
                checkDialog.exec();
            }
            else {
                TransferModel::instance()->append(urls, addDialog.requestMethod(), addDialog.requestHeaders(),
                        addDialog.postData(), addDialog.category(), addDialog.createSubfolder(), addDialog.priority(),
                        addDialog.customCommand(), addDialog.customCommandOverrideEnabled(),
                        addDialog.startAutomatically());
            }
        }
    }
}
예제 #14
0
파일: mainwindow.cpp 프로젝트: wulinfa/qdl2
void MainWindow::showImportUrlsDialog() {
    const QString filePath = QFileDialog::getOpenFileName(this, tr("Import URLs"), HOME_PATH, "*.txt");
    
    if (!filePath.isEmpty()) {
        AddUrlsDialog addDialog(this);
        addDialog.importUrls(filePath);

        if (addDialog.exec() == QDialog::Accepted) {
            const QStringList urls = addDialog.urls();

            if (!urls.isEmpty()) {
                if (addDialog.usePlugins()) {
                    UrlCheckDialog checkDialog(this);
                    checkDialog.addUrls(urls);
                    checkDialog.exec();
                }
                else {
                    TransferModel::instance()->append(urls, addDialog.requestMethod(), addDialog.requestHeaders(),
                                                      addDialog.postData());
                }
            }
        }
    }
}
예제 #15
0
bool SpreadSheet::runInputDialog(const QString &title,
                                 const QString &c1Text,
                                 const QString &c2Text,
                                 const QString &opText,
                                 const QString &outText,
                                 QString *cell1, QString *cell2, QString *outCell)
{
    QStringList rows, cols;
    for (int c = 0; c < table->columnCount(); ++c)
        cols << QChar('A' + c);
    for (int r = 0; r < table->rowCount(); ++r)
        rows << QString::number(1 + r);

    QDialog addDialog(this);
    addDialog.setWindowTitle(title);

    QGroupBox group(title, &addDialog);
    group.setMinimumSize(250, 100);

    QLabel cell1Label(c1Text, &group);
    QComboBox cell1RowInput(&group);
    int c1Row, c1Col;
    decode_pos(*cell1, &c1Row, &c1Col);
    cell1RowInput.addItems(rows);
    cell1RowInput.setCurrentIndex(c1Row);

    QComboBox cell1ColInput(&group);
    cell1ColInput.addItems(cols);
    cell1ColInput.setCurrentIndex(c1Col);

    QLabel operatorLabel(opText, &group);
    operatorLabel.setAlignment(Qt::AlignHCenter);

    QLabel cell2Label(c2Text, &group);
    QComboBox cell2RowInput(&group);
    int c2Row, c2Col;
    decode_pos(*cell2, &c2Row, &c2Col);
    cell2RowInput.addItems(rows);
    cell2RowInput.setCurrentIndex(c2Row);
    QComboBox cell2ColInput(&group);
    cell2ColInput.addItems(cols);
    cell2ColInput.setCurrentIndex(c2Col);

    QLabel equalsLabel("=", &group);
    equalsLabel.setAlignment(Qt::AlignHCenter);

    QLabel outLabel(outText, &group);
    QComboBox outRowInput(&group);
    int outRow, outCol;
    decode_pos(*outCell, &outRow, &outCol);
    outRowInput.addItems(rows);
    outRowInput.setCurrentIndex(outRow);
    QComboBox outColInput(&group);
    outColInput.addItems(cols);
    outColInput.setCurrentIndex(outCol);

    QPushButton cancelButton(tr("Cancel"), &addDialog);
    connect(&cancelButton, SIGNAL(clicked()), &addDialog, SLOT(reject()));

    QPushButton okButton(tr("OK"), &addDialog);
    okButton.setDefault(true);
    connect(&okButton, SIGNAL(clicked()), &addDialog, SLOT(accept()));

    QHBoxLayout *buttonsLayout = new QHBoxLayout;
    buttonsLayout->addStretch(1);
    buttonsLayout->addWidget(&okButton);
    buttonsLayout->addSpacing(10);
    buttonsLayout->addWidget(&cancelButton);

    QVBoxLayout *dialogLayout = new QVBoxLayout(&addDialog);
    dialogLayout->addWidget(&group);
    dialogLayout->addStretch(1);
    dialogLayout->addItem(buttonsLayout);

    QHBoxLayout *cell1Layout = new QHBoxLayout;
    cell1Layout->addWidget(&cell1Label);
    cell1Layout->addSpacing(10);
    cell1Layout->addWidget(&cell1ColInput);
    cell1Layout->addSpacing(10);
    cell1Layout->addWidget(&cell1RowInput);

    QHBoxLayout *cell2Layout = new QHBoxLayout;
    cell2Layout->addWidget(&cell2Label);
    cell2Layout->addSpacing(10);
    cell2Layout->addWidget(&cell2ColInput);
    cell2Layout->addSpacing(10);
    cell2Layout->addWidget(&cell2RowInput);

    QHBoxLayout *outLayout = new QHBoxLayout;
    outLayout->addWidget(&outLabel);
    outLayout->addSpacing(10);
    outLayout->addWidget(&outColInput);
    outLayout->addSpacing(10);
    outLayout->addWidget(&outRowInput);

    QVBoxLayout *vLayout = new QVBoxLayout(&group);
    vLayout->addItem(cell1Layout);
    vLayout->addWidget(&operatorLabel);
    vLayout->addItem(cell2Layout);
    vLayout->addWidget(&equalsLabel);
    vLayout->addStretch(1);
    vLayout->addItem(outLayout);

    if (addDialog.exec()) {
        *cell1 = cell1ColInput.currentText() + cell1RowInput.currentText();
        *cell2 = cell2ColInput.currentText() + cell2RowInput.currentText();
        *outCell = outColInput.currentText() + outRowInput.currentText();
        return true;
    }

    return false;
}