]> git.sur5r.net Git - fstl/commitdiff
Adding about box
authorMatt Keeter <matt.j.keeter@gmail.com>
Fri, 7 Mar 2014 17:45:00 +0000 (11:45 -0600)
committerMatt Keeter <matt.j.keeter@gmail.com>
Fri, 7 Mar 2014 17:45:00 +0000 (11:45 -0600)
src/window.cpp
src/window.h

index 5c5e1c3332bb02f556361746b88d98f53ef22250..6b125636027a33836aa0ef234972abf964113cc3 100644 (file)
@@ -1,4 +1,5 @@
 #include <QMenuBar>
+#include <QMessageBox>
 #include <QFileDialog>
 
 #include "window.h"
@@ -27,10 +28,17 @@ Window::Window(QWidget *parent) :
     QObject::connect(quit_action, SIGNAL(triggered()),
                      this, SLOT(close()));
 
+    about_action = new QAction("About", this);
+    QObject::connect(about_action, SIGNAL(triggered()),
+                     this, SLOT(on_about()));
+
     auto file_menu = menuBar()->addMenu("File");
     file_menu->addAction(open_action);
     file_menu->addAction(quit_action);
 
+    auto help_menu = menuBar()->addMenu("Help");
+    help_menu->addAction(about_action);
+
     resize(600, 400);
 }
 
@@ -44,6 +52,15 @@ void Window::on_open()
     }
 }
 
+void Window::on_about()
+{
+    QMessageBox::about(this, "About fstl", "<b>fstl</b><br><br>"
+                       "A fast viewer for <code>.stl</code> files.<br>"
+                       "<a href=\"https://github.com/mkeeter/fstl\">https://github.com/mkeeter/fstl</a><br><br>"
+                       "© 2014 Matthew Keeter<br>"
+                       "<a href=\"mailto:matt.j.keeter@gmail.com\">matt.j.keeter@gmail.com</a><br>");
+}
+
 
 void Window::enable_open_action()
 {
index eefaece9e8bb7f334c3fb41093ad8a41c9b864ba..cb4aeb37f575d115423f64aa7f57fecb8a35dd13 100644 (file)
@@ -14,11 +14,13 @@ public:
 
 public slots:
     void on_open();
+    void on_about();
     void disable_open_action();
     void enable_open_action();
 
 private:
     QAction* open_action;
+    QAction* about_action;
     QAction* quit_action;
 
     Canvas* canvas;