AmazonProviderWidget::AmazonProviderWidget(CloudDialog * cloudDialog) : CloudProviderWidget(cloudDialog), m_accessKeyLineEdit(nullptr), m_secretKeyLineEdit(nullptr), m_regionComboBox(nullptr), m_serverInstanceTypeComboBox(nullptr), m_workerInstanceTypeComboBox(nullptr), m_numberOfWorkerInstancesLineEdit(nullptr) { createLoginWidget(); createSettingsWidget(); }
VagrantProviderWidget::VagrantProviderWidget(CloudDialog * cloudDialog) : CloudProviderWidget(cloudDialog), m_runOnStartUpCheckBox(nullptr), m_serverUsernameLineEdit(nullptr), m_serverPasswordLineEdit(nullptr), m_serverDirLineEdit(nullptr), m_serverAddressIpLineEdit(nullptr), m_serverPortIpLineEdit(nullptr), m_workerDirLineEdit(nullptr), m_workerAddressIpLineEdit(nullptr), m_workerPortIpLineEdit(nullptr) { createLoginWidget(); createSettingsWidget(); }
PAAlternativeLauncher::PAAlternativeLauncher() : mNetworkAccessManager(new QNetworkAccessManager(this)) #if defined(linux) , mPlatform("Linux") , mDefaultInstallPath(QDir::homePath() + "/Games/PA") #elif defined(_WIN32) , mPlatform("Windows") , mDefaultInstallPath("C:\\Games\\Uber Entertainment\\Planetary Annihilation Launcher\\Planetary Annihilation") , mWinTaskbarProgress(NULL) #elif defined(__APPLE__) , mPlatform("OSX") , mDefaultInstallPath("/Applications/Planetary Annihilation") #else # error Not a supported os #endif , mBufferSize(1024*1024), mBuffer(NULL), mPatcher(NULL) { setWindowIcon(QIcon(":/img/icon.png")); setWindowTitle("PA Alternative Launcher"); info.setParent(this); info.log("Starting launcher", QDateTime::currentDateTime().toString()); convertOldSettings(); if(mNetworkAccessManager == NULL) info.critical("Init", "Network Access Manager failed to initialize."); QPalette palette; QPixmap backgroundPixmap(":/img/img_bground_galaxy_01.png"); QBrush backgroundBrush(backgroundPixmap); palette.setBrush(QPalette::Background, backgroundBrush); setPalette(palette); QWidget *main_widget = new QWidget(this); QVBoxLayout *main_layout = new QVBoxLayout(main_widget); QLabel *disclaimer_label = new QLabel(tr("This is an UNOFFICIAL launcher and not connected to Planetary Annihilation Inc. in any way."), main_widget); disclaimer_label->setStyleSheet("QLabel {color: red; font-weight: bold;}"); disclaimer_label->setAlignment(Qt::AlignCenter); disclaimer_label->setAutoFillBackground(true); disclaimer_label->setBackgroundRole(QPalette::Dark); main_layout->addWidget(disclaimer_label); QLabel *header_label = new QLabel(main_widget); header_label->setPixmap(QPixmap(":/img/img_pa_logo_start_rest.png")); header_label->setAlignment(Qt::AlignCenter); main_layout->addWidget(header_label); QWidget *centre_widget = new QWidget(main_widget); QHBoxLayout *centre_layout = new QHBoxLayout(centre_widget); QWidget *commander_widget = new QWidget(centre_widget); QVBoxLayout *commander_layout = new QVBoxLayout(commander_widget); QLabel *commander_label = new QLabel(commander_widget); commander_label->setPixmap(QPixmap(":img/img_imperial_invictus.png")); commander_layout->addWidget(commander_label); centre_layout->addWidget(commander_widget); QWidget *middle_horizontal_widget = new QWidget(centre_widget); QVBoxLayout *middle_horizontal_layout = new QVBoxLayout(middle_horizontal_widget); QWidget *stream_widget = new QWidget(middle_horizontal_widget); QHBoxLayout *stream_layout = new QHBoxLayout(stream_widget); QLabel *streams_label = new QLabel(tr("Stream"), stream_widget); QPalette palettewhite = main_widget->palette(); palettewhite.setColor(QPalette::WindowText, Qt::white); streams_label->setPalette(palettewhite); stream_layout->addWidget(streams_label); mStreamsComboBox = new QComboBox(stream_widget); stream_layout->addWidget(mStreamsComboBox); mUpdateAvailableLabel = new QLabel("", stream_widget); mUpdateAvailableLabel->setStyleSheet("QLabel {font-weight: bold; color: white}"); mUpdateAvailableLabel->setPalette(palettewhite); stream_layout->addWidget(mUpdateAvailableLabel); stream_layout->addStretch(); middle_horizontal_layout->addWidget(stream_widget); mLoginWidget = createLoginWidget(middle_horizontal_widget); mDownloadWidget = createDownloadWidget(middle_horizontal_widget); mDownloadWidget->setVisible(false); mWaitWidget = createWaitWidget(middle_horizontal_widget); mWaitWidget->setVisible(false); middle_horizontal_layout->addWidget(mLoginWidget); middle_horizontal_layout->addWidget(mDownloadWidget); middle_horizontal_layout->addWidget(mWaitWidget); QWidget *install_path_widget = new QWidget(middle_horizontal_widget); QHBoxLayout *install_path_layout = new QHBoxLayout(install_path_widget); mInstallPathLineEdit = new QLineEdit(install_path_widget); mInstallPathLineEdit->setPlaceholderText(tr("Enter the PA install directory here.")); install_path_layout->addWidget(mInstallPathLineEdit); QPushButton *install_path_push_button = new QPushButton(style()->standardIcon(QStyle::SP_DirOpenIcon), "", install_path_widget); install_path_push_button->setFlat(true); connect(install_path_push_button, SIGNAL(clicked(bool)), SLOT(installPathButtonClicked(bool))); install_path_layout->addWidget(install_path_push_button); middle_horizontal_layout->addWidget(install_path_widget); centre_layout->addWidget(middle_horizontal_widget); /* mModDatabaseFrame = new ModDatabaseFrame(centre_widget); centre_layout->addWidget(mModDatabaseFrame); */ main_layout->addWidget(centre_widget); QDialogButtonBox *button_box = new QDialogButtonBox(main_widget); mLaunchButton = new QPushButton(tr("&Launch PA"), button_box); mLaunchButton->setEnabled(false); connect(mLaunchButton, SIGNAL(clicked(bool)), SLOT(launchPushButtonClicked(bool))); button_box->addButton(mLaunchButton, QDialogButtonBox::AcceptRole); QPushButton *launch_offline_button = new QPushButton(tr("Launch &offline"), button_box); connect(launch_offline_button, SIGNAL(clicked(bool)), SLOT(launchOfflinePushButtonClicked(bool))); button_box->addButton(launch_offline_button, QDialogButtonBox::AcceptRole); QPushButton *advanced_button = new QPushButton(tr("&Advanced"), button_box); connect(advanced_button, SIGNAL(clicked(bool)), SLOT(advancedPushButtonClicked(bool))); button_box->addButton(advanced_button, QDialogButtonBox::NoRole); mDownloadButton = new QPushButton(tr("&Download and install"), button_box); mDownloadButton->setEnabled(false); connect(mDownloadButton, SIGNAL(clicked(bool)), SLOT(downloadPushButtonClicked(bool))); button_box->addButton(mDownloadButton, QDialogButtonBox::NoRole); main_layout->addWidget(button_box); mPatchLabel = new QLabel(main_widget); mPatchLabel->setStyleSheet("QLabel {color: white; font-weight: bold}"); mPatchLabel->setAlignment(Qt::AlignCenter); main_layout->addWidget(mPatchLabel); mPatchProgressbar = new QProgressBar(main_widget); mPatchProgressbar->setMinimum(0); mPatchProgressbar->setMaximum(100); main_layout->addWidget(mPatchProgressbar); QLabel *disclaimer_label2 = new QLabel(tr("This is an UNOFFICIAL launcher and not connected to Planetary Annihilation Inc. in any way."), main_widget); disclaimer_label2->setStyleSheet("QLabel {color: red; font-weight: bold;}"); disclaimer_label2->setAlignment(Qt::AlignCenter); disclaimer_label2->setAutoFillBackground(true); disclaimer_label2->setBackgroundRole(QPalette::Dark); main_layout->addWidget(disclaimer_label2); QWidget *about_widget = new QWidget(main_widget); QHBoxLayout *about_layout = new QHBoxLayout(about_widget); QLabel *created_by_label = new QLabel(tr("Created by") + " DeathByDenim " + tr("using Qt5"), about_widget); created_by_label->setStyleSheet("QLabel {color: white}"); about_layout->addWidget(created_by_label); QLabel *blackmage_label = new QLabel(about_widget); blackmage_label->setPixmap(QPixmap(":img/blackmage.png")); blackmage_label->setMaximumSize(16, 16); about_layout->addWidget(blackmage_label); about_layout->addStretch(); QLabel *version_label = new QLabel(tr("Version") + " " VERSION, about_widget); version_label->setStyleSheet("QLabel {color: white}"); about_layout->addWidget(version_label); main_layout->addWidget(about_widget); setCentralWidget(main_widget); QSettings settings; restoreGeometry(settings.value("mainwindow/geometry").toByteArray()); settings.beginGroup("streams"); QStringList streamgroups = settings.childGroups(); for(QStringList::const_iterator stream = streamgroups.constBegin(); stream != streamgroups.constEnd(); ++stream) mStreamsComboBox->addItem(*stream); settings.endGroup(); connect(mStreamsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(streamsComboBoxCurrentIndexChanged(int))); if(streamgroups.contains(settings.value("streams/defaultstream").toString())) mStreamsComboBox->setCurrentText(settings.value("streams/defaultstream").toString()); else mStreamsComboBox->setCurrentText("stable"); mSessionTicket = settings.value("login/sessionticket").toString(); if(!mSessionTicket.isEmpty()) { setState(wait_state); QNetworkRequest request(QUrl("https://uberent.com/Launcher/ListStreams?Platform=" + mPlatform)); request.setRawHeader("X-Authorization", mSessionTicket.toUtf8()); request.setRawHeader("X-Clacks-Overhead", "GNU Terry Pratchett"); request.setRawHeader("User-Agent", QString("PAAlternativeLauncher/%1").arg(VERSION).toUtf8()); QNetworkReply *reply = mNetworkAccessManager->get(request); connect(reply, SIGNAL(finished()), SLOT(streamsFinished())); } if(mUserNameLineEdit->text().isEmpty()) mUserNameLineEdit->setFocus(); else mPasswordLineEdit->setFocus(); }