AttributeProfileMgmtDialog::~AttributeProfileMgmtDialog() { delete ui; deleteProfiles(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), networkAccessManager(this), clientFilesNetworkAccessManager(this), novaNetworkAccessManager(this), requiredFilesNetworkManager(this), patchesNetworkManager(this), fullScanWorkingThreads(0) { ui->setupUi(this); QCoreApplication::setOrganizationName("SWGEmu"); QCoreApplication::setOrganizationDomain("swg.openkod.com"); QCoreApplication::setApplicationName("Launchpad"); requiredFilesCount = 0; nextFileToDownload = 0; updateTimeCounter = 5; gameProcessesCount = 0; runningFullScan = false; fileScanner = new FileScanner(this); settings = new Settings(this); loginServers = new LoginServers(this); systemTrayIcon = new QSystemTrayIcon(this); systemTrayIcon->setIcon(QIcon(":/img/swgemu.svg")); systemTrayMenu = new QMenu(); closeAction = new QAction("Close", NULL); systemTrayMenu->addAction(closeAction); systemTrayIcon->setContextMenu(systemTrayMenu); QToolButton* newsButton = new QToolButton(ui->mainToolBar); newsButton->setIcon(QIcon(":/img/globe.svg")); newsButton->setText("News"); newsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); newsButton->setCheckable(true); ui->mainToolBar->addWidget(newsButton); connect(newsButton, SIGNAL(clicked()), this, SLOT(triggerNews())); toolButtons.append(newsButton); QToolButton* updateStatusButton = new QToolButton(ui->mainToolBar); updateStatusButton->setIcon(QIcon(":/img/update_status.svg")); updateStatusButton->setText("Update status"); updateStatusButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(updateStatusButton); connect(updateStatusButton, SIGNAL(clicked()), this, SLOT(updateServerStatus())); toolButtons.append(updateStatusButton); QToolButton* gameSettingsButton = new QToolButton(ui->mainToolBar); gameSettingsButton->setIcon(QIcon(":/img/game_settings.svg")); gameSettingsButton->setText("Game settings"); gameSettingsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(gameSettingsButton); connect(gameSettingsButton, SIGNAL(clicked()), this, SLOT(startSWGSetup())); toolButtons.append(gameSettingsButton); QToolButton* gameModsButton = new QToolButton(ui->mainToolBar); gameModsButton->setIcon(QIcon(":/img/magic.svg")); gameModsButton->setText("Game mods"); gameModsButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(gameModsButton); connect(gameModsButton, SIGNAL(clicked()), this, SLOT(showGameModsOptions())); toolButtons.append(gameModsButton); #ifdef ENABLE_MACRO_EDITOR QToolButton* macroEditorButton = new QToolButton(ui->mainToolBar); macroEditorButton->setIcon(QIcon(":/img/book.svg")); macroEditorButton->setText("Macro Editor"); macroEditorButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(macroEditorButton); connect(macroEditorButton, SIGNAL(clicked()), this, SLOT(showMacroEditor())); toolButtons.append(macroEditorButton); #endif QToolButton* profCalculatorButton = new QToolButton(ui->mainToolBar); profCalculatorButton->setIcon(QIcon(":/img/design.svg")); profCalculatorButton->setText("Profession Calculator"); profCalculatorButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(profCalculatorButton); connect(profCalculatorButton, SIGNAL(clicked()), this, SLOT(startKodanCalculator())); toolButtons.append(profCalculatorButton); QToolButton* deleteProfilesButton = new QToolButton(ui->mainToolBar); deleteProfilesButton->setIcon(QIcon(":/img/bin.svg")); deleteProfilesButton->setText("Delete game profiles"); deleteProfilesButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(deleteProfilesButton); connect(deleteProfilesButton, SIGNAL(clicked()), this, SLOT(deleteProfiles())); toolButtons.append(deleteProfilesButton); QToolButton* updateButton = new QToolButton(ui->mainToolBar); updateButton->setIcon(QIcon(":/img/cloud_down.svg")); updateButton->setText("Check for updates"); updateButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); ui->mainToolBar->addWidget(updateButton); connect(updateButton, SIGNAL(clicked()), this, SLOT(checkForUpdates())); toolButtons.append(updateButton); cancelWorkingThreads = false; connect(ui->mainToolBar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(toolBarOrientationChanged(Qt::Orientation))); connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason))); connect(closeAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui->actionFolders, SIGNAL(triggered()), this, SLOT(showSettings())); connect(&networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) ); connect(&novaNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) ); connect(&clientFilesNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFileFinished(QNetworkReply*))); connect(&requiredFilesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requiredFileDownloadFileFinished(QNetworkReply*))); connect(&patchesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(patchesDownloadFileFinished(QNetworkReply*))); connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(webPageLoadFinished(bool))); connect(ui->pushButton_Start, SIGNAL(clicked()), this, SLOT(startSWG())); connect(fileScanner, SIGNAL(requiredFileExists(QString)), this, SLOT(updateBasicLoadProgress(QString))); connect(fileScanner, SIGNAL(fullScannedFile(QString, bool)), this, SLOT(updateFullScanProgress(QString, bool))); connect(this, SIGNAL(startDownload()), this, SLOT(startFileDownload())); connect(ui->actionLogin_Servers, SIGNAL(triggered()), loginServers, SLOT(show())); connect(ui->actionShow_news, SIGNAL(triggered()), this, SLOT(triggerNews())); connect(ui->checkBox_instances, SIGNAL(toggled(bool)), this, SLOT(triggerMultipleInstances(bool))); connect(ui->actionUpdate_Status, SIGNAL(triggered()), this, SLOT(updateServerStatus())); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(ui->actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates())); connect(ui->actionGame_Settings, SIGNAL(triggered()), this, SLOT(startSWGSetup())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(ui->actionDelete_Profiles, SIGNAL(triggered()), this, SLOT(deleteProfiles())); connect(fileScanner, SIGNAL(addFileToDownload(QString)), this, SLOT(addFileToDownloadSlot(QString))); connect(ui->actionInstall_from_SWG, SIGNAL(triggered()), this, SLOT(installSWGEmu())); ui->groupBox_browser->hide(); QTabBar* tabBar = ui->tabWidget->tabBar(); tabBar->setTabButton(0, QTabBar::RightSide, 0); tabBar->setTabButton(0, QTabBar::LeftSide, 0); QSettings settingsOptions; QString swgFolder = settingsOptions.value("swg_folder").toString(); bool multipleInstances = settingsOptions.value("multiple_instances").toBool(); ui->checkBox_instances->setChecked(multipleInstances); ui->textBrowser->viewport()->setAutoFillBackground(false); ui->textBrowser->setAutoFillBackground(false); updateServerStatus(); connect(&loadWatcher, SIGNAL(finished()), this, SLOT(loadFinished())); //connect(&fullScanWatcher, SIGNAL(finished()), this, SLOT(fullScanFinished())); connect(ui->pushButton_FullScan, SIGNAL(clicked()), this, SLOT(startFullScan())); loginServers->reloadServers(); updateLoginServerList(); silentSelfUpdater = new SelfUpdater(true, this); if (!swgFolder.isEmpty()) startLoadBasicCheck(); else { #ifdef Q_OS_WIN32 QDir dir("C:/SWGEmu"); if (dir.exists() && FileScanner::checkSwgFolder("C:/SWGEmu")) { settingsOptions.setValue("swg_folder", "C:/SWGEmu"); startLoadBasicCheck(); } else #endif QMessageBox::warning(this, "Error", "Please set the swgemu folder in Settings->Options or install using Settings->Select install folder option"); } restoreGeometry(settingsOptions.value("mainWindowGeometry").toByteArray()); restoreState(settingsOptions.value("mainWindowState").toByteArray()); QString savedLogin = settingsOptions.value("selected_login_server", "").toString(); if (!savedLogin.isEmpty()) { int idx = ui->comboBox_login->findText(savedLogin); if (idx >= 0) { ui->comboBox_login->setCurrentIndex(idx); } } requiredFilesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "required2.txt"))); //patchesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "patches.txt"))); silentSelfUpdater->silentCheck(); //ui->webView->setUrl(newsUrl); //gameMods = new GameMods(this); }