void MainWindow::setTabCaptions() { QTabBar* bar = ui->tabWidget->tabBar(); short tabCount = this->tabCaptions.length(); for (int x = 0; x < tabCount; ++x) { this->setTabCaption(x, this->tabCaptions.at(x)); if (this->logCount.at(x) > 0) bar->setTabTextColor(x, QColor(0, 0, 0)); else bar->setTabTextColor(x, QColor(180, 180, 180)); } }
void MainWindow::gameProcessFinished(GameProcess* process, int ) { //ui->tabWidget->fi int index = ui->tabWidget->indexOf(process); //ui->tabWidget->setTabText(index, ""); if (index < 1) return; QTabBar* bar = ui->tabWidget->tabBar(); bar->setTabTextColor(index, Qt::red); }
void chatRoom::displayText(Message *m, int index) { QMap<int, User*>::iterator it; it = global->find(m->getFrom()); QString username; User *user = it.value(); if(it == global->end()) { username.append("not yet connected"); } else { username.append(user->getUsername()); } qDebug() << m->getFrom(); QString mText(m->getBuffer()); if(roomID != 0) { QTabBar *tabBar = tab->tabBar(); if(tabID != index) { tabBar->setTabTextColor(m->getDest(), Qt::red); } } //display->setStyleSheet("font: 9pt \"Courier\";"); display->appendPlainText(username + ": " + mText); }
void MainWindow::startSWG() { QStringList arguments; QSettings settings; QString folder = settings.value("swg_folder").toString(); bool multiple = settings.value("multiple_instances").toBool(); ConfigParser* parser = new ConfigParser(); GameProcess* process = new GameProcess(parser, NULL); parser->connect(parser, SIGNAL(errorSignal(QString)), process, SLOT(outputDebugString(QString))); try { if (parser->loadFile(folder, "swgemu.cfg") != 0) { QMessageBox::warning(this, "Warning", "There was an issue parsing the swg config files! To restore them run full scan!"); } } catch (...) { QMessageBox::warning(this, "Warning", "There was an issue parsing the swg config files! To restore them run full scan!"); } QVector<ConfigValue> loginServerAddresses = parser->getConfigValues("ClientGame", "loginServerAddress0"); QVector<ConfigValue> loginServerPorts = parser->getConfigValues("ClientGame", "loginServerPort0"); if (loginServerAddresses.size() > 1) { QString warningString; QTextStream stream(&warningString); stream << "You have several login server addresses defined in the following swg config files: "; for (int i = 0; i < loginServerAddresses.size(); ++i) { const ConfigValue val = loginServerAddresses.at(i); stream << val.fileName << " "; } stream << " client will use the value: " << parser->getStringConfigValue("ClientGame", "loginServerAddress0"); QMessageBox::warning(this, "Warning", warningString); } if (loginServerPorts.size() > 1) { QString warningString; QTextStream stream(&warningString); stream << "You have several login server ports defined in the following swg config files: "; for (int i = 0; i < loginServerPorts.size(); ++i) { const ConfigValue val = loginServerPorts.at(i); stream << val.fileName << " "; } stream << " client will use the value: " << parser->getStringConfigValue("ClientGame", "loginServerPort0"); QMessageBox::warning(this, "Warning", warningString); } LoginServer* server = loginServers->getServer(ui->comboBox_login->currentText()); QString loginAddress = parser->getStringConfigValue("ClientGame", "loginServerAddress0", "loginServerAddress0"); QString port = parser->getStringConfigValue("ClientGame", "loginServerAddress0", "loginServerPort0"); if (loginAddress != server->getHost() || port != QString::number(server->getPort())) { #ifdef Q_OS_WIN32 QFile loginFile(folder + "\\swgemu_login.cfg"); #else QFile loginFile(folder + "/swgemu_login.cfg"); #endif if (loginFile.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&loginFile); stream << "[ClientGame]" << endl; stream << "loginServerAddress0=" << server->getHost() << endl; stream << "loginServerPort0=" << server->getPort(); loginFile.close(); } else { QMessageBox::warning(this, "Error", "Could not write swgemu_login.cfg!"); } } /* arguments.append("--"); arguments.append("-s"); arguments.append("ClientGame"); arguments.append("cameraFarPlane=4096"); */ /* arguments.append("--"); arguments.append("-s"); arguments.append("SharedFoundation"); arguments.append("minFrameRate=60"); */ // QFile executable() /* arguments.append("--"); arguments.append("-s"); arguments.append("ClientTerrain"); arguments.append("dynamicNearFloraDistance=128"); arguments.append("--"); arguments.append("-s"); arguments.append("ClientTerrain"); arguments.append("staticNonCollidableFloraDistance=2048"); arguments.append("--"); arguments.append("-s"); arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail"); arguments.append("forceHighThreshold=40"); arguments.append("--"); arguments.append("-s"); arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail"); arguments.append("threshold=40"); arguments.append("--"); arguments.append("-s"); arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail"); arguments.append("heightBiasMax=4096"); */ //ClientProceduralTerrainAppearance_LevelOfDetail.heightBiasMax //ClientGame.cameraFarPlane /*ClientProceduralTerrainAppearance_LevelOfDetail.threshold*/ /*ClientProceduralTerrainAppearance_LevelOfDetail.forceHighThreshold*/ arguments.append("--"); arguments.append("-s"); arguments.append("ClientGame"); if (server != NULL) arguments.append("loginServerAddress0=" + server->getHost()); else arguments.append("loginServerAddress0=" + LoginServers::defaultLoginAddress); if (server == NULL) arguments.append("loginServerPort0=" + QString::number(LoginServers::defaultLoginPort)); else arguments.append("loginServerPort0=" + QString::number(server->getPort())); arguments.append("-s"); arguments.append("Station"); arguments.append("gameFeatures=34929"); if (multiple) { if (parser->hasConfigValue("SwgClient", "allowMultipleInstances")) { bool val = parser->getBooleanConfigValue("SwgClient", "allowMultipleInstances"); if (!val) { QMessageBox::warning(this, "Warning", "You selected the multiple instances option but you have set it to false in the swg config files!"); } } arguments.append("-s"); arguments.append("SwgClient"); arguments.append("allowMultipleInstances=true"); } qDebug() << "start swg with arguments " << arguments; connect(process, SIGNAL(processFinished(GameProcess*,int)), this, SLOT(gameProcessFinished(GameProcess*,int))); ui->tabWidget->addTab(process, "Process " + QString::number(++gameProcessesCount)); gameProcesses.append(process); QTabBar* bar = ui->tabWidget->tabBar(); int tabIndex = ui->tabWidget->indexOf(process); bar->setTabTextColor(tabIndex, Qt::green); bar->setTabIcon(tabIndex, QIcon(":/img/tab.svg")); //process->show(); bool startResult = process->start(folder, gameExecutable, arguments); if (startResult) { //showMinimized(); if (settings.value("minimize_after_start", false).toBool()) { systemTrayIcon->show(); QTimer::singleShot(0, this, SLOT(hide())); } } }