Change file names

This commit is contained in:
LoudSnorer 2022-12-28 13:24:01 -05:00
parent da7e0235fc
commit 1d0fe2e007
7 changed files with 49 additions and 48 deletions

View File

@ -541,7 +541,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
ui->JournalNotes->installEventFilter(this); ui->JournalNotes->installEventFilter(this);
// qDebug() << "Finished making new Daily object"; // qDebug() << "Finished making new Daily object";
// sleep(3); // sleep(3);
backupFiles=nullptr; saveGraphLayoutSettings=nullptr;
} }
Daily::~Daily() Daily::~Daily()
@ -564,7 +564,7 @@ Daily::~Daily()
delete ui; delete ui;
delete icon_on; delete icon_on;
delete icon_off; delete icon_off;
if (backupFiles!=nullptr) delete backupFiles; if (saveGraphLayoutSettings!=nullptr) delete saveGraphLayoutSettings;
} }
void Daily::showEvent(QShowEvent *) void Daily::showEvent(QShowEvent *)
@ -2853,11 +2853,11 @@ void Daily::on_splitter_2_splitterMoved(int, int)
} }
void Daily::on_backup_clicked() { void Daily::on_backup_clicked() {
if (!backupFiles) { if (!saveGraphLayoutSettings) {
backupFiles= new BackupFiles("daily",this); saveGraphLayoutSettings= new SaveGraphLayoutSettings("daily",this);
} }
if (backupFiles) { if (saveGraphLayoutSettings) {
backupFiles->backupMenu(GraphView); saveGraphLayoutSettings->menu(GraphView);
} }
} }

View File

@ -28,7 +28,7 @@
#include "Graphs/gLineChart.h" #include "Graphs/gLineChart.h"
#include "sessionbar.h" #include "sessionbar.h"
#include "mytextbrowser.h" #include "mytextbrowser.h"
#include "backupFiles.h" #include "saveGraphLayoutSettings.h"
namespace Ui { namespace Ui {
@ -363,7 +363,7 @@ private:
#endif #endif
bool BookmarksChanged; bool BookmarksChanged;
BackupFiles* backupFiles=nullptr; SaveGraphLayoutSettings* saveGraphLayoutSettings=nullptr;
}; };
#endif // DAILY_H #endif // DAILY_H

View File

@ -256,7 +256,7 @@ lessThan(QT_MAJOR_VERSION,5)|lessThan(QT_MINOR_VERSION,12) {
SOURCES += \ SOURCES += \
checkupdates.cpp \ checkupdates.cpp \
overview.cpp \ overview.cpp \
backupFiles.cpp \ saveGraphLayoutSettings.cpp \
common_gui.cpp \ common_gui.cpp \
cprogressbar.cpp \ cprogressbar.cpp \
daily.cpp \ daily.cpp \
@ -363,7 +363,7 @@ QMAKE_EXTRA_COMPILERS += optimize
HEADERS += \ HEADERS += \
checkupdates.h \ checkupdates.h \
overview.h \ overview.h \
backupFiles.h \ saveGraphLayoutSettings.h \
common_gui.h \ common_gui.h \
cprogressbar.h \ cprogressbar.h \
daily.h \ daily.h \

View File

@ -171,7 +171,7 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
connect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double))); connect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double)));
connect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo())); connect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo()));
connect(GraphView, SIGNAL(XBoundsChanged(qint64 ,qint64)), this, SLOT(on_XBoundsChanged(qint64 ,qint64))); connect(GraphView, SIGNAL(XBoundsChanged(qint64 ,qint64)), this, SLOT(on_XBoundsChanged(qint64 ,qint64)));
backupFiles=nullptr; saveGraphLayoutSettings=nullptr;
} }
Overview::~Overview() Overview::~Overview()
@ -193,7 +193,7 @@ Overview::~Overview()
delete icon_off ; delete icon_off ;
delete icon_up_down ; delete icon_up_down ;
delete icon_warning ; delete icon_warning ;
if (backupFiles!=nullptr) delete backupFiles; if (saveGraphLayoutSettings!=nullptr) delete saveGraphLayoutSettings;
} }
void Overview::ResetFont() void Overview::ResetFont()
@ -936,11 +936,11 @@ void Overview::on_toggleVisibility_clicked(bool checked)
} }
void Overview::on_backup_clicked() { void Overview::on_backup_clicked() {
if (!backupFiles) { if (!saveGraphLayoutSettings) {
backupFiles= new BackupFiles("overview",this); saveGraphLayoutSettings= new SaveGraphLayoutSettings("overview",this);
} }
if (backupFiles) { if (saveGraphLayoutSettings) {
backupFiles->backupMenu(GraphView); saveGraphLayoutSettings->menu(GraphView);
} }
} }

View File

@ -23,7 +23,7 @@
#include "Graphs/gOverviewGraph.h" #include "Graphs/gOverviewGraph.h"
#endif #endif
#include "Graphs/gSummaryChart.h" #include "Graphs/gSummaryChart.h"
#include "backupFiles.h" #include "saveGraphLayoutSettings.h"
#include <QRegularExpression> #include <QRegularExpression>
#include <QListWidget> #include <QListWidget>
@ -200,7 +200,7 @@ class Overview : public QWidget
// Are start and end widgets displaying the same month. // Are start and end widgets displaying the same month.
bool samePage; bool samePage;
BackupFiles* backupFiles=nullptr; SaveGraphLayoutSettings* saveGraphLayoutSettings=nullptr;
}; };

View File

@ -18,10 +18,11 @@
#include <QPixmap> #include <QPixmap>
#include <QSize> #include <QSize>
#include "SleepLib/profiles.h" #include "SleepLib/profiles.h"
#include "backupFiles.h" #include "saveGraphLayoutSettings.h"
BackupFiles::BackupFiles(QString title,QWidget* parent) : parent(parent),title(title)
SaveGraphLayoutSettings::SaveGraphLayoutSettings(QString title,QWidget* parent) : parent(parent),title(title)
{ {
// Initialize directory accesses to profile files. // Initialize directory accesses to profile files.
QString dirname = p_profile->Get("{DataFolder}/"); QString dirname = p_profile->Get("{DataFolder}/");
@ -54,7 +55,7 @@ BackupFiles::BackupFiles(QString title,QWidget* parent) : parent(parent),title(t
parseFilenameRe = new QRegularExpression(QString("^(%1[.](backup(\\d*)))[.]shg$").arg(title)); parseFilenameRe = new QRegularExpression(QString("^(%1[.](backup(\\d*)))[.]shg$").arg(title));
} }
BackupFiles::~BackupFiles() SaveGraphLayoutSettings::~SaveGraphLayoutSettings()
{ {
backupDialog->disconnect(backupaddFullBtn, SIGNAL(clicked()), this, SLOT (addFull_feature() )); backupDialog->disconnect(backupaddFullBtn, SIGNAL(clicked()), this, SLOT (addFull_feature() ));
backupDialog->disconnect(backupAddBtn, SIGNAL(clicked()), this, SLOT (add_feature() )); backupDialog->disconnect(backupAddBtn, SIGNAL(clicked()), this, SLOT (add_feature() ));
@ -76,7 +77,7 @@ BackupFiles::~BackupFiles()
delete parseFilenameRe; delete parseFilenameRe;
} }
void BackupFiles::createMenu() { void SaveGraphLayoutSettings::createMenu() {
styleOn= calculateStyle(true,false); styleOn= calculateStyle(true,false);
styleOff= calculateStyle(false,false); styleOff= calculateStyle(false,false);
styleExitBtn=calculateStyle(true,true); styleExitBtn=calculateStyle(true,true);
@ -185,7 +186,7 @@ void BackupFiles::createMenu() {
}; };
bool BackupFiles::confirmAction(QString name,QString question,QIcon* icon) { bool SaveGraphLayoutSettings::confirmAction(QString name,QString question,QIcon* icon) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(question); msgBox.setText(question);
if (icon!=nullptr) { if (icon!=nullptr) {
@ -207,7 +208,7 @@ bool BackupFiles::confirmAction(QString name,QString question,QIcon* icon) {
} }
QString BackupFiles::calculateStyle(bool on,bool exitBtn){ QString SaveGraphLayoutSettings::calculateStyle(bool on,bool exitBtn){
QString btnStyle=QString("QPushButton{%1%2}").arg(on QString btnStyle=QString("QPushButton{%1%2}").arg(on
?"color: black;background-color:white;" ?"color: black;background-color:white;"
:"color: darkgray;background-color:#e8e8e8 ;" :"color: darkgray;background-color:#e8e8e8 ;"
@ -231,12 +232,12 @@ QString BackupFiles::calculateStyle(bool on,bool exitBtn){
return btnStyle; return btnStyle;
} }
void BackupFiles::looksOn(QPushButton* button,bool on){ void SaveGraphLayoutSettings::looksOn(QPushButton* button,bool on){
button->setEnabled(on); button->setEnabled(on);
button->setStyleSheet(on?styleOn:styleOff); button->setStyleSheet(on?styleOn:styleOff);
} }
void BackupFiles::enableButtons(bool enable) { void SaveGraphLayoutSettings::enableButtons(bool enable) {
looksOn(backupUpdateBtn,enable); looksOn(backupUpdateBtn,enable);
looksOn(backupRestoreBtn,enable); looksOn(backupRestoreBtn,enable);
looksOn(backupDeleteBtn,enable); looksOn(backupDeleteBtn,enable);
@ -250,7 +251,7 @@ void BackupFiles::enableButtons(bool enable) {
} }
} }
void BackupFiles::update_feature() { void SaveGraphLayoutSettings::update_feature() {
if(!graphView) return; if(!graphView) return;
QListWidgetItem * item=backuplist->currentItem(); QListWidgetItem * item=backuplist->currentItem();
if (!item) return; if (!item) return;
@ -260,7 +261,7 @@ void BackupFiles::update_feature() {
graphView->SaveSettings(name); graphView->SaveSettings(name);
}; };
void BackupFiles::restore_feature() { void SaveGraphLayoutSettings::restore_feature() {
if(!graphView) return; if(!graphView) return;
QListWidgetItem * item=backuplist->currentItem(); QListWidgetItem * item=backuplist->currentItem();
if (!item) return; if (!item) return;
@ -270,16 +271,16 @@ void BackupFiles::restore_feature() {
exit(); exit();
}; };
void BackupFiles::rename_feature() { void SaveGraphLayoutSettings::rename_feature() {
if(!graphView) return; if(!graphView) return;
QListWidgetItem * item=backuplist->currentItem(); QListWidgetItem * item=backuplist->currentItem();
if (!item) return; if (!item) return;
backuplist->editItem(item); backuplist->editItem(item);
// BackupFiles::itemChanged(QListWidgetItem *item) is called when edit changes the entry. // SaveGraphLayoutSettings::itemChanged(QListWidgetItem *item) is called when edit changes the entry.
// itemChanged will update the description map // itemChanged will update the description map
} }
void BackupFiles::delete_feature() { void SaveGraphLayoutSettings::delete_feature() {
if(!graphView) return; if(!graphView) return;
QListWidgetItem * item=backuplist->currentItem(); QListWidgetItem * item=backuplist->currentItem();
if (!item) return; if (!item) return;
@ -296,7 +297,7 @@ void BackupFiles::delete_feature() {
enableButtons(true); enableButtons(true);
} }
void BackupFiles::addFull_feature() { void SaveGraphLayoutSettings::addFull_feature() {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("Maximum number of Backups exceeded.")); msgBox.setText(tr("Maximum number of Backups exceeded."));
msgBox.setStandardButtons(QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Cancel);
@ -311,7 +312,7 @@ void BackupFiles::addFull_feature() {
msgBox.exec(); msgBox.exec();
} }
void BackupFiles::add_feature() { void SaveGraphLayoutSettings::add_feature() {
if(!graphView) return; if(!graphView) return;
QString backupName = QString("%2%3").arg("backup").arg(unusedBackupNum,backupNumMaxLength,10,QLatin1Char('0')); QString backupName = QString("%2%3").arg("backup").arg(unusedBackupNum,backupNumMaxLength,10,QLatin1Char('0'));
@ -328,7 +329,7 @@ void BackupFiles::add_feature() {
} }
} }
void BackupFiles::itemChanged(QListWidgetItem *item) void SaveGraphLayoutSettings::itemChanged(QListWidgetItem *item)
{ {
QString backupName=item->data(backupFileName).toString(); QString backupName=item->data(backupFileName).toString();
QString desc= item->text(); QString desc= item->text();
@ -356,12 +357,12 @@ void BackupFiles::itemChanged(QListWidgetItem *item)
item->setText(desc); item->setText(desc);
} }
void BackupFiles::itemSelectionChanged() void SaveGraphLayoutSettings::itemSelectionChanged()
{ {
enableButtons(true); enableButtons(true);
} }
int BackupFiles::backupNum(QString backupName) { int SaveGraphLayoutSettings::backupNum(QString backupName) {
QRegularExpressionMatch match = backupFileNumRe->match(backupName); QRegularExpressionMatch match = backupFileNumRe->match(backupName);
int value=-1; int value=-1;
if (match.hasMatch()) { if (match.hasMatch()) {
@ -370,7 +371,7 @@ int BackupFiles::backupNum(QString backupName) {
return value; return value;
} }
QListWidgetItem* BackupFiles::updateFileList(QString find) { QListWidgetItem* SaveGraphLayoutSettings::updateFileList(QString find) {
Q_UNUSED(find); Q_UNUSED(find);
QListWidgetItem* ret=nullptr; QListWidgetItem* ret=nullptr;
enableButtons(false); enableButtons(false);
@ -423,11 +424,11 @@ QListWidgetItem* BackupFiles::updateFileList(QString find) {
} }
void BackupFiles::exit() { void SaveGraphLayoutSettings::exit() {
backupDialog->close(); backupDialog->close();
} }
void BackupFiles::backupMenu(gGraphView* graphView) { void SaveGraphLayoutSettings::menu(gGraphView* graphView) {
this->graphView=graphView; this->graphView=graphView;
updateFileList(); updateFileList();
backupDialog->raise(); backupDialog->raise();
@ -567,31 +568,31 @@ switch (ret) {
backupDialog->disconnect(backuplist, SIGNAL(itemPressed(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) )); backupDialog->disconnect(backuplist, SIGNAL(itemPressed(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) ));
void BackupFiles::itemActivated(QListWidgetItem *item) void SaveGraphLayoutSettings::itemActivated(QListWidgetItem *item)
{ {
Q_UNUSED( item ); Q_UNUSED( item );
DEBUGF Q( item->text() ); DEBUGF Q( item->text() );
} }
void BackupFiles::itemDoubleClicked(QListWidgetItem *item) void SaveGraphLayoutSettings::itemDoubleClicked(QListWidgetItem *item)
{ {
Q_UNUSED( item ); Q_UNUSED( item );
DEBUGF Q( item->text() ); DEBUGF Q( item->text() );
} }
void BackupFiles::itemClicked(QListWidgetItem *item) void SaveGraphLayoutSettings::itemClicked(QListWidgetItem *item)
{ {
Q_UNUSED( item ); Q_UNUSED( item );
DEBUGF Q( item->text() ); DEBUGF Q( item->text() );
} }
void BackupFiles::itemEntered(QListWidgetItem *item) void SaveGraphLayoutSettings::itemEntered(QListWidgetItem *item)
{ {
Q_UNUSED( item ); Q_UNUSED( item );
DEBUGF Q( item->text() ); DEBUGF Q( item->text() );
} }
void BackupFiles::itemPressed(QListWidgetItem *item) void SaveGraphLayoutSettings::itemPressed(QListWidgetItem *item)
{ {
Q_UNUSED( item ); Q_UNUSED( item );
DEBUGF Q( item->text() ); DEBUGF Q( item->text() );

View File

@ -37,13 +37,13 @@ private:
const QRegularExpression* parseDescriptionsRe; const QRegularExpression* parseDescriptionsRe;
}; };
class BackupFiles : public QWidget class SaveGraphLayoutSettings : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BackupFiles(QString title , QWidget* parent) ; explicit SaveGraphLayoutSettings(QString title , QWidget* parent) ;
~BackupFiles(); ~SaveGraphLayoutSettings();
void backupMenu(gGraphView* graphView); void menu(gGraphView* graphView);
protected: protected:
QIcon* m_icon_exit = new QIcon(":/icons/exit.png"); QIcon* m_icon_exit = new QIcon(":/icons/exit.png");
QIcon* m_icon_delete = new QIcon(":/icons/trash_can.png"); QIcon* m_icon_delete = new QIcon(":/icons/trash_can.png");