Update daily search tab. cleanup code. add user to change compare operator. minor ui change.

This commit is contained in:
LoudSnorer 2023-02-11 17:04:21 -05:00
parent a0f87f72f4
commit a0a0e08bc7
6 changed files with 645 additions and 474 deletions

View File

@ -66,6 +66,7 @@
<file>icons/update.png</file>
<file>icons/cog.png</file>
<file>icons/question_mark.png</file>
<file>icons/return.png</file>
<file>icons/checkmark.png</file>
<file>icons/empty_box.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,10 @@
#include <QDate>
#include <QTextDocument>
#include <QList>
#include <QFrame>
#include <QWidget>
#include <QTabWidget>
#include <QMap>
#include "SleepLib/common.h"
class QWidget ;
@ -53,56 +55,76 @@ private:
const int dateRole = Qt::UserRole;
const int valueRole = 1+Qt::UserRole;
const int opCodeRole = 3+Qt::UserRole;
const int passDisplayLimit = 30;
Daily* daily;
QWidget* parent;
QWidget* searchTabWidget;
QTabWidget* dailyTabWidget;
QFrame * innerCriteriaFrame;
QVBoxLayout* searchTabLayout;
QHBoxLayout* criteriaLayout;
QHBoxLayout* innerCriteriaLayout;
QHBoxLayout* searchLayout;
QHBoxLayout* statusLayout;
QHBoxLayout* summaryLayout;
QLabel* criteriaOperation;
QLabel* introduction;
QComboBox* selectCommand;
QLabel* selectLabel;
QLabel* statusA;
QLabel* statusB;
QLabel* statusC;
QLabel* summaryStatsA;
QLabel* summaryStatsB;
QLabel* summaryStatsC;
QDoubleSpinBox* enterDouble;
QSpinBox* enterInteger;
QLineEdit* enterString;
QPushButton* helpInfo;
bool helpMode=false;
int selectOperationOpCode = 0;
QComboBox* selectOperationCombo;
QPushButton* selectOperationButton;
QComboBox* selectCommandCombo;
QPushButton* selectCommandButton;
QPushButton* selectMatch;
QLabel* selectUnits;
QLabel* statusProgress;
QLabel* summaryProgress;
QLabel* summaryFound;
QLabel* summaryMinMax;
QDoubleSpinBox* selectDouble;
QSpinBox* selectInteger;
QLineEdit* selectString;
QPushButton* startButton;
QPushButton* continueButton;
QTableWidget* guiDisplayTable;
QIcon* icon_on;
QIcon* icon_off;
QTableWidgetItem* horizontalHeader0;
QTableWidgetItem* horizontalHeader1;
QIcon* m_icon_selected;
QIcon* m_icon_notSelected;
QIcon* m_icon_configure;
QIcon* m_icon_restore;
QIcon* m_icon_plus;
QMap <QString,qint32> opCodeMap;
void createUi();
void delayedCreateUi();
void search(QDate date, bool star);
void findall(QDate date, bool start);
void search(QDate date);
bool find(QDate& , Day* day);
EventDataType calculateAhi(Day* day);
void selectAligment(bool withParameters);
void displayStatistics();
void addItem(QDate date, QString value);
void criteriaChanged();
void endOfPass();
QString introductionStr();
void displayStatistics();
void addItem(QDate date, QString value);
void setCommandPopupEnabled(bool );
void setOperationPopupEnabled(bool );
void setOperation( );
QString opCodeStr(int);
QString helpStr();
QString centerLine(QString line);
QString formatTime (quint32) ;
QString convertRichText2Plain (QString rich);
EventDataType calculateAhi(Day* day);
bool compare(double,double );
bool compare(int,int );
bool createUiFinished=false;
bool startButtonMode=true;
int searchType;
int nextTab;
@ -117,22 +139,30 @@ private:
int daysFound;
int passFound;
enum minMax {none=0,minDouble,maxDouble,minInteger,maxInteger};
enum minMaxUnit {noUnit=0,time=1};
enum minMax {none=0,Double,Integer,timeInteger};
QString extraStr(int ivalue, double dvalue);
bool minMaxValid;
minMaxUnit minMaxUnit;
minMax minMaxMode;
quint32 minMaxInteger;
double minMaxDouble;
quint32 minInteger;
quint32 maxInteger;
double maxDouble;
double minDouble;
QTextDocument richText;
public slots:
private slots:
void on_itemActivated(QTableWidgetItem *item);
void on_itemClicked(QTableWidgetItem *item);
void on_startButton_clicked();
void on_continueButton_clicked();
void on_selectCommand_activated(int);
void on_selectMatch_clicked();
void on_selectCommandButton_clicked();
void on_selectCommandCombo_activated(int);
void on_selectOperationButton_clicked();
void on_selectOperationCombo_activated(int);
void on_helpInfo_clicked();
void on_dailyTabWidgetCurrentChanged(int);
void on_intValueChanged(int);
void on_doubleValueChanged(double);

BIN
oscar/icons/checkmark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
oscar/icons/empty_box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -7,7 +7,7 @@
* License. See the file COPYING in the main directory of the source code
* for more details. */
#define TEST_MACROS_ENABLEDoff
#define TEST_MACROS_ENABLED
#include <test_macros.h>
// Features enabled by conditional compilation.
@ -39,10 +39,10 @@
#include "mainwindow.h"
extern MainWindow *mainwin;
qint64 convertDateToTimeRtn(const QDate &date,int hours,int min,int sec) {
return QDateTime(date).addSecs(((hours*60+min)*60)+sec).toMSecsSinceEpoch();
}
qint64 convertDateToStartTime(const QDate &date) {
return convertDateToTimeRtn(date,0,10,0);
}