Changeset - d4f23bf96cf5
[Not reviewed]
default
0 2 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-06-22 06:32:11
hy@ozderya.net
added demo mode indicator
2 files changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -143,6 +143,15 @@ MainWindow::MainWindow(QWidget *parent) 
 
                     this, &MainWindow::demoTimerTimeout);
 
    QObject::connect(ui->actionDemoMode, &QAction::toggled,
 
                     this, &MainWindow::enableDemo);
 

	
 
    {   // init demo indicator
 
        QwtText demoText("DEMO RUNNING");
 
        demoText.setColor(QColor("red"));
 
        demoText.setRenderFlags(Qt::AlignLeft | Qt::AlignTop);
 
        demoIndicator.setText(demoText);
 
        demoIndicator.hide();
 
        demoIndicator.attach(ui->plot);
 
    }
 
}
 

	
 
MainWindow::~MainWindow()
 
@@ -570,6 +579,8 @@ void MainWindow::enableDemo(bool enabled
 
        {
 
            demoTimer.start();
 
            ui->actionDemoMode->setChecked(true);
 
            demoIndicator.show();
 
            ui->plot->replot();
 
        }
 
        else
 
        {
 
@@ -580,6 +591,8 @@ void MainWindow::enableDemo(bool enabled
 
    {
 
        demoTimer.stop();
 
        ui->actionDemoMode->setChecked(false);
 
        demoIndicator.hide();
 
        ui->plot->replot();
 
    }
 
}
 

	
mainwindow.h
Show inline comments
 
@@ -31,6 +31,7 @@
 
#include <QColor>
 
#include <QtGlobal>
 
#include <qwt_plot_curve.h>
 
#include <qwt_plot_textlabel.h>
 

	
 
#include "portcontrol.h"
 
#include "ui_about_dialog.h"
 
@@ -96,6 +97,7 @@ private:
 
    QTimer demoTimer;
 
    int demoCount;
 
    bool isDemoRunning();
 
    QwtPlotTextLabel demoIndicator;
 

	
 
    QColor makeColor(unsigned int channelIndex);
 

	
0 comments (0 inline, 0 general)