Version 1.0.0
[ameter] / mainwindow.cpp
index 6efe040..672c4e2 100644 (file)
@@ -1,15 +1,17 @@
+#include <QtCore/QCoreApplication>
+
 #include "mainwindow.h"
 #include "asettings.h"
+#include "about.h"
 
 extern qreal g_n;
 extern qreal a_max;
 extern int divisions;
 extern int angle_step;
+extern int smoothing;
 
 int data_rate = 0;
 
-#include <QtCore/QCoreApplication>
-
 MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
 {
@@ -21,13 +23,15 @@ MainWindow::MainWindow(QWidget *parent)
        a_max = settings.value("max", a_max).toDouble();
        divisions = settings.value("divisions", divisions).toInt();
        angle_step = settings.value("angle_step", angle_step).toInt();
+       smoothing = settings.value("smoothing", smoothing).toInt();
        data_rate = settings.value("rate", data_rate).toInt();
-       
+
        awidget = new AMeterWidget(this);
        setCentralWidget(awidget);
        action = bar->addAction("&About");
+       connect(action, SIGNAL(triggered()), this, SLOT(showAbout()));
        action = bar->addAction("&Settings");
-       connect(action, SIGNAL(triggered()), this, SLOT(changeSettings()));
+       connect(action, SIGNAL(triggered()), this, SLOT(showSettings()));
        accelerometer = new QAccelerometer(this);
        accelerometer->setProperty("alwaysOn", true);
        accelerometer->addFilter(awidget);
@@ -42,7 +46,14 @@ MainWindow::~MainWindow()
        delete accelerometer;
 }
 
-void MainWindow::changeSettings()
+void MainWindow::showAbout()
+{
+       AboutDialog dialog(this);
+
+       dialog.exec();
+}
+
+void MainWindow::showSettings()
 {
        SettingsDialog dialog(this);
        QSettings settings("igorinov", "ameter", this);
@@ -117,3 +128,4 @@ void MainWindow::showExpanded()
     show();
 #endif
 }
+