예제 #1
0
void PropertiesDock::renameProperty()
{
    QtBrowserItem *item = mPropertyBrowser->currentItem();
    if (!item)
        return;

    const QString oldName = item->property()->propertyName();

    QInputDialog *dialog = new QInputDialog(mPropertyBrowser);
    dialog->setInputMode(QInputDialog::TextInput);
    dialog->setLabelText(tr("Name:"));
    dialog->setTextValue(oldName);
    dialog->setWindowTitle(tr("Rename Property"));
    dialog->open(this, SLOT(renameProperty(QString)));
}
예제 #2
0
/**
 * Dialog: Change your Nickname in the ChatLobby
 */
void ChatLobbyDialog::changeNickname()
{
	QInputDialog dialog;
	dialog.setWindowTitle(tr("Change nick name"));
	dialog.setLabelText(tr("Please enter your new nick name"));
	dialog.setWindowIcon(QIcon(":/images/rstray3.png"));

	std::string nickName;
	rsMsgs->getNickNameForChatLobby(lobbyId, nickName);
	dialog.setTextValue(QString::fromUtf8(nickName.c_str()));

	if (dialog.exec() == QDialog::Accepted && !dialog.textValue().isEmpty()) {
		setNickname(dialog.textValue());
	}
}
예제 #3
0
 Widget() {
    m_layout.addWidget(&m_view, 0, 0, 1, 1);
    m_layout.addWidget(&m_button, 1, 0, 1, 1);
    connect(&m_button, SIGNAL(clicked()), &m_dialog, SLOT(open()));
    m_model.append({"Volvo", "240", "SQL8941"});
    m_model.append({"Volvo", "850", {}});
    m_model.append({"Volvo", "940", "QRZ1321"});
    m_model.append({"Volvo", "960", "QRZ1628"});
    m_proxy.setSourceModel(&m_model);
    m_proxy.setFilterKeyColumn(2);
    m_view.setModel(&m_proxy);
    m_dialog.setLabelText("Enter registration number fragment to filter on. Leave empty to clear filter.");
    m_dialog.setInputMode(QInputDialog::TextInput);
    connect(&m_dialog, SIGNAL(textValueSelected(QString)),
            &m_proxy, SLOT(setFilterFixedString(QString)));
 }
예제 #4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QString RicImportEnsembleFeature::askForEnsembleName()
{
    RimProject* project = RiaApplication::instance()->project();
    std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
    int ensembleCount = std::count_if(groups.begin(), groups.end(), [](RimSummaryCaseCollection* group) { return group->isEnsemble(); });
    ensembleCount += 1;

    QInputDialog dialog;
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setWindowTitle("Ensemble Name");
    dialog.setLabelText("Ensemble Name");
    dialog.setTextValue(QString("Ensemble %1").arg(ensembleCount));
    dialog.resize(300, 50);
    dialog.exec();
    return dialog.result() == QDialog::Accepted ? dialog.textValue() : QString("");
}
예제 #5
0
void FolderWizardTargetPage::slotAddRemoteFolder()
{
    QTreeWidgetItem *current = _ui.folderTreeWidget->currentItem();

    QString parent('/');
    if (current) {
        parent = current->data(0, Qt::UserRole).toString();
    }

    QInputDialog *dlg = new QInputDialog(this);

    dlg->setWindowTitle(tr("Add Remote Folder"));
    dlg->setLabelText(tr("Enter the name of the new folder:"));
    dlg->setTextValue(parent);
    dlg->open(this, SLOT(slotCreateRemoteFolder(QString)));
    dlg->setAttribute(Qt::WA_DeleteOnClose);
}
QString SshKeyGenerator::getPassword() const
{
    QInputDialog d;
    d.setInputMode(QInputDialog::TextInput);
    d.setTextEchoMode(QLineEdit::Password);
    d.setWindowTitle(tr("Password for Private Key"));
    d.setLabelText(tr("It is recommended that you secure your private key\n"
        "with a password, which you can enter below."));
    d.setOkButtonText(tr("Encrypt key file"));
    d.setCancelButtonText(tr("Do not encrypt key file"));
    int result = QDialog::Accepted;
    QString password;
    while (result == QDialog::Accepted && password.isEmpty()) {
        result = d.exec();
        password = d.textValue();
    }
    return result == QDialog::Accepted ? password : QString();
}
예제 #7
0
static bool execInputDialog_Int(
    const char *title, const char *label, int minVal, int maxVal, int &ret)
{
    QInputDialog dlg;
    dlg.setWindowTitle(title);
    dlg.setLabelText(label);
    dlg.setOkButtonText("确定");
    dlg.setCancelButtonText("取消");
    dlg.setInputMode(QInputDialog::IntInput);
    dlg.setIntRange(minVal, maxVal);
    dlg.setIntValue(ret);
    if (dlg.exec() == QDialog::Accepted)
    {
        ret = dlg.intValue();
        return true;
    }
    return false;
}
예제 #8
0
void CMainWindow::on_cmdAdd_clicked()
{
    // Input-Dialog zusammenbasteln
    QInputDialog *inDlg = new QInputDialog(this);
    inDlg->setOkButtonText("Platz suchen");
    inDlg->setCancelButtonText("Suche abbrechen");
    inDlg->setLabelText("Bitte geben Sie den oder die ICAO-Codes\ndes gesuchten Platzes ein\n(Mehrere ICAO-Codes durch Leerzeichen, Komma, Semikolon\noder Minus getrennt):");

    // anzeigen und auswerten
    if(inDlg->exec() == QInputDialog::Accepted)
    {
        QString icao;
        icao = inDlg->textValue().toUpper();        
        QList<QString*> *lFields = parseFields(icao);
        mnet->getNewAirfields(lFields);
    }

    // Aufräumen
    delete inDlg;
}
예제 #9
0
std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is_bad)
{
	RsAutoUpdatePage::lockAllEvents() ;

	QInputDialog dialog;
	dialog.setWindowTitle(tr("GPG key passphrase"));
	dialog.setLabelText((prev_is_bad?tr("Wrong password !") + "\n\n" : QString()) +
						tr("Please enter the password to unlock the following GPG key:") + "\n" + QString::fromStdString(key_details));
	dialog.setTextEchoMode(QLineEdit::Password);
	dialog.setWindowIcon(QIcon(":/images/rstray3.png"));

	int ret = dialog.exec();

	RsAutoUpdatePage::unlockAllEvents() ;

	if (ret) {
		return dialog.textValue().toStdString();
	}

	return "";
}
예제 #10
0
void HttpCredentialsGui::showDialog()
{
    QString msg = tr("Please enter %1 password:<br>"
                     "<br>"
                     "User: %2<br>"
                     "Account: %3<br>")
                      .arg(Utility::escape(Theme::instance()->appNameGUI()),
                          Utility::escape(_user),
                          Utility::escape(_account->displayName()));

    QString reqTxt = requestAppPasswordText(_account);
    if (!reqTxt.isEmpty()) {
        msg += QLatin1String("<br>") + reqTxt + QLatin1String("<br>");
    }
    if (!_fetchErrorString.isEmpty()) {
        msg += QLatin1String("<br>")
            + tr("Reading from keychain failed with error: '%1'")
                  .arg(Utility::escape(_fetchErrorString))
            + QLatin1String("<br>");
    }

    QInputDialog dialog;
    dialog.setWindowTitle(tr("Enter Password"));
    dialog.setLabelText(msg);
    dialog.setTextValue(_previousPassword);
    dialog.setTextEchoMode(QLineEdit::Password);
    if (QLabel *dialogLabel = dialog.findChild<QLabel *>()) {
        dialogLabel->setOpenExternalLinks(true);
        dialogLabel->setTextFormat(Qt::RichText);
    }

    bool ok = dialog.exec();
    if (ok) {
        _password = dialog.textValue();
        _refreshToken.clear();
        _ready = true;
        persist();
    }
    emit asked();
}
예제 #11
0
bool NotifyQt::askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password,bool& cancelled)
{
	RsAutoUpdatePage::lockAllEvents() ;

	QInputDialog dialog;
	if (title == "") {
		dialog.setWindowTitle(tr("PGP key passphrase"));
	} else if (title == "AuthSSLimpl::SignX509ReqWithGPG()") {
		dialog.setWindowTitle(tr("You need to sign your node's certificate."));
	} else if (title == "p3IdService::service_CreateGroup()") {
		dialog.setWindowTitle(tr("You need to sign your forum/chatrooms identity."));
	} else {
		dialog.setWindowTitle(QString::fromStdString(title));
	}

	dialog.setLabelText((prev_is_bad ? QString("%1\n\n").arg(tr("Wrong password !")) : QString()) + QString("%1:\n    %2").arg(tr("Please enter your PGP password for key"), QString::fromUtf8(key_details.c_str())));
	dialog.setTextEchoMode(QLineEdit::Password);
	dialog.setModal(true);

	int ret = dialog.exec();

    cancelled = false ;

	RsAutoUpdatePage::unlockAllEvents() ;

    if (ret == QDialog::Rejected) {
        password.clear() ;
        cancelled = true ;
        return true ;
    }

    if (ret == QDialog::Accepted) {
		 password = dialog.textValue().toUtf8().constData();
		 return true;
    }

	return false;
}
예제 #12
0
static inline StackFrame inputFunctionForDisassembly()
{
    StackFrame frame;
    QInputDialog dialog;
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setLabelText(StackTreeView::tr("Function:"));
    dialog.setWindowTitle(StackTreeView::tr("Disassemble Function"));
    dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
    if (dialog.exec() != QDialog::Accepted)
        return frame;
    const QString function = dialog.textValue();
    if (function.isEmpty())
        return frame;
    const int bangPos = function.indexOf(QLatin1Char('!'));
    if (bangPos != -1) {
        frame.module = function.left(bangPos);
        frame.function = function.mid(bangPos + 1);
    } else {
        frame.function = function;
    }
    frame.line = 42; // trick gdb into mixed mode.
    return frame;
}
예제 #13
0
QInputDialog *
TriggerPoint::nameInputDialog()
{
  QInputDialog *nameDialog = new QInputDialog(_scene->views().first(), Qt::Popup);
  nameDialog->setInputMode(QInputDialog::TextInput);
  nameDialog->setLabelText(QObject::tr("Enter the trigger message :"));
  nameDialog->setTextValue(QString::fromStdString(this->_abstract->message()));
  QPoint position = _scene->views().first()->parentWidget()->pos();
  int MMwidth = _scene->views().first()->parentWidget()->width();
  nameDialog->move(position.x() + MMwidth / 2, position.y());

  nameDialog->setStyleSheet(
              "QInputDialog {"
              "font-weight: bold;"
              "border: 2px solid gray;"
              "border-width: 2px;"
              "border-color: #606060;"
              "background-color: darkgray;"
              "}"
              );

  return nameDialog;
}
예제 #14
0
void LightFader::configureClicked()
{
    switch (m_operatingMode)
    {
        case SINGLE_CHANNEL:
        {
            QInputDialog *dlg = new QInputDialog(this);
            dlg->setInputMode(QInputDialog::IntInput);
            dlg->setIntMaximum(255);
            dlg->setIntMinimum(0);
            dlg->setIntValue(m_values[0]);
            dlg->setOption(QInputDialog::NoButtons, true);
            dlg->setWindowTitle(ui.faderName->text());
            dlg->setLabelText(tr("DMX Value:"));
            connect(dlg, &QInputDialog::intValueChanged, this, &LightFader::setValueFromDialog);
            dlg->exec();
            break;
        }
        case EUROLITE_PMD_8:
            EuroLitePMD8Configuration *dlg = new EuroLitePMD8Configuration(this);
            dlg->exec();
            break;
    }
}
예제 #15
0
void MainWindow::onMenuToolsBatchAdd()
{
    QInputDialog id;
    id.setWindowTitle("Více objektů");
    id.setLabelText("Vložte názvy objektů, každý na samostatný řádek");
    id.setOption(QInputDialog::UsePlainTextEditForTextInput);
    id.exec();

    QStringList errors;
    QStringList lines = id.textValue().split("\n");
    lines.removeAll("");

    foreach (QString line, lines){
        try {
            db->createObject(line);
        } catch (QString & e) {
            Q_UNUSED(e);
            errors += line;
        }
    }
    if(!errors.isEmpty()) {
        QMessageBox(QMessageBox::Warning, "Chyba", "Tyto objekty se nepodařilo vytvořit:\n" + errors.join("\n")).exec();
    }
}
예제 #16
0
int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
{
	QFile file(inFile);
	if(!file.open(QIODevice::ReadOnly))
	{
		return CsvError_FileOpen;
	}

	QTextCodec *codec = NULL;
	QByteArray bomCheck = file.peek(16);

	if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xef\xbb\xbf"))
	{
		codec = QTextCodec::codecForName("UTF-8");
	}
	else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xff\xfe"))
	{
		codec = QTextCodec::codecForName("UTF-16LE");
	}
	else if((!bomCheck.isEmpty()) && bomCheck.startsWith("\xfe\xff"))
	{
		codec = QTextCodec::codecForName("UTF-16BE");
	}
	else
	{
		const QString systemDefault = tr("(System Default)");

		QStringList codecList;
		codecList.append(systemDefault);
		codecList.append(lamexp_available_codepages());

		QInputDialog *input = new QInputDialog(parent);
		input->setLabelText(EXPAND(tr("Select ANSI Codepage for CSV file:")));
		input->setOkButtonText(tr("OK"));
		input->setCancelButtonText(tr("Cancel"));
		input->setTextEchoMode(QLineEdit::Normal);
		input->setComboBoxItems(codecList);
	
		if(input->exec() < 1)
		{
			LAMEXP_DELETE(input);
			return CsvError_Aborted;
		}
	
		if(input->textValue().compare(systemDefault, Qt::CaseInsensitive))
		{
			qDebug("User-selected codec is: %s", input->textValue().toLatin1().constData());
			codec = QTextCodec::codecForName(input->textValue().toLatin1().constData());
		}
		else
		{
			qDebug("Going to use the system's default codec!");
			codec = QTextCodec::codecForName("System");
		}

		LAMEXP_DELETE(input);
	}

	bomCheck.clear();

	//----------------------//

	QTextStream stream(&file);
	stream.setAutoDetectUnicode(false);
	stream.setCodec(codec);

	QString headerLine = stream.readLine().simplified();

	while(headerLine.isEmpty())
	{
		if(stream.atEnd())
		{
			qWarning("The file appears to be empty!");
			return CsvError_FileRead;
		}
		qWarning("Skipping a blank line at beginning of CSV file!");
		headerLine = stream.readLine().simplified();
	}

	QStringList header = headerLine.split(";", QString::KeepEmptyParts);

	const int nCols = header.count();
	const int nFiles = m_fileList.count();

	if(nCols < 1)
	{
		qWarning("Header appears to be empty!");
		return CsvError_FileRead;
	}

	bool *ignore = new bool[nCols];
	memset(ignore, 0, sizeof(bool) * nCols);

	for(int i = 0; i < nCols; i++)
	{
		if((header[i] = header[i].trimmed()).isEmpty())
		{
			ignore[i] = true;
		}
	}

	//----------------------//

	for(int i = 0; i < nFiles; i++)
	{
		if(stream.atEnd())
		{
			LAMEXP_DELETE_ARRAY(ignore);
			return CsvError_Incomplete;
		}
		
		QString line = stream.readLine().simplified();
		
		if(line.isEmpty())
		{
			qWarning("Skipping a blank line in CSV file!");
			continue;
		}
		
		QStringList data = line.split(";", QString::KeepEmptyParts);

		if(data.count() < header.count())
		{
			qWarning("Skipping an incomplete line in CSV file!");
			continue;
		}

		const QString key = m_fileList[i];

		for(int j = 0; j < nCols; j++)
		{
			if(ignore[j])
			{
				continue;
			}
			else if(CHECK_HDR(header.at(j), "POSITION"))
			{
				bool ok = false;
				unsigned int temp = data.at(j).trimmed().toUInt(&ok);
				if(ok) m_fileStore[key].metaInfo().setPosition(temp);
			}
			else if(CHECK_HDR(header.at(j), "TITLE"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setTitle(temp);
			}
			else if(CHECK_HDR(header.at(j), "ARTIST"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setArtist(temp);
			}
			else if(CHECK_HDR(header.at(j), "ALBUM"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setAlbum(temp);
			}
			else if(CHECK_HDR(header.at(j), "GENRE"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setGenre(temp);
			}
			else if(CHECK_HDR(header.at(j), "YEAR"))
			{
				bool ok = false;
				unsigned int temp = data.at(j).trimmed().toUInt(&ok);
				if(ok) m_fileStore[key].metaInfo().setYear(temp);
			}
			else if(CHECK_HDR(header.at(j), "COMMENT"))
			{
				QString temp = data.at(j).trimmed();
				if(!temp.isEmpty()) m_fileStore[key].metaInfo().setComment(temp);
			}
			else
			{
				qWarning("Unkonw field '%s' will be ignored!", QUTF8(header.at(j)));
				ignore[j] = true;
				
				if(!checkArray(ignore, false, nCols))
				{
					qWarning("No known fields left, aborting!");
					return CsvError_NoTags;
				}
			}
		}
	}

	//----------------------//

	LAMEXP_DELETE_ARRAY(ignore);
	return CsvError_OK;
}