Skip to content

Commit

Permalink
Logo+Setting icon added
Browse files Browse the repository at this point in the history
if logging is started then confirmationbox will apear if user need to go
back to settings window.

some other small bugs are also identified and killed. :-)
  • Loading branch information
Mubshr07 committed Jun 12, 2021
1 parent 02977a2 commit 8375907
Show file tree
Hide file tree
Showing 16 changed files with 381 additions and 28 deletions.
6 changes: 6 additions & 0 deletions DAQ.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SOURCES += \
classes/qcustomplot.cpp \
classes/globalvars.cpp \
classes/loggerthread.cpp \
confirmationbox.cpp \
graphwin.cpp \
main.cpp \
mainwindow.cpp
Expand All @@ -31,14 +32,19 @@ HEADERS += \
classes/qcustomplot.h \
classes/globalvars.h \
classes/loggerthread.h \
confirmationbox.h \
graphwin.h \
mainwindow.h

FORMS += \
confirmationbox.ui \
graphwin.ui \
mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
pics.qrc
2 changes: 1 addition & 1 deletion classes/globalvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


#include "qdebug.h"

#include "confirmationbox.h"

class globalVars : public QObject
{
Expand Down
28 changes: 18 additions & 10 deletions classes/loggerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ void loggerThread::on_timer_logger_elapsed()
}



elapsed_timeNanoSec = timer_elapser->nsecsElapsed();
sampleRate_MS_Calculated = (sampleRate_MS - (elapsed_timeNanoSec/1000000.0));
timer_logger->setInterval(sampleRate_MS_Calculated);
if(!graphWindowIsOpen)
{
timer_logger->setInterval(300);
}
else
{
elapsed_timeNanoSec = timer_elapser->nsecsElapsed();
sampleRate_MS_Calculated = (sampleRate_MS - (elapsed_timeNanoSec/1000000.0));
timer_logger->setInterval(sampleRate_MS_Calculated);
}
//qDebug()<<" 2222222222 ";
}
void loggerThread::on_timer_graphValue_elapsed()
Expand Down Expand Up @@ -130,10 +136,10 @@ void loggerThread::rx_setChannelEnableDisable(int chnlIndex, bool enable)
{
emit tx_channelisEnabled(chnlIndex, chnlArray[chnlIndex].setChannelEnableDisable(enable));
}
void loggerThread::rx_setSampleTime(int sec)
void loggerThread::rx_setSampleTime(int mSec)
{
sampleRate_Sec = sec;
sampleRate_MS = (sampleRate_Sec * 1000.0);
sampleRate_Sec = mSec/1000.0;
sampleRate_MS = mSec;
}
void loggerThread::rx_loggingStartStop(bool start)
{
Expand All @@ -151,9 +157,10 @@ void loggerThread::rx_giveMeEnablesChannels()
{
if(addFirstEnableChannelinGraph)
{
qDebug()<<" First channel is added "<<i;
addFirstEnableChannelinGraph = false;
graphChannels_idx[i] = i;
graphChannels_idxBool[i] = true;
graphChannels_idx[0] = i;
graphChannels_idxBool[0] = true;
}
emit tx_EnableChannelsAre(i);
}
Expand All @@ -172,7 +179,8 @@ void loggerThread::rx_RemoveChannelToGraph(int idx, int chnlID)
}
void loggerThread::rx_GraphWindowIsOpen(bool windOpen)
{
//qDebug()<<" Graph Window is Open : "<<windOpen;
qDebug()<<" Graph Window is Open : "<<windOpen;
if(windOpen == false) addFirstEnableChannelinGraph = true;
graphWindowIsOpen = windOpen;
if(windOpen)
initialize_Dir_FileName();
Expand Down
2 changes: 1 addition & 1 deletion classes/loggerthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class loggerThread : public QObject

public slots:
void rx_setChannelEnableDisable(int chnlIndex, bool enable);
void rx_setSampleTime(int sec);
void rx_setSampleTime(int mSec);
void rx_loggingStartStop(bool start);

void rx_AddNewChannelToGraph(int idx, int chnlID);
Expand Down
62 changes: 62 additions & 0 deletions confirmationbox.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "confirmationbox.h"
#include "ui_confirmationbox.h"

ConfirmationBox::ConfirmationBox(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConfirmationBox)
{
ui->setupUi(this);
this->setFixedSize(530, 300);
// int msgBox_width = 530;
// int msgBox_height = 300;
// int x = (parentWidget()->window()->frameGeometry().topLeft().x()+ parentWidget()->window()->rect().y()) - (msgBox_width);
// int y = parentWidget()->window()->frameGeometry().topLeft().y() + parentWidget()->window()->rect().y() - (msgBox_height);

//this->setGeometry(x, y, msgBox_width, msgBox_height);
//qDebug()<<" x:"<<x<<" y:"<<y<<" width:"<<msgBox_width<<" Height:"<<msgBox_height;

this->setWindowFlags(Qt::FramelessWindowHint);
//this->setWindowState(Qt::WindowFullScreen);
this->setWindowFlag(Qt::WindowStaysOnTopHint);
this->setAttribute(Qt::WA_DeleteOnClose, true); //so that it will be deleted when closed



}

ConfirmationBox::~ConfirmationBox()
{
delete ui;
}

void ConfirmationBox::on_pb_Yes_clicked()
{
emit tx_confirmationBoxClosed(true, localParam);
this->close();
}
void ConfirmationBox::on_pb_No_clicked()
{
emit tx_confirmationBoxClosed(false, localParam);
this->close();
}


// ---------------- slots -------------------------
void ConfirmationBox::rx_MessageBoxVariables(int parm, QString title, QString msg)
{
localParam = parm;
ui->lbl_Title->setText(title);
ui->lbl_Message->setText(msg);
}
void ConfirmationBox::rx_MessageBoxVariables(int parm, QString title, QString msg, QString yesBtnText, bool yesBtnShow, QString noBtnText, bool noBtnShow)
{
localParam = parm;
ui->lbl_Title->setText(title);
ui->lbl_Message->setText(msg);

ui->pb_Yes->setText(yesBtnText);
ui->pb_Yes->setVisible(yesBtnShow);

ui->pb_No->setText(noBtnText);
ui->pb_No->setVisible(noBtnShow);
}
41 changes: 41 additions & 0 deletions confirmationbox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef CONFIRMATIONBOX_H
#define CONFIRMATIONBOX_H

#include <QDialog>

#include "qdebug.h"

namespace Ui {
class ConfirmationBox;
}

class ConfirmationBox : public QDialog
{
Q_OBJECT

public:
explicit ConfirmationBox(QWidget *parent = nullptr);
~ConfirmationBox();

signals:
void tx_confirmationBoxClosed(bool yesBTN, int param);



public slots:
void rx_MessageBoxVariables(int parm, QString title, QString msg);
void rx_MessageBoxVariables(int parm, QString title, QString msg, QString yesBtnText, bool yesBtnShow, QString noBtnText, bool noBtnShow);



private slots:
void on_pb_Yes_clicked();
void on_pb_No_clicked();

private:
Ui::ConfirmationBox *ui;

int localParam = 0;
};

#endif // CONFIRMATIONBOX_H
168 changes: 168 additions & 0 deletions confirmationbox.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfirmationBox</class>
<widget class="QDialog" name="ConfirmationBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>530</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">QDialog {color: qlineargradient(spread:pad, x1:0 y1:0, x2:1 y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));

background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 rgb(39, 46, 141) , stop:0.5 rgb(39, 46, 141) , stop:1 rgb(149, 155, 173) );
}
QPushButton {
font: 600 20pt &quot;Times New Roman&quot;;
padding: 5px;
background-color: rgb(255, 255, 255);
border: 1px solid black;
border-radius:5px;
}
QPushButton:hover {
font: 600 20pt &quot;Times New Roman&quot;;
padding: 5px;
background-color: rgb(215, 215, 215);
border: 2px solid black;
border-radius:5px;
}
QLabel {
font: 600 18pt &quot;Times New Roman&quot;;
padding: 8px;
color:white;
}

QLCDNumber{
font: 600 18pt &quot;Times New Roman&quot;;
padding: 8px;
background-color:transparent;
border:0px solid transparent;
}

QPushButton:disabled {
background-color:#ff0000;
border:0px solid transparent;
} </string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lbl_Title">
<property name="styleSheet">
<string notr="true">color:white;
font:700 36pt &quot;Old English Text MT&quot;;
text-decoration:underline;</string>
</property>
<property name="text">
<string>Title</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Message">
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">color:white;
font:600 18pt &quot;Times New Roman&quot;;</string>
</property>
<property name="text">
<string>Message</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_Yes">
<property name="text">
<string>Yes</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_No">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>No</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit 8375907

Please sign in to comment.