12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "mainwidget.h"
- #include <QtWidgets/QApplication>
- #include <qmessagebox.h>
- #include <QSharedMemory>
- #include <QFile>
- #include "../Util/Util.h"
- #include <QProcess>
- #include <QJsonObject>
- #include <QSettings>
- #include <QJsonArray>
- #include <QJsonDocument>
- #include <QMessageBox>
- #include <QSharedMemory>
- #include "QFontDatabase.h"
- #include "QTextCodec.h"
- #include "qfileinfo.h"
- #include <QNetworkAccessManager>
- #include <QNetworkRequest>
- #include <QNetworkReply>
- #include "updatedlg.h"
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- QSharedMemory shared_memory;
- shared_memory.setKey("mutex_homework_unhandle");
- if (shared_memory.attach())
- {
- shared_memory.lock();
- *(char *)shared_memory.data() = 1;
- shared_memory.unlock();
- QMessageBox::information(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("程序已经运行!"));
- return 0;
- }
- shared_memory.create(1);
- wstring strFilePath;
- GetModuleDir(strFilePath);
- strFilePath.append(L"index.db3");
- QFile db_file(QString::fromStdWString(strFilePath));
- db_file.open(QIODevice::ReadOnly);
- int _length = db_file.size();
- db_file.close();
- if (_length == 0)
- {
- QMessageBox::information(NULL, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("本地配置未生成,请开启监控程序后再试!"));
- return 0;
- }
- a.setWindowIcon(QIcon(":/CHJUnHandle/Resources/exe.ico"));
- MainWidget w;
- w.show();
- return a.exec();
- }
|