diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-03 17:20:31 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-03 17:20:31 -0400 |
| commit | 933f460ee61a89ff71038c478de92d6c3760cc9a (patch) | |
| tree | d4fa53698674b8d418e4c4f19e1dfe5d2ae85c29 /src/settingsdialog.cpp | |
| parent | f00314442b9c3c28e846c64da3c3f776e50656de (diff) | |
added new dialog to enter api key manually
added button in nexus settings to open the dialog
added a force flag to apiCheck() to do a check with the new key even if the login was successful before
Diffstat (limited to 'src/settingsdialog.cpp')
| -rw-r--r-- | src/settingsdialog.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 7f53a9bb..44d7fde5 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settingsdialog.h" #include "ui_settingsdialog.h" +#include "ui_nexusmanualkey.h" #include "categoriesdialog.h" #include "helper.h" #include "noeditdelegate.h" @@ -27,6 +28,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settings.h" #include "instancemanager.h" #include "nexusinterface.h" +#include "nxmaccessmanager.h" #include "plugincontainer.h" #include <boost/uuid/uuid_generators.hpp> @@ -47,6 +49,33 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. using namespace MOBase; + +class NexusManualKeyDialog : public QDialog +{ +public: + NexusManualKeyDialog(QWidget* parent) + : QDialog(parent), ui(new Ui::NexusManualKeyDialog) + { + ui->setupUi(this); + } + + void accept() override + { + m_key = ui->key->toPlainText(); + QDialog::accept(); + } + + const QString& key() const + { + return m_key; + } + +private: + std::unique_ptr<Ui::NexusManualKeyDialog> ui; + QString m_key; +}; + + SettingsDialog::SettingsDialog(PluginContainer *pluginContainer, QWidget *parent) : TutorableDialog("SettingsDialog", parent) , ui(new Ui::SettingsDialog) @@ -344,6 +373,20 @@ void SettingsDialog::on_nexusConnect_clicked() m_nexusLogin->open(url); } +void SettingsDialog::on_nexusManualKey_clicked() +{ + NexusManualKeyDialog dialog(this); + + if (dialog.exec() != QDialog::Accepted) { + return; + } + + const auto key = dialog.key(); + emit processApiKey(key); + ui->nexusConnect->setText("Nexus API Key Stored"); + NexusInterface::instance(m_PluginContainer)->getAccessManager()->apiCheck(key, true); +} + void SettingsDialog::dispatchLogin() { m_KeyReceived = false; |
