Home::Home(QWidget *parent) : QWidget(parent), ui(new Ui::Home), b_optionDialogOpened(false), m_optionsDialog(NULL), b_serverWidgetOpened(false), m_serverWidget(NULL) { ui->setupUi(this); QString url("http://www.runicorbs.net/ingame.php?syslang=" + QLocale::system().name() + "&version=" + QString::fromUtf8(QUrl::toPercentEncoding(TRO_VERSION))); ui->newsWebView->setUrl(url); QString imageName(qApp->applicationDirPath() + "/gfx/logo.png"); if(QFile(imageName).exists()) { ui->titleLabel->setPixmap(QPixmap(imageName)); } else { ui->titleLabel->setText("The Runic Orbs"); } connect(ui->soloButton, SIGNAL(clicked()), this, SLOT(soloGameLaunch())); connect(ui->multiButton, SIGNAL(clicked()), this, SLOT(openConnectDialog())); connect(ui->serverButton, SIGNAL(clicked()), this, SLOT(openServerWidget())); connect(ui->optionsButton, SIGNAL(clicked()), this, SLOT(openOptions())); connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(close())); ui->versionLabel->setText(tr("version %1").arg(TRO_VERSION)); // Center the window on the screen QDesktopWidget* desktop = QApplication::desktop(); move( (desktop->width() - width()) / 2 , (desktop->height() - height()) / 2 - 50 ); }
CraftuxHome::CraftuxHome(QWidget *parent) : QWidget(parent), ui(new Ui::CraftuxHome), b_optionDialogOpened(false), m_optionsDialog(NULL) { ui->setupUi(this); connect(ui->soloButton, SIGNAL(clicked()), this, SLOT(soloGameLaunch())); connect(ui->multiButton, SIGNAL(clicked()), this, SLOT(openConnectDialog())); connect(ui->serverButton, SIGNAL(clicked()), this, SLOT(openServerInterface())); connect(ui->optionsButton, SIGNAL(clicked()), this, SLOT(openOptions())); connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(close())); ui->versionLabel->setText(tr("version %1").arg(CRAFTUX_VERSION)); // Center the window on the screen QDesktopWidget* desktop = QApplication::desktop(); move( (desktop->width() - width()) / 2 , (desktop->height() - height()) / 2 - 50 ); }
MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags ) : QMainWindow( parent, flags ), ui(new Ui::MainWindow) { qDebug( "Home Path : %s" ,QDir::homePath().toLatin1().constData()); qDebug( "Current Path : %s" ,QDir::currentPath ().toLatin1().constData()); ui->setupUi(this); this->setAttribute( Qt::WA_DeleteOnClose ); //hide by default setWindowTitle(QString(PACKAGE) + " " + QString(VERSION)); // loads the settings loadSettings(); // connecting the Go server tab buttons and signals // connecting the new game button connect( ui->actionOpen, SIGNAL(triggered()), SLOT(slot_fileOpen()) ); connect(ui->actionNew,SIGNAL(triggered()),SLOT(slot_fileNew())); connect(ui->cancelButtonPrefs,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui->cancelButtonServer,SIGNAL(pressed()),SLOT(slot_cancelPressed())); connect(ui->stackedWidget, SIGNAL(currentChanged ( int )), SLOT(slot_currentChanged(int ))); //coneects the preference buttons connect( ui->gobanPathButton, SIGNAL( clicked() ), this, SLOT( slot_getGobanPath() ) ); connect( ui->tablePathButton, SIGNAL( clicked() ), this, SLOT( slot_getTablePath() ) ); connect(ui->comboBox_language, SIGNAL(currentIndexChanged ( int )), SLOT(slot_languageChanged(int ))); //sound connectSound = new Sound("static.wav"); logindialog = new LoginDialog(this); connect( ui->actionConnect, SIGNAL(triggered()), SLOT(openConnectDialog()) ); engineTableModel = new EngineTableModel(this); ui->engineTableView->setModel(engineTableModel); ui->engineTableView->setColumnWidth ( EngineTableModel::ENGINE_DEFAULT, 60 ); ui->engineTableView->setColumnWidth ( EngineTableModel::ENGINE_PATH, 300 ); connect(ui->engineAddButton, &QPushButton::pressed, this, &MainWindow::addEngine); connect(ui->engineRemoveButton, &QPushButton::pressed, this, &MainWindow::removeEngine); }