summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-03 17:23:55 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-03 17:23:55 +0300
commit0bdaa773a4ee5a678c400a1b097190e3856ee5a6 (patch)
treed9855dad5292cc218be9251fecf3f53aa0fede35 /src/gui/windows
parent7aec0517fe0874b5ac6e6590d442aa89a6f8f5a7 (diff)
downloadplus-0bdaa773a4ee5a678c400a1b097190e3856ee5a6.tar.gz
plus-0bdaa773a4ee5a678c400a1b097190e3856ee5a6.tar.bz2
plus-0bdaa773a4ee5a678c400a1b097190e3856ee5a6.tar.xz
plus-0bdaa773a4ee5a678c400a1b097190e3856ee5a6.zip
Convert UpdateType enum into strong typed enum.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/logindialog.cpp11
-rw-r--r--src/gui/windows/updaterwindow.cpp3
-rw-r--r--src/gui/windows/updaterwindow.h6
3 files changed, 13 insertions, 7 deletions
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 5230ef4fe..2d7adc09f 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -43,6 +43,7 @@
#include "net/charserverhandler.h"
#include "net/loginhandler.h"
+#include "net/updatetypeoperators.h"
#include "utils/delete2.h"
#include "utils/paths.h"
@@ -129,7 +130,7 @@ LoginDialog::LoginDialog(LoginData *const data,
mUpdateTypeDropDown->setActionEventId("updatetype");
mUpdateTypeDropDown->setSelected((mLoginData->updateType
- | UpdateType::Custom) ^ UpdateType::Custom);
+ | UpdateType::Custom) ^ static_cast<int>(UpdateType::Custom));
if (!mCustomUpdateHost->isSelected())
mUpdateHostText->setVisible(Visible_false);
@@ -280,12 +281,14 @@ void LoginDialog::prepareUpdate()
mLoginData->username = mUserField->getText();
mLoginData->password = mPassField->getText();
mLoginData->remember = mKeepCheck->isSelected();
- int updateType = mUpdateTypeDropDown->getSelected();
+ UpdateTypeT updateType = static_cast<UpdateTypeT>(
+ mUpdateTypeDropDown->getSelected());
if (mCustomUpdateHost->isSelected()
&& !mUpdateHostText->getText().empty())
{
- updateType |= UpdateType::Custom;
+ updateType = static_cast<UpdateTypeT>(
+ updateType | UpdateType::Custom);
serverConfig.setValue("customUpdateHost",
mUpdateHostText->getText());
@@ -326,7 +329,7 @@ void LoginDialog::prepareUpdate()
}
mLoginData->updateType = updateType;
- serverConfig.setValue("updateType", updateType);
+ serverConfig.setValue("updateType", static_cast<int>(updateType));
mRegisterButton->setEnabled(false);
mServerButton->setEnabled(false);
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index b8ead9549..ae63d194a 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -42,6 +42,7 @@
#include "gui/widgets/scrollarea.h"
#include "net/download.h"
+#include "net/updatetypeoperators.h"
#include "resources/resourcemanager.h"
@@ -168,7 +169,7 @@ static std::vector<UpdateFile> loadTxtFile(const std::string &fileName)
UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost,
const std::string &restrict updatesDir,
const bool applyUpdates,
- const int updateType) :
+ const UpdateTypeT updateType) :
// TRANSLATORS: updater window name
Window(_("Updating..."), Modal_false, nullptr, "update.xml"),
ActionListener(),
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index 06f707528..6484fe09d 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -24,6 +24,7 @@
#define GUI_WINDOWS_UPDATERWINDOW_H
#include "enums/net/downloadstatus.h"
+#include "enums/net/updatetype.h"
#include "gui/widgets/linkhandler.h"
#include "gui/widgets/window.h"
@@ -69,7 +70,8 @@ class UpdaterWindow final : public Window,
*/
UpdaterWindow(const std::string &restrict updateHost,
const std::string &restrict updatesDir,
- const bool applyUpdates, const int updateType);
+ const bool applyUpdates,
+ const UpdateTypeT updateType);
A_DELETE_COPY(UpdaterWindow)
@@ -242,7 +244,7 @@ class UpdaterWindow final : public Window,
/** Index offset for disaplay downloaded file. */
unsigned int mUpdateIndexOffset;
- int mUpdateType;
+ UpdateTypeT mUpdateType;
/** A flag to indicate whether to use a memory buffer or a regular
* file.