summaryrefslogtreecommitdiffhomepage
path: root/variant
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-04-29 17:57:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-04-29 17:57:51 +0200
commite4b57076356c46b0158c1b401f8996134580e49b (patch)
treefb253cf8d57f5fdf670fcf25483bf132b57bd737 /variant
parent8b93346f02f8e78e1724efae7a3314ff7b848db9 (diff)
opentrack: simplify annoying as root
Diffstat (limited to 'variant')
-rw-r--r--variant/default/main-window.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp
index 1125b8a1..d5515eb1 100644
--- a/variant/default/main-window.cpp
+++ b/variant/default/main-window.cpp
@@ -50,21 +50,33 @@ void main_window::annoy_if_root()
{
if (geteuid() == 0)
{
- portable::sleep(4000);
- QMessageBox::critical(this,
- tr("Running as root is bad"),
- tr("Do not run as root. Set correct device node permissions."),
- QMessageBox::Ok);
- portable::sleep(4000);
- QMessageBox::critical(this,
- tr("Running as root is bad, seriously"),
- tr("Do not run as root. I'll keep whining at every startup."),
- QMessageBox::Ok);
- portable::sleep(4000);
- QMessageBox::critical(this,
- tr("Running as root is really seriously bad"),
- tr("Do not run as root. Be annoyed, comprehensively."),
- QMessageBox::Ok);
+ struct {
+ QString caption;
+ QString msg;
+ int sleep_ms;
+ } list const[] = {
+ {
+ tr("Running as root is bad"),
+ tr("Do not run as root. Set correct device node permissions."),
+ 1000,
+ }
+ {
+ tr("Running as root is bad, seriously"),
+ tr("Do not run as root. I'll keep whining at every startup."),
+ 3000,
+ },
+ {
+ tr("Be annoyed, comprehensively."),
+ tr("Don't run as root to remove these annoying messages."),
+ 0
+ }
+ };
+
+ for (const auto& x : list)
+ {
+ QMessageBox::critical(this, x.caption, x.msg, QMessageBox::Ok);
+ portable::sleep(x.sleep_ms);
+ }
}
}
#endif