summaryrefslogtreecommitdiffstats
path: root/application/dialogs/NewComponentDialog.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-07-15 14:51:05 +0200
committerPetr Mrázek <peterix@gmail.com>2018-07-15 14:51:05 +0200
commitbbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 (patch)
treee6497e304b7b9368367565fbc7c06efab1124b1c /application/dialogs/NewComponentDialog.cpp
parent03280cc62e75f8073f8d3d9e9e3952acf21fa77d (diff)
downloadMultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.gz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.lz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.xz
MultiMC-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.zip
NOISSUE tabs -> spaces
Diffstat (limited to 'application/dialogs/NewComponentDialog.cpp')
-rw-r--r--application/dialogs/NewComponentDialog.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/application/dialogs/NewComponentDialog.cpp b/application/dialogs/NewComponentDialog.cpp
index 514aa938..c82ba62b 100644
--- a/application/dialogs/NewComponentDialog.cpp
+++ b/application/dialogs/NewComponentDialog.cpp
@@ -35,72 +35,72 @@
#include <meta/VersionList.h>
NewComponentDialog::NewComponentDialog(const QString & initialName, const QString & initialUid, QWidget *parent)
- : QDialog(parent), ui(new Ui::NewComponentDialog)
+ : QDialog(parent), ui(new Ui::NewComponentDialog)
{
- ui->setupUi(this);
- resize(minimumSizeHint());
+ ui->setupUi(this);
+ resize(minimumSizeHint());
- ui->nameTextBox->setText(initialName);
- ui->uidTextBox->setText(initialUid);
+ ui->nameTextBox->setText(initialName);
+ ui->uidTextBox->setText(initialUid);
- connect(ui->nameTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
- connect(ui->uidTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
+ connect(ui->nameTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
+ connect(ui->uidTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
- auto groups = MMC->instances()->getGroups().toSet();
- ui->nameTextBox->setFocus();
+ auto groups = MMC->instances()->getGroups().toSet();
+ ui->nameTextBox->setFocus();
- originalPlaceholderText = ui->uidTextBox->placeholderText();
- updateDialogState();
+ originalPlaceholderText = ui->uidTextBox->placeholderText();
+ updateDialogState();
}
NewComponentDialog::~NewComponentDialog()
{
- delete ui;
+ delete ui;
}
void NewComponentDialog::updateDialogState()
{
- auto protoUid = ui->nameTextBox->text().toLower();
- protoUid.remove(QRegularExpression("[^a-z]"));
- if(protoUid.isEmpty())
- {
- ui->uidTextBox->setPlaceholderText(originalPlaceholderText);
- }
- else
- {
- QString suggestedUid = "org.multimc.custom." + protoUid;
- ui->uidTextBox->setPlaceholderText(suggestedUid);
- }
- bool allowOK = !name().isEmpty() && !uid().isEmpty() && !uidBlacklist.contains(uid());
- ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK);
+ auto protoUid = ui->nameTextBox->text().toLower();
+ protoUid.remove(QRegularExpression("[^a-z]"));
+ if(protoUid.isEmpty())
+ {
+ ui->uidTextBox->setPlaceholderText(originalPlaceholderText);
+ }
+ else
+ {
+ QString suggestedUid = "org.multimc.custom." + protoUid;
+ ui->uidTextBox->setPlaceholderText(suggestedUid);
+ }
+ bool allowOK = !name().isEmpty() && !uid().isEmpty() && !uidBlacklist.contains(uid());
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK);
}
QString NewComponentDialog::name() const
{
- auto result = ui->nameTextBox->text();
- if(result.size())
- {
- return result.trimmed();
- }
- return QString();
+ auto result = ui->nameTextBox->text();
+ if(result.size())
+ {
+ return result.trimmed();
+ }
+ return QString();
}
QString NewComponentDialog::uid() const
{
- auto result = ui->uidTextBox->text();
- if(result.size())
- {
- return result.trimmed();
- }
- result = ui->uidTextBox->placeholderText();
- if(result.size() && result != originalPlaceholderText)
- {
- return result.trimmed();
- }
- return QString();
+ auto result = ui->uidTextBox->text();
+ if(result.size())
+ {
+ return result.trimmed();
+ }
+ result = ui->uidTextBox->placeholderText();
+ if(result.size() && result != originalPlaceholderText)
+ {
+ return result.trimmed();
+ }
+ return QString();
}
void NewComponentDialog::setBlacklist(QStringList badUids)
{
- uidBlacklist = badUids;
+ uidBlacklist = badUids;
}