mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 20:20:58 -04:00
Merge pull request #638 from kiwix/work/serverdialog
Improve Kiwix Serve dialog look and feel
This commit is contained in:
commit
e6e17cff58
@ -3,13 +3,18 @@ QWidget {
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
opacity: 1;
|
||||
border: none;
|
||||
padding: 3px;
|
||||
color:blue;
|
||||
color: RoyalBlue;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: blue;
|
||||
color: white;
|
||||
}
|
||||
color: rgba(65, 105, 225, 0.9);
|
||||
}
|
||||
|
||||
QLineEdit {
|
||||
border: 2px solid gray;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
@ -4,8 +4,10 @@
|
||||
]
|
||||
},
|
||||
"name":"English",
|
||||
"error-title":"Error",
|
||||
"error-downloader-window-title":"Cannot create downloader",
|
||||
"error-downloader-launch-message":"Impossible to launch downloader, Kiwix-desktop will start but all download functions will not working !",
|
||||
"error-launch-server-message":"An error has occured !",
|
||||
"open-zim":"Open Zim",
|
||||
"local-kiwix-server":"Local Kiwix Server",
|
||||
"random-article":"Random Article",
|
||||
@ -14,6 +16,7 @@
|
||||
"print":"Print",
|
||||
"new-tab":"New tab",
|
||||
"close-tab":"Close tab",
|
||||
"close":"Close",
|
||||
"reopen-closed-tab":"Reopen closed tab",
|
||||
"browse-library":"Browse library",
|
||||
"open-file":"Open file",
|
||||
|
@ -9,6 +9,7 @@ LocalKiwixServer::LocalKiwixServer(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LocalKiwixServer)
|
||||
{
|
||||
setWindowFlag(Qt::FramelessWindowHint, true);
|
||||
ui->setupUi(this);
|
||||
|
||||
QFile styleFile(":/css/localServer.css");
|
||||
@ -25,6 +26,7 @@ LocalKiwixServer::LocalKiwixServer(QWidget *parent) :
|
||||
connect(ui->OpenInBrowserButton, SIGNAL(clicked()), this, SLOT(openInBrowser()));
|
||||
connect(KiwixApp::instance()->getSettingsManager(), &SettingsManager::portChanged,
|
||||
this, [=](int port) { m_port = port; });
|
||||
connect(ui->closeButton, &QPushButton::clicked, this, &LocalKiwixServer::close);
|
||||
const QHostAddress &localhost = QHostAddress(QHostAddress::LocalHost);
|
||||
for (const QHostAddress &address: QNetworkInterface::allAddresses()) {
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol && address != localhost) {
|
||||
@ -32,11 +34,16 @@ LocalKiwixServer::LocalKiwixServer(QWidget *parent) :
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->KiwixServerButton->setStyleSheet("QPushButton {background-color: RoyalBlue;"
|
||||
"color: white;"
|
||||
"padding: 5px;"
|
||||
"border-radius: 3px;}"
|
||||
"QPushButton:hover {background-color: DodgerBlue;}");
|
||||
ui->label->setText(gt("local-kiwix-server"));
|
||||
ui->label->setStyleSheet("font-weight: bold;");
|
||||
ui->KiwixServerText->setText(gt("kiwix-server-description"));
|
||||
ui->OpenInBrowserButton->setText(gt("open-in-browser"));
|
||||
ui->KiwixServerButton->setText(gt("start-kiwix-server"));
|
||||
ui->closeButton->setText(gt("close-dialog"));
|
||||
ui->OpenInBrowserButton->setVisible(false);
|
||||
ui->IpAddress->setVisible(false);
|
||||
}
|
||||
@ -59,10 +66,10 @@ void LocalKiwixServer::runOrStopServer()
|
||||
{
|
||||
if (!m_active) {
|
||||
mp_server->setPort(m_port);
|
||||
ui->IpAddress->setText(m_ipAddress + ":" + QString::number(m_port));
|
||||
ui->IpAddress->setText("http://" + m_ipAddress + ":" + QString::number(m_port));
|
||||
if (!mp_server->start()) {
|
||||
QMessageBox messageBox;
|
||||
messageBox.critical(0,"Error","An error has occured !");
|
||||
messageBox.critical(0,gt("error-title"),gt("error-launch-server-message"));
|
||||
return;
|
||||
}
|
||||
m_active = true;
|
||||
|
@ -74,7 +74,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
return QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
TabBar* MainWindow::getTabBar()
|
||||
{
|
||||
return mp_ui->tabBar;
|
||||
@ -93,4 +92,4 @@ QStackedWidget *MainWindow::getSideDockWidget()
|
||||
ContentManagerSide *MainWindow::getSideContentManager()
|
||||
{
|
||||
return mp_ui->contentmanagerside;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
protected slots:
|
||||
void toggleFullScreen();
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *mp_ui;
|
||||
About *mp_about;
|
||||
|
@ -7,32 +7,43 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>342</height>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Local Kiwix Server Settings - Kiwix</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QTextBrowser" name="KiwixServerText">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="KiwixServerButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Kiwix Server</string>
|
||||
</property>
|
||||
@ -44,18 +55,26 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="KiwixServerText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
@ -70,21 +89,18 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="IpAddress">
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="OpenInBrowserButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
@ -98,11 +114,51 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local Kiwix Server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="IpAddress">
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user