Commit 684e91b3 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Remove KIO dependency.

KIO was used for exactly one dialog that has to be set at most once (and
never by a user). We can also create that dialog by hand.
parent b152e189
......@@ -54,7 +54,6 @@ find_package(KF5 REQUIRED COMPONENTS
ConfigWidgets
Declarative
I18n
KIO
NewStuff
WidgetsAddons
XmlGui
......
......@@ -161,7 +161,6 @@ target_link_libraries(artikulate
Qt5::QuickWidgets
KF5::ConfigWidgets
KF5::Declarative
KF5::KIOWidgets
KF5::NewStuff
KF5::XmlGui
)
......@@ -176,7 +175,6 @@ target_link_libraries(artikulate_editor
Qt5::QuickWidgets
KF5::ConfigWidgets
KF5::Declarative
KF5::KIOWidgets
KF5::NewStuff
KF5::XmlGui
)
......
......@@ -9,7 +9,7 @@
<label>If enabled, course files are only read from the local contributor repository</label>
<default>false</default>
</entry>
<entry name="CourseRepositoryPath" type="Path">
<entry name="CourseRepositoryPath" type="String">
<label>Path to local contributor repository</label>
</entry>
<entry name="AudioInputDevice" type="String">
......
......@@ -26,6 +26,9 @@
#include "settings.h"
#include <KLocalizedString>
#include <QLineEdit>
#include <QFileDialog>
#include <QToolButton>
#include <QUuid>
ResourcesDialogPage::ResourcesDialogPage(ResourceManager *m_resourceManager)
......@@ -35,6 +38,14 @@ ResourcesDialogPage::ResourcesDialogPage(ResourceManager *m_resourceManager)
{
ui = new Ui::ResourcesDialogPage;
ui->setupUi(this);
connect(ui->buttonSelectCourseRepository, &QToolButton::clicked, [=](){
const QString dir = QFileDialog::getExistingDirectory(this,
i18n("Open Repository Directory"),
QString(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ui->kcfg_CourseRepositoryPath->setText(dir);
});
}
ResourcesDialogPage::~ResourcesDialogPage()
......@@ -45,7 +56,7 @@ ResourcesDialogPage::~ResourcesDialogPage()
void ResourcesDialogPage::loadSettings()
{
// setup Ui with stored settings
ui->kcfg_CourseRepositoryPath->setUrl(QUrl(Settings::courseRepositoryPath()));
ui->kcfg_CourseRepositoryPath->setText(Settings::courseRepositoryPath());
ui->kcfg_UseCourseRepository->setChecked(Settings::useCourseRepository());
}
......@@ -53,7 +64,7 @@ void ResourcesDialogPage::saveSettings()
{
// save settings
Settings::setUseCourseRepository(ui->kcfg_UseCourseRepository->isChecked());
Settings::setCourseRepositoryPath(ui->kcfg_CourseRepositoryPath->url().toLocalFile());
Settings::setCourseRepositoryPath(ui->kcfg_CourseRepositoryPath->text());
Settings::self()->save();
// reloading resources
m_resourceManager->loadCourseResources();
......
......@@ -27,8 +27,7 @@
class ResourceManager;
class Course;
class ResourcesDialogPage :
public QWidget
class ResourcesDialogPage : public QWidget
{
Q_OBJECT
......@@ -36,7 +35,7 @@ public:
explicit ResourcesDialogPage(ResourceManager *resourceMgr);
virtual ~ResourcesDialogPage();
public slots:
public Q_SLOTS:
void saveSettings();
void loadSettings();
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>250</height>
<height>269</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -29,52 +29,6 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Course Contributor Repository:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="KUrlRequester" name="kcfg_CourseRepositoryPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Path to the contributor repository.</string>
</property>
<property name="mode">
<set>KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="kcfg_UseCourseRepository">
<property name="toolTip">
<string>Use this option only if you are a course contributor and you are working on a course repository.</string>
</property>
<property name="text">
<string>Use course contributor repository in trainer mode</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
......@@ -103,6 +57,43 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Course Contributor Repository:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="repositoryPathLine">
<item>
<widget class="QLineEdit" name="kcfg_CourseRepositoryPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Path to the contributor repository.</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonSelectCourseRepository">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="document-open-folder"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="Line" name="line">
<property name="orientation">
......@@ -110,15 +101,31 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="kcfg_UseCourseRepository">
<property name="toolTip">
<string>Use this option only if you are a course contributor and you are working on a course repository.</string>
</property>
<property name="text">
<string>Use course contributor repository in trainer mode</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment