MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //qDebug() << additionEvent("Olegrok"); qDebug() << *(int*)QThread::currentThreadId(); ui->setupUi(this); this->setGeometry(QDesktopWidget().availableGeometry().width()/2 - this->width()/2, QDesktopWidget().availableGeometry().height()/2 - this->width()/2, this->width(), this->height()); auth.setUpProfile(&account); addfriend.setUpProfile(&account); connect(&auth, &authwindow::showMainWindow, this, &MainWindow::windowInit, Qt::UniqueConnection); connect(&addfriend, &AddFriend::sendContact, this, &MainWindow::addContact, Qt::UniqueConnection); connect(&opt, &Options::logoutProfile, this, &MainWindow::logoutProfile, Qt::UniqueConnection); connect(&account, &Profile::authorizationError, this, &MainWindow::logout, Qt::UniqueConnection); connect(&account, &Profile::updateWindow, this, &MainWindow::updateWindow, Qt::UniqueConnection); connect(&account, SIGNAL(logout(QString)), this, SLOT(logout(QString)), Qt::DirectConnection); connect(ui->lineFindLogin, SIGNAL(textChanged(const QString&)), this, SLOT(findContact(const QString&))); connect(ui->lineFindMsg, SIGNAL(textChanged(const QString&)), this, SLOT(changeMsgLineEvent(const QString&))); connect(account.getMonitor_ptr(), SIGNAL(authorizationError()), this, SLOT(logout())); auth.show(); // this->show(); // ui->ContactsList->addItem("Green"); // ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackgroundColor(Qt::green); // //ui->ContactsList->findItems("Green", Qt::MatchExactly).first()->setBackground(Qt::gray); }
LTWindow::LTWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::LTWindow), eventData(EventData::getInstance()) { ui->setupUi(this); currDriver = -1; streamReader = new DataStreamReader(this); prefs = new PreferencesDialog(this); settings = new QSettings(F1LTCore::iniFile(), QSettings::IniFormat, this); loginDialog = new LoginDialog(this); ltFilesManagerDialog = new LTFilesManagerDialog(this); trackRecordsDialog = new TrackRecordsDialog(this); saw = new SessionAnalysisWidget(); stw = new SessionTimesWidget(); driverTrackerWidget = new DriverTrackerWidget(); aboutDialog = new AboutDialog(this); updatesCheckerDialog = new UpdatesCheckerDialog(this); // ui->trackStatusWidget->setupItems(); connect(streamReader, SIGNAL(tryAuthorize()), this, SLOT(tryAuthorize())); connect(streamReader, SIGNAL(authorized(QString)), this, SLOT(authorized(QString))); connect(streamReader, SIGNAL(eventDataChanged(const DataUpdates&)), this, SLOT(eventDataChanged(const DataUpdates&))); connect(streamReader, SIGNAL(driverDataChanged(int, const DataUpdates&)), this, SLOT(driverDataChanged(int, const DataUpdates&))); connect(streamReader, SIGNAL(dataChanged(const DataUpdates&)), this, SLOT(dataChanged(const DataUpdates&))); connect(streamReader, SIGNAL(sessionStarted()), this, SLOT(sessionStarted())); connect(streamReader, SIGNAL(authorizationError()), this, SLOT(authorizationError())); connect(streamReader, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError))); connect(streamReader, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); connect(streamReader, SIGNAL(noLiveSession(bool, QString)), this, SLOT(showNoSessionBoard(bool, QString))); connect(updatesCheckerDialog, SIGNAL(newVersionAvailable()), this, SLOT(onNewVersionAvailable())); sessionTimer = new SessionTimer(this); connect(sessionTimer, SIGNAL(updateWeather()), this, SLOT(updateWeather())); connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ImagesFactory::getInstance(), SLOT(reloadGraphics())); connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), &ColorsManager::getInstance(), SLOT(calculateDefaultDriverColors())); connect(&SeasonData::getInstance(), SIGNAL(seasonDataChanged()), saw, SLOT(setupColors())); connect(prefs, SIGNAL(driversColorsChanged()), saw, SLOT(setupColors())); eventRecorder = new EventRecorder(sessionTimer, this); eventPlayer = new EventPlayer(this); delayWidget = new DelayWidget(this); connect(delayWidget, SIGNAL(delayChanged(int, int)), streamReader, SLOT(setDelay(int, int))); connect(delayWidget, SIGNAL(delayChanged(int, int)), sessionTimer, SLOT(setDelay(int, int))); connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), delayWidget, SLOT(synchronizingTimer(bool))); connect(sessionTimer, SIGNAL(synchronizingTimer(bool)), driverTrackerWidget, SLOT(pauseTimer(bool))); connect(ui->messageBoardWidget, SIGNAL(connectClicked()), this, SLOT(on_actionConnect_triggered())); connect(ui->messageBoardWidget, SIGNAL(playClicked()), this, SLOT(on_actionOpen_triggered())); connect(ui->messageBoardWidget, SIGNAL(loadClicked()), this, SLOT(on_actionLT_files_data_base_triggered())); loadSettings(); ColorsManager::getInstance().calculateDefaultDriverColors(); saw->setupColors(); delayWidgetAction = ui->mainToolBar->addWidget(delayWidget); delayWidgetAction->setVisible(true); eventPlayerAction = ui->mainToolBar->addWidget(eventPlayer); eventPlayerAction->setVisible(false); recording = false; playing = false; connectionProgress = new QProgressDialog(this); connect(sessionTimer, SIGNAL(timeout()), this, SLOT(timeout())); connect(eventRecorder, SIGNAL(recordingStopped()), this, SLOT(autoStopRecording())); connect(eventPlayer, SIGNAL(playClicked(int)), this, SLOT(eventPlayerPlayClicked(int))); connect(eventPlayer, SIGNAL(pauseClicked()), this, SLOT(eventPlayerPauseClicked())); connect(eventPlayer, SIGNAL(rewindToStartClicked()), this, SLOT(eventPlayerRewindToStartClicked())); connect(eventPlayer, SIGNAL(forwardToEndClicked()), this, SLOT(eventPlayerForwardToEndClicked())); connect(eventPlayer, SIGNAL(rewindClicked()), this, SLOT(eventPlayerRewindClicked())); connect(eventPlayer, SIGNAL(stopClicked()), this, SLOT(eventPlayerStopClicked())); connect(eventPlayer, SIGNAL(nextPackets(QVector<Packet>)), streamReader, SLOT(parsePackets(QVector<Packet>))); connect(ui->ltWidget, SIGNAL(driverSelected(int)), ui->driverDataWidget, SLOT(printDriverData(int))); connect(ui->ltWidget, SIGNAL(driverDoubleClicked(int)), this, SLOT(ltWidgetDriverSelected(int))); ui->messageBoardWidget->setVisible(false); QStringList args = qApp->arguments(); if (args.size() > 1) { if (eventPlayer->loadFromFile(args.at(1)) == false) { QMessageBox::critical(this, "Error opening file!", "Could not open specified file, or the file is corrupted."); connectToServer(); return; } setWindowTitle("FILT - " + args.at(1)); ui->actionRecord->setVisible(false); ui->actionStop_recording->setVisible(false); eventPlayerAction->setVisible(true); delayWidgetAction->setVisible(false); playing = true; eventPlayer->startPlaying(); } else { if (settings->value("ui/auto_connect").toBool()) connectToServer(); else { ui->messageBoardWidget->showStartupBoard(); showSessionBoard(true); } } }