Esempio n. 1
0
AppearanceSettingsPage::AppearanceSettingsPage()
{
    QString themeName = settingsCache->getThemeName();

    QStringList themeDirs = themeManager->getAvailableThemes().keys();
    for (int i = 0; i < themeDirs.size(); i++) {
        themeBox.addItem(themeDirs[i]);
        if (themeDirs[i] == themeName)
            themeBox.setCurrentIndex(i);
    }

    connect(&themeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeBoxChanged(int)));
    
    QGridLayout *themeGrid = new QGridLayout;
    themeGrid->addWidget(&themeLabel, 0, 0);
    themeGrid->addWidget(&themeBox, 0, 1);

    themeGroupBox = new QGroupBox;
    themeGroupBox->setLayout(themeGrid);

    displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
    connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));

    cardScalingCheckBox.setChecked(settingsCache->getScaleCards());
    connect(&cardScalingCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setCardScaling(int)));
    
    QGridLayout *cardsGrid = new QGridLayout;
    cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
    cardsGrid->addWidget(&cardScalingCheckBox, 1, 0, 1, 2);
    
    cardsGroupBox = new QGroupBox;
    cardsGroupBox->setLayout(cardsGrid);
    
    horizontalHandCheckBox.setChecked(settingsCache->getHorizontalHand());
    connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));

    leftJustifiedHandCheckBox.setChecked(settingsCache->getLeftJustified());
    connect(&leftJustifiedHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setLeftJustified(int)));
    
    QGridLayout *handGrid = new QGridLayout;
    handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
    handGrid->addWidget(&leftJustifiedHandCheckBox, 1, 0, 1, 2);
    
    handGroupBox = new QGroupBox;
    handGroupBox->setLayout(handGrid);
    
    invertVerticalCoordinateCheckBox.setChecked(settingsCache->getInvertVerticalCoordinate());
    connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));
    
    minPlayersForMultiColumnLayoutEdit.setMinimum(2);
    minPlayersForMultiColumnLayoutEdit.setValue(settingsCache->getMinPlayersForMultiColumnLayout());
    connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
    minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
    
    QGridLayout *tableGrid = new QGridLayout;
    tableGrid->addWidget(&invertVerticalCoordinateCheckBox, 0, 0, 1, 2);
    tableGrid->addWidget(&minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1);
    tableGrid->addWidget(&minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1);
    
    tableGroupBox = new QGroupBox;
    tableGroupBox->setLayout(tableGrid);
    
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(themeGroupBox);
    mainLayout->addWidget(cardsGroupBox);
    mainLayout->addWidget(handGroupBox);
    mainLayout->addWidget(tableGroupBox);
    
    setLayout(mainLayout);
}
Esempio n. 2
0
AppearanceSettingsPage::AppearanceSettingsPage()
{
    QIcon deleteIcon(":/resources/icon_delete.svg");

    handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
    handBgEdit->setReadOnly(true);
    QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString());
    connect(handBgClearButton, SIGNAL(clicked()), this, SLOT(handBgClearButtonClicked()));
    QPushButton *handBgButton = new QPushButton("...");
    connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));

    stackBgEdit = new QLineEdit(settingsCache->getStackBgPath());
    stackBgEdit->setReadOnly(true);
    QPushButton *stackBgClearButton = new QPushButton(deleteIcon, QString());
    connect(stackBgClearButton, SIGNAL(clicked()), this, SLOT(stackBgClearButtonClicked()));
    QPushButton *stackBgButton = new QPushButton("...");
    connect(stackBgButton, SIGNAL(clicked()), this, SLOT(stackBgButtonClicked()));

    tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
    tableBgEdit->setReadOnly(true);
    QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString());
    connect(tableBgClearButton, SIGNAL(clicked()), this, SLOT(tableBgClearButtonClicked()));
    QPushButton *tableBgButton = new QPushButton("...");
    connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));

    playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
    playerAreaBgEdit->setReadOnly(true);
    QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString());
    connect(playerAreaBgClearButton, SIGNAL(clicked()), this, SLOT(playerAreaBgClearButtonClicked()));
    QPushButton *playerAreaBgButton = new QPushButton("...");
    connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));

    cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath());
    cardBackPicturePathEdit->setReadOnly(true);
    QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString());
    connect(cardBackPicturePathClearButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathClearButtonClicked()));
    QPushButton *cardBackPicturePathButton = new QPushButton("...");
    connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked()));

    QGridLayout *zoneBgGrid = new QGridLayout;
    zoneBgGrid->addWidget(&handBgLabel, 0, 0);
    zoneBgGrid->addWidget(handBgEdit, 0, 1);
    zoneBgGrid->addWidget(handBgClearButton, 0, 2);
    zoneBgGrid->addWidget(handBgButton, 0, 3);
    zoneBgGrid->addWidget(&stackBgLabel, 1, 0);
    zoneBgGrid->addWidget(stackBgEdit, 1, 1);
    zoneBgGrid->addWidget(stackBgClearButton, 1, 2);
    zoneBgGrid->addWidget(stackBgButton, 1, 3);
    zoneBgGrid->addWidget(&tableBgLabel, 2, 0);
    zoneBgGrid->addWidget(tableBgEdit, 2, 1);
    zoneBgGrid->addWidget(tableBgClearButton, 2, 2);
    zoneBgGrid->addWidget(tableBgButton, 2, 3);
    zoneBgGrid->addWidget(&playerAreaBgLabel, 3, 0);
    zoneBgGrid->addWidget(playerAreaBgEdit, 3, 1);
    zoneBgGrid->addWidget(playerAreaBgClearButton, 3, 2);
    zoneBgGrid->addWidget(playerAreaBgButton, 3, 3);
    zoneBgGrid->addWidget(&cardBackPicturePathLabel, 4, 0);
    zoneBgGrid->addWidget(cardBackPicturePathEdit, 4, 1);
    zoneBgGrid->addWidget(cardBackPicturePathClearButton, 4, 2);
    zoneBgGrid->addWidget(cardBackPicturePathButton, 4, 3);

    zoneBgGroupBox = new QGroupBox;
    zoneBgGroupBox->setLayout(zoneBgGrid);

    displayCardNamesCheckBox.setChecked(settingsCache->getDisplayCardNames());
    connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDisplayCardNames(int)));

    cardScalingCheckBox.setChecked(settingsCache->getScaleCards());
    connect(&cardScalingCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setCardScaling(int)));

    QGridLayout *cardsGrid = new QGridLayout;
    cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
    cardsGrid->addWidget(&cardScalingCheckBox, 1, 0, 1, 2);

    cardsGroupBox = new QGroupBox;
    cardsGroupBox->setLayout(cardsGrid);

    horizontalHandCheckBox.setChecked(settingsCache->getHorizontalHand());
    connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setHorizontalHand(int)));

    leftJustifiedHandCheckBox.setChecked(settingsCache->getLeftJustified());
    connect(&leftJustifiedHandCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setLeftJustified(int)));

    QGridLayout *handGrid = new QGridLayout;
    handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2);
    handGrid->addWidget(&leftJustifiedHandCheckBox, 1, 0, 1, 2);

    handGroupBox = new QGroupBox;
    handGroupBox->setLayout(handGrid);

    invertVerticalCoordinateCheckBox.setChecked(settingsCache->getInvertVerticalCoordinate());
    connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setInvertVerticalCoordinate(int)));

    minPlayersForMultiColumnLayoutEdit.setMinimum(2);
    minPlayersForMultiColumnLayoutEdit.setValue(settingsCache->getMinPlayersForMultiColumnLayout());
    connect(&minPlayersForMultiColumnLayoutEdit, SIGNAL(valueChanged(int)), settingsCache, SLOT(setMinPlayersForMultiColumnLayout(int)));
    minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);

    QGridLayout *tableGrid = new QGridLayout;
    tableGrid->addWidget(&invertVerticalCoordinateCheckBox, 0, 0, 1, 2);
    tableGrid->addWidget(&minPlayersForMultiColumnLayoutLabel, 1, 0, 1, 1);
    tableGrid->addWidget(&minPlayersForMultiColumnLayoutEdit, 1, 1, 1, 1);

    tableGroupBox = new QGroupBox;
    tableGroupBox->setLayout(tableGrid);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(zoneBgGroupBox);
    mainLayout->addWidget(cardsGroupBox);
    mainLayout->addWidget(handGroupBox);
    mainLayout->addWidget(tableGroupBox);

    setLayout(mainLayout);
}