mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 03:58:56 -04:00
Added white background to mainview
Followed design as specified in #640
This commit is contained in:
parent
bace78ae1a
commit
0711c4a5c1
@ -1,88 +1,23 @@
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: auto;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
width: 80%;
|
||||
overflow: hidden;
|
||||
QLabel,
|
||||
QPushButton {
|
||||
font: 12pt "Cantarell";
|
||||
}
|
||||
|
||||
#settings {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
QLabel#settingsLabel {
|
||||
font: bold 32pt "Cantarell";
|
||||
}
|
||||
|
||||
#header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
QSpinBox, QLabel#downloadDirPath{
|
||||
font: bold 12pt "Cantarell";
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1px solid grey;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
|
||||
input {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#download_dir {
|
||||
flex: 1;
|
||||
margin: 5px;
|
||||
overflow: hidden;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
#download_dir > span {
|
||||
display: block;
|
||||
float: right;
|
||||
direction: ltr;
|
||||
min-width: 100%;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
input[type=button] {
|
||||
QPushButton {
|
||||
background-color: white;
|
||||
color: blue;
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
border-radius: 2px;
|
||||
padding: 5px;
|
||||
font:bold;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
input[type=button]:hover {
|
||||
QPushButton:hover {
|
||||
background-color: RoyalBlue;
|
||||
color: white;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
input[type=number]::-webkit-inner-spin-button,
|
||||
input[type=number]::-webkit-outer-spin-button {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
div.percentage-symbol {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.percentage-symbol:before {
|
||||
position: absolute;
|
||||
content: "%";
|
||||
top: 0.4em;
|
||||
right: 1.5em;
|
||||
}
|
||||
|
||||
div.percentage-symbol input {
|
||||
text-align: left;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <kiwix/tools.h>
|
||||
|
||||
SettingsManager::SettingsManager(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_settings("Kiwix", "Kiwix-desktop"),
|
||||
@ -15,17 +14,11 @@ SettingsManager::SettingsManager(QObject *parent)
|
||||
|
||||
SettingsView* SettingsManager::getView()
|
||||
{
|
||||
static SettingsView *view = nullptr;
|
||||
|
||||
if (!view || !m_settingsViewDisplayed)
|
||||
view = new SettingsView();
|
||||
|
||||
auto view = new SettingsView();
|
||||
view->init(m_kiwixServerPort, m_zoomFactor * 100, m_downloadDir);
|
||||
connect(view, &QObject::destroyed, this, [=]() { m_settingsViewDisplayed = false;});
|
||||
connect(view, &SettingsView::serverPortChanged, this, &SettingsManager::setKiwixServerPort);
|
||||
connect(view, &SettingsView::downloadDirChanged, this, &SettingsManager::setDownloadDir);
|
||||
connect(view, &SettingsView::zoomFactorChanged, this, &SettingsManager::setZoomFactor);
|
||||
m_settingsViewDisplayed = true;
|
||||
connect(view, &SettingsView::zoomFactorChanged, this, &SettingsManager::setZoom);
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -66,11 +59,14 @@ void SettingsManager::setKiwixServerPort(int port)
|
||||
emit(portChanged(port));
|
||||
}
|
||||
|
||||
void SettingsManager::setZoom(int factor)
|
||||
{
|
||||
qreal zoomFactor = (double)factor/100;
|
||||
setZoomFactor(zoomFactor);
|
||||
}
|
||||
|
||||
void SettingsManager::setZoomFactor(qreal zoomFactor)
|
||||
{
|
||||
if (zoomFactor > 1)
|
||||
zoomFactor /= 100;
|
||||
|
||||
m_zoomFactor = zoomFactor;
|
||||
m_settings.setValue("view/zoomFactor", zoomFactor);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public slots:
|
||||
QString getDownloadDir() { return m_downloadDir; }
|
||||
void resetDownloadDir();
|
||||
void browseDownloadDir();
|
||||
|
||||
void setZoom(int factor);
|
||||
private:
|
||||
void initSettings();
|
||||
bool confirmDialogDownloadDir(const QString& dir);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "settingsview.h"
|
||||
#include "ui_settings.h"
|
||||
#include "kiwixapp.h"
|
||||
|
||||
#include <kiwix/tools.h>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
SettingsView::SettingsView(QWidget *parent)
|
||||
@ -9,6 +9,10 @@ SettingsView::SettingsView(QWidget *parent)
|
||||
, ui(new Ui::Settings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QFile file("./resources/css/_settingsManager.css");
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QString(file.readAll());
|
||||
ui->widget->setStyleSheet(styleSheet);
|
||||
connect(ui->serverPortSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsView::serverPortChanged);
|
||||
connect(ui->zoomLevelSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsView::zoomFactorChanged);
|
||||
connect(ui->resetButton, &QPushButton::clicked, this, &SettingsView::resetDownloadDir);
|
||||
@ -44,7 +48,7 @@ bool SettingsView::confirmDialogDownloadDir(const QString& dir)
|
||||
|
||||
void SettingsView::resetDownloadDir()
|
||||
{
|
||||
auto dir = QString::fromStdString(getDataDirectory());
|
||||
auto dir = QString::fromStdString(kiwix::getDataDirectory());
|
||||
const auto &downloadDir = KiwixApp::instance()->getSettingsManager()->getDownloadDir();
|
||||
if (dir == downloadDir) {
|
||||
return;
|
||||
|
@ -79,7 +79,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="mainView"/>
|
||||
<widget class="QStackedWidget" name="mainView">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="mainLayout">
|
||||
<item>
|
||||
@ -45,13 +45,6 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
@ -68,13 +61,6 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="serverPortLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port for local kiwix server:</string>
|
||||
</property>
|
||||
@ -95,6 +81,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="serverPortSpinBox">
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
@ -122,12 +111,6 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="zoomLevelLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom level:</string>
|
||||
</property>
|
||||
@ -148,10 +131,22 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="zoomLevelSpinBox">
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
@ -169,19 +164,13 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="downloadDirLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Download directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -200,18 +189,59 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="browseButton">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user