Skip to content

Commit

Permalink
Some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ic005k committed Oct 18, 2024
1 parent 6ceb9b5 commit 3274916
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/EditRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ extern QRegularExpression regxNumber;
extern bool isBreak, isDark, isReport, isWholeMonth, isDateSection, isDark;
extern int fontSize;

extern QString loadText(QString textFile);
extern void TextEditToFile(QTextEdit *txtEdit, QString fileName);

bool del = false;

QStringList c_list;
Expand Down Expand Up @@ -153,6 +156,8 @@ void EditRecord::on_btnOk_clicked() {

del = false;
mw_one->startSave("tab");

writeToLog(mw_one->strLatestModify);
}

void EditRecord::on_btn7_clicked() { set_Amount("7"); }
Expand Down Expand Up @@ -540,3 +545,18 @@ void EditRecord::monthSum() {
isWholeMonth = b1;
isDateSection = b2;
}

void EditRecord::writeToLog(QString str) {
QString logfile = privateDir + "log.txt";
QStringList list = mw_one->m_Reader->readText(logfile);
if (list.count() > 99) {
list.removeAt(list.count() - 1);
}
list.insert(0, QDateTime::currentDateTime().toString() + " " + str);
QTextEdit *edit = new QTextEdit();
for (int i = 0; i < list.count(); i++) {
edit->append(list.at(i));
}

TextEditToFile(edit, logfile);
}
3 changes: 3 additions & 0 deletions src/EditRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QDialog>
#include <QListWidget>
#include <QSet>
#include <QTextEdit>
#include <QWidgetAction>

#include "src/CategoryList.h"
Expand Down Expand Up @@ -78,6 +79,8 @@ class EditRecord : public QDialog {

void monthSum();

void writeToLog(QString str);

private:
void set_Amount(QString Number);

Expand Down
1 change: 1 addition & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ bool MainWindow::del_Data(QTreeWidget *tw) {

isDelItem = true;
reloadMain();
m_EditRecord->writeToLog(strLatestModify);

break;
}
Expand Down

0 comments on commit 3274916

Please sign in to comment.