新增存款计算器

This commit is contained in:
feiyangqingyun
2021-10-07 11:01:02 +08:00
parent 38cd834ac1
commit f6923b97a2
14 changed files with 378 additions and 91 deletions

View File

@@ -106,6 +106,12 @@ void SaveLog::save(const QString &content)
if (toNet) {
emit send(content);
} else {
//检查目录是否存在,不存在则先新建
QDir dir(path);
if (!dir.exists()) {
dir.mkdir(path);
}
//方法改进:之前每次输出日志都打开文件,改成只有当日期改变时才新建和打开文件
QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATE);
if (this->fileName != fileName) {

View File

@@ -44,10 +44,11 @@ private:
//日志文件完整名称
QString fileName;
signals:
Q_SIGNALS:
//发送内容信号
void send(const QString &content);
public slots:
public Q_SLOTS:
//启动日志服务
void start();
//暂停日志服务
@@ -61,7 +62,6 @@ public slots:
void setPath(const QString &path);
//设置日志文件名称
void setName(const QString &name);
};
class SendLog : public QObject
@@ -74,13 +74,17 @@ public:
private:
static QScopedPointer<SendLog> self;
//网络通信对象
QTcpSocket *socket;
//网络监听服务器
QTcpServer *server;
private slots:
//新连接到来
void newConnection();
public slots:
public Q_SLOTS:
//发送日志
void send(const QString &content);
};