summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-07-20 09:47:09 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-08-02 03:06:58 -0400
commitd91d0caba5fac3b2b27698a5e6ab4a9b60efbf53 (patch)
treebbd7b14a01a01db74db715f7d58d1a4e96389dd0
parentaf95b3b8637d28517f69a70f13b901cc7f43d121 (diff)
removed incorrect warning that steam password is unencrypted
split steam tab
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/settings.cpp36
-rw-r--r--src/settings.h13
-rw-r--r--src/settingsdialog.ui58
-rw-r--r--src/settingsdialogsteam.cpp17
-rw-r--r--src/settingsdialogsteam.h17
6 files changed, 64 insertions, 80 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b2407e17..a1adf2db 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -40,6 +40,7 @@ SET(organizer_SRCS
settingsdialoggeneral.cpp
settingsdialognexus.cpp
settingsdialogpaths.cpp
+ settingsdialogsteam.cpp
settings.cpp
selfupdater.cpp
selectiondialog.cpp
@@ -157,6 +158,7 @@ SET(organizer_HDRS
settingsdialoggeneral.h
settingsdialognexus.h
settingsdialogpaths.h
+ settingsdialogsteam.h
settings.h
selfupdater.h
selectiondialog.h
@@ -440,6 +442,7 @@ set(settings
settingsdialoggeneral
settingsdialognexus
settingsdialogpaths
+ settingsdialogsteam
)
set(utilities
diff --git a/src/settings.cpp b/src/settings.cpp
index bded470c..26c9720a 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -25,6 +25,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "settingsdialoggeneral.h"
#include "settingsdialognexus.h"
#include "settingsdialogpaths.h"
+#include "settingsdialogsteam.h"
#include "versioninfo.h"
#include "appconfig.h"
#include "organizercore.h"
@@ -391,15 +392,10 @@ bool Settings::hasNexusApiKey() const
bool Settings::getSteamLogin(QString &username, QString &password) const
{
- if (m_Settings.contains("Settings/steam_username")) {
- QString tempPass = deObfuscate("steam_password");
- if (!tempPass.isEmpty()) {
- username = m_Settings.value("Settings/steam_username").toString();
- password = tempPass;
- return true;
- }
- }
- return false;
+ username = m_Settings.value("Settings/steam_username", "").toString();
+ password = deObfuscate("steam_password");
+
+ return !username.isEmpty() && !password.isEmpty();
}
bool Settings::compactDownloads() const
{
@@ -680,7 +676,7 @@ void Settings::query(PluginContainer *pluginContainer, QWidget *parent)
tabs.push_back(std::unique_ptr<SettingsTab>(new PathsSettingsTab(this, dialog)));
tabs.push_back(std::unique_ptr<SettingsTab>(new DiagnosticsTab(this, dialog)));
tabs.push_back(std::unique_ptr<SettingsTab>(new NexusSettingsTab(this, dialog)));
- tabs.push_back(std::unique_ptr<SettingsTab>(new SteamTab(this, dialog)));
+ tabs.push_back(std::unique_ptr<SettingsTab>(new SteamSettingsTab(this, dialog)));
tabs.push_back(std::unique_ptr<SettingsTab>(new PluginsTab(this, dialog)));
tabs.push_back(std::unique_ptr<SettingsTab>(new WorkaroundsTab(this, dialog)));
@@ -770,26 +766,6 @@ void Settings::DiagnosticsTab::update()
}
-Settings::SteamTab::SteamTab(Settings *m_parent, SettingsDialog &m_dialog)
- : SettingsTab(m_parent, m_dialog)
- , m_steamUserEdit(m_dialog.findChild<QLineEdit *>("steamUserEdit"))
- , m_steamPassEdit(m_dialog.findChild<QLineEdit *>("steamPassEdit"))
-{
- if (m_Settings.contains("Settings/steam_username")) {
- m_steamUserEdit->setText(m_Settings.value("Settings/steam_username", "").toString());
- QString password = deObfuscate("steam_password");
- if (!password.isEmpty()) {
- m_steamPassEdit->setText(password);
- }
- }
-}
-
-void Settings::SteamTab::update()
-{
- //FIXME this should be inlined here?
- m_parent->setSteamLogin(m_steamUserEdit->text(), m_steamPassEdit->text());
-}
-
Settings::PluginsTab::PluginsTab(Settings *m_parent, SettingsDialog &m_dialog)
: SettingsTab(m_parent, m_dialog)
, m_pluginsList(m_dialog.findChild<QListWidget *>("pluginsList"))
diff --git a/src/settings.h b/src/settings.h
index b9383ce4..5bf705d1 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -461,19 +461,6 @@ private:
void setLevelsBox();
};
- /** Display/store the configuration in the 'steam' tab of the settings dialogue */
- class SteamTab : public SettingsTab
- {
- public:
- SteamTab(Settings *m_parent, SettingsDialog &m_dialog);
-
- void update();
-
- private:
- QLineEdit *m_steamUserEdit;
- QLineEdit *m_steamPassEdit;
- };
-
/** Display/store the configuration in the 'plugins' tab of the settings dialogue */
class PluginsTab : public SettingsTab
{
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 1e94bcde..3ad525e1 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -828,71 +828,55 @@ If you use pre-releases, never contact me directly by e-mail or via private mess
<string>Steam</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Username</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="steamUserEdit"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_20">
- <property name="text">
- <string>Password</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="steamPassEdit">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <spacer name="verticalSpacer_5">
+ <item row="4" column="0">
+ <spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Minimum</enum>
+ <enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>40</height>
+ <height>232</height>
</size>
</property>
</spacer>
</item>
- <item row="3" column="0" colspan="2">
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="steamUserEdit"/>
+ </item>
+ <item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_21">
<property name="text">
- <string>If you save your steam user ID and password here, they will be used when logging into steam. Note, however, your password will be stored unencrypted, so make sure your computer is secure.</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you save your steam user ID and password here, they will be used when logging into steam.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_20">
+ <property name="text">
+ <string>Password</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>232</height>
- </size>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="steamPassEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
</property>
- </spacer>
+ </widget>
</item>
</layout>
</widget>
diff --git a/src/settingsdialogsteam.cpp b/src/settingsdialogsteam.cpp
new file mode 100644
index 00000000..34c2d76b
--- /dev/null
+++ b/src/settingsdialogsteam.cpp
@@ -0,0 +1,17 @@
+#include "settingsdialogsteam.h"
+#include "ui_settingsdialog.h"
+
+SteamSettingsTab::SteamSettingsTab(Settings *m_parent, SettingsDialog &m_dialog)
+ : SettingsTab(m_parent, m_dialog)
+{
+ QString username, password;
+ m_parent->getSteamLogin(username, password);
+
+ ui->steamUserEdit->setText(username);
+ ui->steamPassEdit->setText(password);
+}
+
+void SteamSettingsTab::update()
+{
+ m_parent->setSteamLogin(ui->steamUserEdit->text(), ui->steamPassEdit->text());
+}
diff --git a/src/settingsdialogsteam.h b/src/settingsdialogsteam.h
new file mode 100644
index 00000000..dbd85151
--- /dev/null
+++ b/src/settingsdialogsteam.h
@@ -0,0 +1,17 @@
+#ifndef SETTINGSDIALOGSTEAM_H
+#define SETTINGSDIALOGSTEAM_H
+
+#include "settings.h"
+#include "settingsdialog.h"
+
+class SteamSettingsTab : public SettingsTab
+{
+public:
+ SteamSettingsTab(Settings *m_parent, SettingsDialog &m_dialog);
+
+ void update();
+
+private:
+};
+
+#endif // SETTINGSDIALOGSTEAM_H