aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall-frontend/source/mainwindow.h
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2015-02-21 03:44:07 +1100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2015-02-21 03:50:55 +1100
commitd3335dec58fff9fd5f33433f80c0a1f7500c1ea5 (patch)
tree76a710ad3cc495b5c4a8a2271f904256c5e265c5 /heimdall-frontend/source/mainwindow.h
parentfae5f627a092ca3b3c79d0da050e6ff41c67f53f (diff)
downloadexternal_heimdall-d3335dec58fff9fd5f33433f80c0a1f7500c1ea5.zip
external_heimdall-d3335dec58fff9fd5f33433f80c0a1f7500c1ea5.tar.gz
external_heimdall-d3335dec58fff9fd5f33433f80c0a1f7500c1ea5.tar.bz2
Fixed a few Heimdall Frontend niggles
Yes, the HeimdallState enum class operator overloading and operator usage is crazy nonsense. I want to love enum class, but this is just ridiculous.
Diffstat (limited to 'heimdall-frontend/source/mainwindow.h')
-rw-r--r--heimdall-frontend/source/mainwindow.h43
1 files changed, 33 insertions, 10 deletions
diff --git a/heimdall-frontend/source/mainwindow.h b/heimdall-frontend/source/mainwindow.h
index 8783792..d0b8703 100644
--- a/heimdall-frontend/source/mainwindow.h
+++ b/heimdall-frontend/source/mainwindow.h
@@ -39,22 +39,45 @@ using namespace libpit;
namespace HeimdallFrontend
{
+ enum class HeimdallState : int
+ {
+ Stopped = 1,
+ Flashing = (int)Stopped << 1,
+ DetectingDevice = (int)Flashing << 1,
+ ClosingPcScreen = (int)DetectingDevice << 1,
+ PrintingPit = (int)ClosingPcScreen << 1,
+ DownloadingPit = (int)PrintingPit << 1,
+ NoReboot = (int)DownloadingPit << 1
+ };
+
+ inline HeimdallState operator|(HeimdallState lhs, HeimdallState rhs)
+ {
+ return (HeimdallState)((int)lhs | (int)rhs);
+ }
+
+ inline HeimdallState& operator|=(HeimdallState& lhs, HeimdallState rhs)
+ {
+ lhs = lhs | rhs;
+ return lhs;
+ }
+
+ inline HeimdallState operator&(HeimdallState lhs, HeimdallState rhs)
+ {
+ lhs = (HeimdallState)((int)lhs & (int)rhs);
+ return lhs;
+ }
+
+ inline bool operator!(HeimdallState state)
+ {
+ return (int)state == 0;
+ }
+
class MainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
private:
- enum class HeimdallState
- {
- Stopped = 0,
- Flashing,
- DetectingDevice,
- ClosingPcScreen,
- PrintingPit,
- DownloadingPit
- };
-
enum
{
kPrintPitSourceDevice = 0,