Compare commits
14 commits
46278f1d13
...
803fa21753
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
803fa21753 | ||
|
|
f7d7d6bbdd | ||
|
|
85d96730e6 | ||
|
|
425e14c2dd | ||
|
|
305df2d724 | ||
|
|
d8e488c713 | ||
|
|
7501932e25 | ||
|
|
e288eab0fb | ||
|
|
acb45af225 | ||
|
|
21db8c34c9 | ||
|
|
a127ff7e1b | ||
|
|
7549f9c2cf | ||
|
|
03684bf41d | ||
|
|
5d025ca0bd |
|
|
@ -94,7 +94,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
QDir dir;
|
||||
availableThemes.clear();
|
||||
|
||||
// load themes from user profile dir
|
||||
// Load themes from user profile dir
|
||||
|
||||
dir.setPath(SettingsCache::instance().getDataPath() + "/sounds");
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ QStringMap &SoundEngine::getAvailableThemes()
|
|||
}
|
||||
}
|
||||
|
||||
// load themes from cockatrice system dir
|
||||
// Load themes from Cockatrice system dir
|
||||
dir.setPath(qApp->applicationDirPath() +
|
||||
#ifdef Q_OS_MAC
|
||||
"/../Resources/sounds"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ enum Format
|
|||
PlainText,
|
||||
|
||||
/**
|
||||
* This is cockatrice's native deck file format, and supports deck metadata such as banner cards and tags.
|
||||
* This is Cockatrice's native deck file format, and supports deck metadata such as banner cards and tags.
|
||||
* Stored as .cod files.
|
||||
*/
|
||||
Cockatrice
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bo
|
|||
result = deckList.loadFromFile_Native(&file);
|
||||
if (!result) {
|
||||
qCInfo(DeckLoaderLog) << "Failed to load " << fileName
|
||||
<< "as cockatrice format; retrying as plain format";
|
||||
<< "as Cockatrice format; retrying as plain format";
|
||||
file.seek(0);
|
||||
result = deckList.loadFromFile_Plain(&file, CardNameNormalizer());
|
||||
fmt = DeckFileFormat::PlainText;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public:
|
|||
static void printDeckList(QPrinter *printer, const DeckList &deckList);
|
||||
|
||||
/**
|
||||
* Converts the given deck's file to the cockatrice file format.
|
||||
* Converts the given deck's file to the Cockatrice file format.
|
||||
* Uses the lastLoadInfo in the LoadedDeck to determine the current name of the file and where to save to.
|
||||
* @param deck The deck to convert. Should have valid lastLoadInfo. Will update the lastLoadInfo.
|
||||
* @return Whether the conversion succeeded.
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ QStringMap &ThemeManager::getAvailableThemes()
|
|||
}
|
||||
}
|
||||
|
||||
// load themes from cockatrice system dir
|
||||
// Load themes from Cockatrice system dir
|
||||
dir.setPath(systemThemesBasePath());
|
||||
|
||||
for (QString themeName : dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name)) {
|
||||
|
|
|
|||
|
|
@ -478,13 +478,13 @@ void DlgSettings::closeEvent(QCloseEvent *event)
|
|||
case Invalid:
|
||||
loadErrorMessage = tr("Your card database is invalid.\n\n"
|
||||
"Cockatrice may not function correctly with an invalid database\n\n"
|
||||
"You may need to rerun oracle to update your card database.\n\n"
|
||||
"You may need to rerun Oracle to update your card database.\n\n"
|
||||
"Would you like to change your database location setting?");
|
||||
break;
|
||||
case VersionTooOld:
|
||||
loadErrorMessage = tr("Your card database version is too old.\n\n"
|
||||
"This can cause problems loading card information or images\n\n"
|
||||
"Usually this can be fixed by rerunning oracle to to update your card database.\n\n"
|
||||
"Usually this can be fixed by rerunning Oracle to to update your card database.\n\n"
|
||||
"Would you like to change your database location setting?");
|
||||
break;
|
||||
case NotLoaded:
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
// Lambda is cleaner to read than overloading this
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabDisplayCardNameChanged, this,
|
||||
[this] { repaint(); });
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabBackgroundDimChanged, this,
|
||||
[this] { repaint(); });
|
||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||
&HomeWidget::initializeBackgroundFromSource);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||
|
|
@ -358,13 +360,15 @@ void HomeWidget::paintEvent(QPaintEvent *event)
|
|||
painter.drawPixmap(topLeft, toDraw);
|
||||
}
|
||||
|
||||
// Draw translucent black overlay with rounded corners
|
||||
QRectF overlayRect(5, 5, width() - 10, height() - 10);
|
||||
QPainterPath roundedRectPath;
|
||||
roundedRectPath.addRoundedRect(overlayRect, 20, 20);
|
||||
if (SettingsCache::instance().appearance().getHomeTabBackgroundDim()) {
|
||||
// Draw translucent black overlay with rounded corners
|
||||
QRectF overlayRect(5, 5, width() - 10, height() - 10);
|
||||
QPainterPath roundedRectPath;
|
||||
roundedRectPath.addRoundedRect(overlayRect, 20, 20);
|
||||
|
||||
QColor semiTransparentBlack(0, 0, 0, static_cast<int>(255 * 0.33));
|
||||
painter.fillPath(roundedRectPath, semiTransparentBlack);
|
||||
QColor semiTransparentBlack(0, 0, 0, static_cast<int>(255 * 0.33));
|
||||
painter.fillPath(roundedRectPath, semiTransparentBlack);
|
||||
}
|
||||
|
||||
// Card name overlay (above the attribution, bottom-right)
|
||||
QString cardName;
|
||||
|
|
|
|||
|
|
@ -132,6 +132,10 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
connect(&homeTabDisplayCardNameCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.appearance(),
|
||||
&AppearanceSettings::setHomeTabDisplayCardName);
|
||||
|
||||
homeTabBackgroundDimCheckBox.setChecked(settings.appearance().getHomeTabBackgroundDim());
|
||||
connect(&homeTabBackgroundDimCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.appearance(),
|
||||
&AppearanceSettings::setHomeTabBackgroundDim);
|
||||
|
||||
for (const auto &entry : HomeTabButtonColor::all()) {
|
||||
homeTabButtonColorSourceBox.addItem(QObject::tr(entry.trKey));
|
||||
}
|
||||
|
|
@ -148,8 +152,9 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
homeTabGrid->addWidget(&homeTabBackgroundShuffleFrequencyLabel, 1, 0);
|
||||
homeTabGrid->addWidget(&homeTabBackgroundShuffleFrequencySpinBox, 1, 1);
|
||||
homeTabGrid->addWidget(&homeTabDisplayCardNameCheckBox, 2, 0, 1, 2);
|
||||
homeTabGrid->addWidget(&homeTabButtonColorSourceLabel, 3, 0);
|
||||
homeTabGrid->addWidget(&homeTabButtonColorSourceBox, 3, 1);
|
||||
homeTabGrid->addWidget(&homeTabBackgroundDimCheckBox, 3, 0, 1, 2);
|
||||
homeTabGrid->addWidget(&homeTabButtonColorSourceLabel, 4, 0);
|
||||
homeTabGrid->addWidget(&homeTabButtonColorSourceBox, 4, 1);
|
||||
|
||||
homeTabGroupBox = new QGroupBox;
|
||||
homeTabGroupBox->setLayout(homeTabGrid);
|
||||
|
|
@ -508,6 +513,9 @@ void AppearanceSettingsPage::retranslateUi()
|
|||
homeTabBackgroundShuffleFrequencyLabel.setText(tr("Home tab background shuffle frequency:"));
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setSpecialValueText(tr("Disabled"));
|
||||
homeTabDisplayCardNameCheckBox.setText(tr("Display card name of background in bottom right"));
|
||||
homeTabBackgroundDimCheckBox.setText(tr("Dim the home tab background"));
|
||||
homeTabBackgroundDimCheckBox.setToolTip(
|
||||
tr("Draw a translucent overlay over the home tab background so buttons and text stand out"));
|
||||
homeTabButtonColorSourceLabel.setText(tr("Home tab button color:"));
|
||||
homeTabButtonColorSourceBox.setToolTip(
|
||||
tr("Use the theme's identity accent colors, or extract colors from the background image"));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ private:
|
|||
QLabel homeTabBackgroundShuffleFrequencyLabel;
|
||||
QSpinBox homeTabBackgroundShuffleFrequencySpinBox;
|
||||
QCheckBox homeTabDisplayCardNameCheckBox;
|
||||
QCheckBox homeTabBackgroundDimCheckBox;
|
||||
QLabel homeTabButtonColorSourceLabel;
|
||||
QComboBox homeTabButtonColorSourceBox;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@
|
|||
#include <libcockatrice/settings/updates_settings.h>
|
||||
|
||||
#define GITHUB_PAGES_URL "https://cockatrice.github.io"
|
||||
#define GITHUB_CONTRIBUTORS_URL "https://github.com/Cockatrice/Cockatrice/graphs/contributors?type=c"
|
||||
#define GITHUB_CONTRIBUTE_URL "https://github.com/Cockatrice/Cockatrice#cockatrice"
|
||||
#define GITHUB_CONTRIBUTORS_URL "https://github.com/Cockatrice/Cockatrice/graphs/contributors"
|
||||
#define GITHUB_CONTRIBUTE_URL "https://github.com/Cockatrice/Cockatrice#"
|
||||
#define GITHUB_TRANSIFEX_TRANSLATORS_URL "https://github.com/Cockatrice/Cockatrice/wiki/Translator-Hall-of-Fame"
|
||||
#define GITHUB_TRANSLATOR_FAQ_URL "https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ"
|
||||
#define GITHUB_ISSUES_URL "https://github.com/Cockatrice/Cockatrice/issues"
|
||||
|
|
@ -1050,7 +1050,7 @@ void MainWindow::createCardUpdateProcess(bool background)
|
|||
|
||||
if (dir.exists(binaryName)) {
|
||||
updaterCmd = dir.absoluteFilePath(binaryName);
|
||||
} else { // try and find the directory oracle is stored in the build directory
|
||||
} else { // try and find the directory Oracle is stored in the build directory
|
||||
QDir findLocalDir(dir);
|
||||
findLocalDir.cdUp();
|
||||
findLocalDir.cd(getCardUpdaterBinaryName());
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ int main(int argc, char *argv[])
|
|||
// These values are only used by the settings loader/saver
|
||||
// Wrong or outdated values are kept to not break things
|
||||
QCoreApplication::setOrganizationName("Cockatrice");
|
||||
QCoreApplication::setOrganizationDomain("cockatrice.de");
|
||||
QCoreApplication::setOrganizationDomain("cockatrice.github.io");
|
||||
QCoreApplication::setApplicationName("Cockatrice");
|
||||
QCoreApplication::setApplicationVersion(VERSION_STRING);
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Command-line parser
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Cockatrice");
|
||||
parser.setApplicationDescription("Cockatrice Client");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
|
|
@ -350,8 +350,8 @@ int main(int argc, char *argv[])
|
|||
qCInfo(MainLog) << "MainWindow constructor finished";
|
||||
|
||||
ui.setWindowIcon(themePixmap(QStringLiteral("cockatrice")));
|
||||
// set name of the app desktop file; used by wayland to load the window icon
|
||||
QGuiApplication::setDesktopFileName("cockatrice");
|
||||
// Set name of the app desktop file; used by wayland to load the window icon
|
||||
QGuiApplication::setDesktopFileName("Cockatrice");
|
||||
|
||||
SettingsCache::instance().network().setClientID(generateClientID());
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 3.7 MiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 2.2 MiB |
|
|
@ -70,6 +70,17 @@ void AppearanceSettings::setHomeTabDisplayCardName(bool _displayCardName)
|
|||
emit homeTabDisplayCardNameChanged();
|
||||
}
|
||||
|
||||
bool AppearanceSettings::getHomeTabBackgroundDim() const
|
||||
{
|
||||
return getValue("homeTabBackgroundDim", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setHomeTabBackgroundDim(bool _dimBackground)
|
||||
{
|
||||
setValue(_dimBackground, "homeTabBackgroundDim");
|
||||
emit homeTabBackgroundDimChanged();
|
||||
}
|
||||
|
||||
int AppearanceSettings::getHomeTabButtonColorSourceIndex() const
|
||||
{
|
||||
return getValue("homeTabButtonColorSource", "", "", 0).toInt();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ public:
|
|||
void setHomeTabBackgroundShuffleFrequency(int _frequency);
|
||||
[[nodiscard]] bool getHomeTabDisplayCardName() const;
|
||||
void setHomeTabDisplayCardName(bool _displayCardName);
|
||||
[[nodiscard]] bool getHomeTabBackgroundDim() const;
|
||||
void setHomeTabBackgroundDim(bool _dimBackground);
|
||||
[[nodiscard]] int getHomeTabButtonColorSourceIndex() const;
|
||||
void setHomeTabButtonColorSourceIndex(int index);
|
||||
|
||||
|
|
@ -36,6 +38,7 @@ signals:
|
|||
void homeTabBackgroundSourceChanged();
|
||||
void homeTabBackgroundShuffleFrequencyChanged();
|
||||
void homeTabDisplayCardNameChanged();
|
||||
void homeTabBackgroundDimChanged();
|
||||
void homeTabButtonColorChanged();
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
|
||||
QCoreApplication::setOrganizationName("Cockatrice");
|
||||
QCoreApplication::setOrganizationDomain("cockatrice");
|
||||
// this can't be changed, as it influences the default save path for cards.xml
|
||||
QCoreApplication::setOrganizationDomain("Cockatrice");
|
||||
// This can't be changed, as it influences the default save path for cards.xml
|
||||
QCoreApplication::setApplicationName("Cockatrice");
|
||||
|
||||
// If the program is opened with the -s flag, it will only do spoilers. Otherwise it will do MTGJSON/Tokens
|
||||
|
|
@ -83,7 +83,7 @@ int main(int argc, char *argv[])
|
|||
QIcon icon("theme:appicon.svg");
|
||||
wizard.setWindowIcon(icon);
|
||||
// set name of the app desktop file; used by wayland to load the window icon
|
||||
QGuiApplication::setDesktopFileName("oracle");
|
||||
QGuiApplication::setDesktopFileName("Oracle");
|
||||
|
||||
wizard.show();
|
||||
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ void SaveSetsPage::retranslateUi()
|
|||
{
|
||||
setTitle(tr("Sets imported"));
|
||||
if (wizard()->downloadedPlainXml) {
|
||||
setSubTitle(tr("A cockatrice database file of %1 MB has been downloaded.")
|
||||
setSubTitle(tr("A Cockatrice card database file of %1 MB has been downloaded.")
|
||||
.arg(qRound(wizard()->xmlData.size() / 1000000.0)));
|
||||
} else {
|
||||
setSubTitle(tr("The following sets have been found:"));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* Note that "...enters tapped unless..." returns false.
|
||||
*
|
||||
* @param name The name of the card
|
||||
* @param text The oracle text of the card
|
||||
* @param text The Oracle text of the card
|
||||
*/
|
||||
bool parseCipt(const QString &name, const QString &text)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ using ScanProgressCallback = std::function<void(qsizetype bytesRead, qsizetype t
|
|||
* @brief Scans a full MTGJSON document without materializing the JSON tree.
|
||||
*
|
||||
* Splits the top-level "data" object into per-set byte ranges and reads each
|
||||
* set's metadata directly from the raw bytes. The oracle importer can then
|
||||
* set's metadata directly from the raw bytes. The Oracle importer can then
|
||||
* parse one set at a time during import, keeping peak memory far below a single
|
||||
* QJsonDocument::fromJson() over the whole file.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -86,9 +86,10 @@ bool Servatrice_DatabaseInterface::openDatabase()
|
|||
<< dbversion << "to version" << expectedversion;
|
||||
return false;
|
||||
} else if (dbversion > expectedversion) {
|
||||
qCCritical(DatabaseInterfaceLog) << poolStr << "Error opening database: the database schema version"
|
||||
<< dbversion << "is too new, you need to update servatrice"
|
||||
<< "(this servatrice actually uses version" << expectedversion << ")";
|
||||
qCCritical(DatabaseInterfaceLog)
|
||||
<< poolStr << "Error opening database: the database schema version" << dbversion
|
||||
<< "is too new, you need to update Servatrice" << "(Currently running Servatrice actually uses version"
|
||||
<< expectedversion << ")";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -386,6 +386,19 @@ TEST_F(SettingsDefaultsTest, Appearance_HomeTabDisplayCardName_Default)
|
|||
ASSERT_EQ(s.getHomeTabDisplayCardName(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_HomeTabBackgroundDim_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabBackgroundDim(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_HomeTabBackgroundDim_SetAndGet)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
s.setHomeTabBackgroundDim(false);
|
||||
ASSERT_EQ(s.getHomeTabBackgroundDim(), false);
|
||||
}
|
||||
|
||||
// --- InterfaceSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_ShowStatusBar_Default)
|
||||
|
|
|
|||