forked from shxhid01/TradingSimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·38 lines (32 loc) · 1 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <QDir>
#include <QDebug>
#include "mainwindow.h"
#include "logindialog.h"
#include <QCoreApplication>
#include <QProcess>
#include <QTextStream>
#include <QFile>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qDebug() << "Application started";
qDebug() << "Current working directory:" << QDir::currentPath();
qDebug() << "LOGINS.txt full path:" << QDir::currentPath() + "/LOGINS.txt";
// Check if LOGINS.txt exists
QFile loginsFile("LOGINS.txt");
if (loginsFile.exists()) {
qDebug() << "LOGINS.txt exists";
} else {
qDebug() << "LOGINS.txt does not exist, it will be created when a new account is added";
}
LoginDialog loginDialog;
if (loginDialog.exec() == QDialog::Accepted) {
qDebug() << "Login successful, opening main window";
MainWindow mainWindow(loginDialog.getUsername());
mainWindow.show();
return a.exec();
} else {
qDebug() << "Login canceled or failed";
}
return 0;
}