1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Merge branch 'v2.0'

This commit is contained in:
David Rosca 2016-04-23 09:48:16 +02:00
commit a2c8108aff
2 changed files with 29 additions and 8 deletions

View File

@ -78,8 +78,8 @@ void CommandLineOptions::parseActions()
// Parser // Parser
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription(QSL("QtWebEngine based browser")); parser.setApplicationDescription(QSL("QtWebEngine based browser"));
parser.addHelpOption(); QCommandLineOption helpOption = parser.addHelpOption();
parser.addVersionOption(); QCommandLineOption versionOption = parser.addVersionOption();
parser.addOption(authorsOption); parser.addOption(authorsOption);
parser.addOption(profileOption); parser.addOption(profileOption);
parser.addOption(noExtensionsOption); parser.addOption(noExtensionsOption);
@ -97,6 +97,14 @@ void CommandLineOptions::parseActions()
// parse() and not process() so we can pass arbitrary options to Chromium // parse() and not process() so we can pass arbitrary options to Chromium
parser.parse(QCoreApplication::arguments()); parser.parse(QCoreApplication::arguments());
if (parser.isSet(helpOption)) {
parser.showHelp();
}
if (parser.isSet(versionOption)) {
parser.showVersion();
}
if (parser.isSet(authorsOption)) { if (parser.isSet(authorsOption)) {
std::cout << "David Rosca <nowrep@gmail.com>" << std::endl; std::cout << "David Rosca <nowrep@gmail.com>" << std::endl;

View File

@ -348,12 +348,25 @@ Preferences::Preferences(BrowserWindow* window)
//FONTS //FONTS
settings.beginGroup("Browser-Fonts"); settings.beginGroup("Browser-Fonts");
QWebEngineSettings* webSettings = QWebEngineSettings::defaultSettings(); QWebEngineSettings* webSettings = QWebEngineSettings::defaultSettings();
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString())); auto defaultFont = [&](QWebEngineSettings::FontFamily font) {
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString())); const QString family = webSettings->fontFamily(font);
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString())); if (!family.isEmpty())
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebEngineSettings::FixedFont)).toString())); return family;
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", webSettings->fontFamily(QWebEngineSettings::SansSerifFont)).toString())); switch (font) {
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", webSettings->fontFamily(QWebEngineSettings::SerifFont)).toString())); case QWebEngineSettings::FixedFont:
return QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
case QWebEngineSettings::SerifFont:
// TODO
default:
return QFontDatabase::systemFont(QFontDatabase::GeneralFont).family();
}
};
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", defaultFont(QWebEngineSettings::StandardFont)).toString()));
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", defaultFont(QWebEngineSettings::CursiveFont)).toString()));
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", defaultFont(QWebEngineSettings::FantasyFont)).toString()));
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", defaultFont(QWebEngineSettings::FixedFont)).toString()));
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", defaultFont(QWebEngineSettings::SansSerifFont)).toString()));
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", defaultFont(QWebEngineSettings::SerifFont)).toString()));
ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt()); ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt());
ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt()); ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt());
ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt()); ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt());