summaryrefslogtreecommitdiffstats
path: root/gui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'gui/dialogs')
-rw-r--r--gui/dialogs/PasswordDialog.cpp38
-rw-r--r--gui/dialogs/PasswordDialog.h40
-rw-r--r--gui/dialogs/PasswordDialog.ui78
3 files changed, 156 insertions, 0 deletions
diff --git a/gui/dialogs/PasswordDialog.cpp b/gui/dialogs/PasswordDialog.cpp
new file mode 100644
index 00000000..c67fc6a2
--- /dev/null
+++ b/gui/dialogs/PasswordDialog.cpp
@@ -0,0 +1,38 @@
+/* Copyright 2013 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PasswordDialog.h"
+#include "ui_PasswordDialog.h"
+
+PasswordDialog::PasswordDialog(const QString& errorMsg, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::PasswordDialog)
+{
+ ui->setupUi(this);
+
+ ui->errorLabel->setText(errorMsg);
+ ui->errorLabel->setVisible(!errorMsg.isEmpty());
+}
+
+PasswordDialog::~PasswordDialog()
+{
+ delete ui;
+}
+
+QString PasswordDialog::password() const
+{
+ return ui->passTextBox->text();
+}
+
diff --git a/gui/dialogs/PasswordDialog.h b/gui/dialogs/PasswordDialog.h
new file mode 100644
index 00000000..0919e6e4
--- /dev/null
+++ b/gui/dialogs/PasswordDialog.h
@@ -0,0 +1,40 @@
+/* Copyright 2013 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <QDialog>
+
+namespace Ui {
+class PasswordDialog;
+}
+
+class PasswordDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit PasswordDialog(const QString& errorMsg="", QWidget *parent = 0);
+ ~PasswordDialog();
+
+ /*!
+ * Gets the text entered in the dialog's password field.
+ */
+ QString password() const;
+
+private:
+ Ui::PasswordDialog *ui;
+};
+
diff --git a/gui/dialogs/PasswordDialog.ui b/gui/dialogs/PasswordDialog.ui
new file mode 100644
index 00000000..6c70b033
--- /dev/null
+++ b/gui/dialogs/PasswordDialog.ui
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PasswordDialog</class>
+ <widget class="QDialog" name="PasswordDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>94</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="errorLabel">
+ <property name="text">
+ <string>Error message here...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="passTextBox">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>PasswordDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>PasswordDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>