Ejemplo n.º 1
0
void ConfigDialog::on_resetBgButton_clicked()
{
	ui->bgPathLineEdit->clear();

	QString filename = "backdrop/thousandsunny.jpg";
	Config.BackgroundImage = filename;
	Config.setValue("BackgroundImage", filename);

	emit bg_changed();
}
Ejemplo n.º 2
0
void ConfigDialog::on_resetBgButton_clicked()
{
    ui->bgPathLineEdit->clear();

    QString filename = "backdrop/index.jpg";
    Config.BackgroundBrush = filename;
    Config.setValue("BackgroundBrush", filename);

    emit bg_changed();
}
Ejemplo n.º 3
0
void ConfigDialog::on_resetBgButton_clicked()
{
    ui->bgPathLineEdit->clear();

    QString filename = "image/system/backdrop/default.jpg";
    Config.BackgroundImage = filename;
    Config.setValue("BackgroundImage", filename);

    emit bg_changed();
}
Ejemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow), server(NULL)
{
    ui->setupUi(this);

    setWindowTitle(tr("Sanguosha") + " " + Sanguosha->getVersionNumber());

    scene = NULL;

    connection_dialog = new ConnectionDialog(this);
    connect(ui->actionStart_Game, SIGNAL(triggered()), connection_dialog, SLOT(exec()));
    connect(connection_dialog, SIGNAL(accepted()), this, SLOT(startConnection()));

    config_dialog = new ConfigDialog(this);
    connect(ui->actionConfigure, SIGNAL(triggered()), config_dialog, SLOT(show()));
    connect(config_dialog, SIGNAL(bg_changed()), this, SLOT(changeBackground()));

    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->actionAcknowledgement_2, SIGNAL(triggered()), this, SLOT(on_actionAcknowledgement_triggered()));

    StartScene *start_scene = new StartScene;

    QList<QAction *> actions;
    actions << ui->actionStart_Game
        << ui->actionStart_Server
        << ui->actionReplay
        << ui->actionConfigure
        << ui->actionGeneral_Overview
        << ui->actionCard_Overview
        << ui->actionScenario_Overview
        << ui->actionAbout;

    foreach(QAction *action, actions)
        start_scene->addButton(action);
    view = new FitView(scene);

    setCentralWidget(view);
    restoreFromConfig();

    BackLoader::preload();
    gotoScene(start_scene);

    addAction(ui->actionShow_Hide_Menu);
    addAction(ui->actionFullscreen);

    connect(ui->actionRestart_Game, SIGNAL(triggered()), this, SLOT(startConnection()));
    connect(ui->actionReturn_to_Main_Menu, SIGNAL(triggered()), this, SLOT(gotoStartScene()));

    systray = NULL;
}
Ejemplo n.º 5
0
MainWindow::MainWindow(QWidget *parent)
    :QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    scene = NULL;

    // initialize random seed for later use
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));

    connection_dialog = new ConnectionDialog(this);
    connect(ui->actionStart_Game, SIGNAL(triggered()), connection_dialog, SLOT(exec()));
    connect(connection_dialog, SIGNAL(accepted()), this, SLOT(startConnection()));

    config_dialog = new ConfigDialog(this);
    connect(ui->actionConfigure, SIGNAL(triggered()), config_dialog, SLOT(show()));
    connect(config_dialog, SIGNAL(bg_changed()), this, SLOT(changeBackground()));

    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    StartScene *start_scene = new StartScene;

    QList<QAction*> actions;
    actions << ui->actionStart_Game
            << ui->actionStart_Server
            << ui->actionPC_Console_Start
            << ui->actionReplay
            << ui->actionConfigure
            << ui->actionGeneral_Overview
            << ui->actionCard_Overview
            << ui->actionScenario_Overview
            << ui->actionAbout
            << ui->actionAcknowledgement;

    foreach(QAction *action, actions)
        start_scene->addButton(action);

    view = new FitView(scene);

    setCentralWidget(view);
    restoreFromConfig();

    gotoScene(start_scene);

    addAction(ui->actionShow_Hide_Menu);
    addAction(ui->actionFullscreen);
    addAction(ui->actionMinimize_to_system_tray);

    systray = NULL;
}
Ejemplo n.º 6
0
void ConfigDialog::on_browseBgButton_clicked() {
    QString filename = QFileDialog::getOpenFileName(this,
                                                    tr("Select a background image"),
                                                    "backdrop/",
                                                    tr("Images (*.png *.bmp *.jpg)"));

    if (!filename.isEmpty()) {
        ui->bgPathLineEdit->setText(filename);

        Config.BackgroundImage = filename;
        Config.setValue("BackgroundImage", filename);

        emit bg_changed();
    }
}
Ejemplo n.º 7
0
void ConfigDialog::on_browseBgButton_clicked()
{
    QString location = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
    QString filename = QFileDialog::getOpenFileName(this,
                                                    tr("Select a background image"),
                                                    location,
                                                    tr("Images (*.png *.bmp *.jpg)"));

    if(!filename.isEmpty()){
        ui->bgPathLineEdit->setText(filename);
        Config.changeBackground(filename);

        emit bg_changed();
    }
}
Ejemplo n.º 8
0
void ConfigDialog::on_browseBgButton_clicked()
{
	QString location = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
	QString filename = QFileDialog::getOpenFileName(this,
													tr("Select a background image"),
													location,
													tr("Images (*.png *.bmp *.jpg)"));

	if(!filename.isEmpty()){
		ui->bgPathLineEdit->setText(filename);

		Config.BackgroundImage = filename;
		Config.setValue("BackgroundImage", filename);

		emit bg_changed();
	}
}
Ejemplo n.º 9
0
void ConfigDialog::on_browseBgButton_clicked() {
    QString filename = QFileDialog::getOpenFileName(this,
                                                    tr("Select a background image"),
                                                    "image/backdrop/",
                                                    tr("Images (*.png *.bmp *.jpg)"));

    if (!filename.isEmpty()) {
        QString app_path = QApplication::applicationDirPath();
        if (filename.startsWith(app_path))
            filename = filename.right(filename.length() - app_path.length() - 1);
        ui->bgPathLineEdit->setText(filename);

        Config.BackgroundImage = filename;
        Config.setValue("BackgroundImage", filename);

        emit bg_changed();
    }
}
Ejemplo n.º 10
0
void ConfigDialog::on_browseBgButton_clicked()
{
#if QT_VERSION >= 0x050000
    QString location;
#else
    QString location = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
#endif

    QString filename = QFileDialog::getOpenFileName(this,
                                                    tr("Select a background image"),
                                                    location,
                                                    tr("Images (*.png *.bmp *.jpg)"));

    if(!filename.isEmpty()){
        ui->bgPathLineEdit->setText(filename);

        Config.BackgroundBrush = filename;
        Config.setValue("BackgroundBrush", filename);

        emit bg_changed();
    }
}
Ejemplo n.º 11
0
void ConfigDialog::on_resetBgButton_clicked()
{
    ui->bgPathLineEdit->clear();
    Config.changeBackground(":/background.png");
    emit bg_changed();
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), isLeftPressDown(false),
      scene(NULL), ui(new Ui::MainWindow), server(NULL), about_window(NULL),
      minButton(NULL), maxButton(NULL), normalButton(NULL), closeButton(NULL),
      versionInfomationReply(NULL), changeLogReply(NULL)
{
    ui->setupUi(this);
    setWindowTitle(tr("QSanguosha-Hegemony") + " " + Sanguosha->getVersion());
#ifdef Q_OS_WIN
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
#endif
    setAttribute(Qt::WA_TranslucentBackground);

    setMouseTracking(true);
    setMinimumWidth(800);
    setMinimumHeight(580);

    fetchUpdateInformation();

    connection_dialog = new ConnectionDialog(this);
    connect(ui->actionStart_Game, SIGNAL(triggered()), connection_dialog, SLOT(exec()));
    connect(connection_dialog, SIGNAL(accepted()), this, SLOT(startConnection()));

    config_dialog = new ConfigDialog(this);
    connect(ui->actionConfigure, SIGNAL(triggered()), config_dialog, SLOT(show()));
    connect(config_dialog, SIGNAL(bg_changed()), this, SLOT(changeBackground()));
    connect(config_dialog, SIGNAL(tableBg_changed()), this, SLOT(changeBackground()));

    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->actionAcknowledgement_2, SIGNAL(triggered()), this, SLOT(on_actionAcknowledgement_triggered()));

    StartScene *start_scene = new StartScene(this);

    QList<QAction *> actions;
    actions << ui->actionStart_Game
        << ui->actionStart_Server
        << ui->actionPC_Console_Start
        << ui->actionReplay
        << ui->actionConfigure
        << ui->actionGeneral_Overview
        << ui->actionCard_Overview
        << ui->actionAbout;

    foreach(QAction *action, actions)
        start_scene->addButton(action);

#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
    ui->menuSumMenu->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuGame->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuView->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuOptions->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuDIY->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuCheat->setAttribute(Qt::WA_TranslucentBackground);
    ui->menuHelp->setAttribute(Qt::WA_TranslucentBackground);
#endif

    view = new FitView(scene);

    setCentralWidget(view);
    restoreFromConfig();

    roundCorners();

    BackLoader::preload();
    gotoScene(start_scene);

    addAction(ui->actionFullscreen);

#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
    menu = new QPushButton(this);
    menu->setMenu(ui->menuSumMenu);
    menu->setProperty("control", true);
    StyleHelper::getInstance()->setIcon(menu, QChar(0xf0c9), 15);
    menu->setToolTip(tr("<font color=%1>Config</font>").arg(Config.SkillDescriptionInToolTipColor.name()));
#endif

#if defined(Q_OS_WIN)
    minButton = new QPushButton(this);
    minButton->setProperty("control", true);

    maxButton = new QPushButton(this);
    maxButton->setProperty("bold", true);
    maxButton->setProperty("control", true);

    normalButton = new QPushButton(this);
    normalButton->setProperty("bold", true);
    normalButton->setProperty("control", true);

    closeButton= new QPushButton(this);
    closeButton->setObjectName("closeButton");
    closeButton->setProperty("control", true);

    StyleHelper::getInstance()->setIcon(minButton, QChar(0xf068), 15);
    StyleHelper::getInstance()->setIcon(maxButton, QChar(0xf106), 15);
    StyleHelper::getInstance()->setIcon(normalButton, QChar(0xf107), 15);
    StyleHelper::getInstance()->setIcon(closeButton, QChar(0xf00d), 15);

    minButton->setToolTip(tr("<font color=%1>Minimize</font>").arg(Config.SkillDescriptionInToolTipColor.name()));
    connect(minButton, SIGNAL(clicked()), this, SLOT(showMinimized()));
    maxButton->setToolTip(tr("<font color=%1>Maximize</font>").arg(Config.SkillDescriptionInToolTipColor.name()));
    connect(maxButton, SIGNAL(clicked()), this, SLOT(showMaximized()));
    normalButton->setToolTip(tr("<font color=%1>Restore downward</font>").arg(Config.SkillDescriptionInToolTipColor.name()));
    connect(normalButton, SIGNAL(clicked()), this, SLOT(showNormal()));
    closeButton->setToolTip(tr("<font color=%1>Close</font>").arg(Config.SkillDescriptionInToolTipColor.name()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    menuBar()->hide();
#elif defined(Q_OS_ANDROID)
    ui->menuSumMenu->removeAction(ui->menuView->menuAction());
#endif
    repaintButtons();

#ifndef Q_OS_ANDROID
    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
    animation->setDuration(1000);
    animation->setStartValue(0);
    animation->setEndValue(1);
    animation->setEasingCurve(QEasingCurve::OutCurve);
    animation->start(QAbstractAnimation::DeleteWhenStopped);
#endif

    start_scene->showOrganization();

    systray = NULL;
}