mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 21:38:45 -04:00
Remove port option from settings panel
Allow port settings to be changed from local server dialog
This commit is contained in:
parent
93edcbd41b
commit
f4b0a1a4cc
@ -68,6 +68,7 @@ void LocalKiwixServer::runOrStopServer()
|
||||
m_port = ui->PortChooser->text().toInt();
|
||||
m_ipAddress = (ui->IpChooser->currentText() != "0.0.0.0") ? ui->IpChooser->currentText() : QString::fromStdString(mp_server->getBestPublicIp());
|
||||
mp_server->setPort(m_port);
|
||||
KiwixApp::instance()->getSettingsManager()->setKiwixServerPort(m_port);
|
||||
mp_server->setAddress(ui->IpChooser->currentText().toStdString());
|
||||
ui->IpAddress->setText("http://" + m_ipAddress + ":" + QString::number(m_port));
|
||||
if (!mp_server->start()) {
|
||||
|
@ -13,15 +13,12 @@ SettingsView::SettingsView(QWidget *parent)
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QString(file.readAll());
|
||||
ui->widget->setStyleSheet(styleSheet);
|
||||
connect(ui->serverPortSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsView::setKiwixServerPort);
|
||||
connect(ui->zoomPercentSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsView::setZoom);
|
||||
connect(ui->browseButton, &QPushButton::clicked, this, &SettingsView::browseDownloadDir);
|
||||
connect(ui->resetButton, &QPushButton::clicked, this, &SettingsView::resetDownloadDir);
|
||||
connect(KiwixApp::instance()->getSettingsManager(), &SettingsManager::downloadDirChanged, this, &SettingsView::onDownloadDirChanged);
|
||||
connect(KiwixApp::instance()->getSettingsManager(), &SettingsManager::zoomChanged, this, &SettingsView::onZoomChanged);
|
||||
connect(KiwixApp::instance()->getSettingsManager(), &SettingsManager::portChanged, this, &SettingsView::onServerPortChanged);
|
||||
ui->settingsLabel->setText(gt("settings"));
|
||||
ui->serverPortLabel->setText(gt("port-for-local-kiwix-server-setting"));
|
||||
ui->zoomPercentLabel->setText(gt("zoom-level-setting"));
|
||||
ui->downloadDirLabel->setText(gt("download-directory-setting"));
|
||||
ui->resetButton->setText(gt("reset"));
|
||||
@ -29,7 +26,6 @@ SettingsView::SettingsView(QWidget *parent)
|
||||
}
|
||||
void SettingsView::init(int port, int zoomPercent, const QString &dir)
|
||||
{
|
||||
ui->serverPortSpinBox->setValue(port);
|
||||
ui->zoomPercentSpinBox->setValue(zoomPercent);
|
||||
ui->downloadDirPath->setText(dir);
|
||||
}
|
||||
@ -83,11 +79,6 @@ void SettingsView::setZoom(int zoomPercent)
|
||||
KiwixApp::instance()->getSettingsManager()->setZoomFactor(zoomFactor);
|
||||
}
|
||||
|
||||
void SettingsView::setKiwixServerPort(int port)
|
||||
{
|
||||
KiwixApp::instance()->getSettingsManager()->setKiwixServerPort(port);
|
||||
}
|
||||
|
||||
void SettingsView::onDownloadDirChanged(const QString &dir)
|
||||
{
|
||||
ui->downloadDirPath->setText(dir);
|
||||
@ -98,8 +89,3 @@ void SettingsView::onZoomChanged(qreal zoomFactor)
|
||||
qreal zoomPercent = zoomFactor * 100;
|
||||
ui->zoomPercentSpinBox->setValue(zoomPercent);
|
||||
}
|
||||
|
||||
void SettingsView::onServerPortChanged(int port)
|
||||
{
|
||||
ui->serverPortSpinBox->setValue(port);
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ public Q_SLOTS:
|
||||
void setZoom(int zoomPercent);
|
||||
void onDownloadDirChanged(const QString &dir);
|
||||
void onZoomChanged(qreal zoomFactor);
|
||||
void onServerPortChanged(int port);
|
||||
void setKiwixServerPort(int port);
|
||||
private:
|
||||
bool confirmDialogDownloadDir(const QString& dir);
|
||||
|
||||
|
@ -57,62 +57,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="serverPortLabel">
|
||||
<property name="text">
|
||||
<string>Port for local kiwix server:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="QSpinBox" name="serverPortSpinBox">
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user