summaryrefslogtreecommitdiffhomepage
path: root/variant/default/main-window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'variant/default/main-window.cpp')
-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