Skip to content

Commit 20ad0b9

Browse files
committed
Improvements of clarity to settings ui and some temporary changes towards implementation
1 parent 7f2a049 commit 20ad0b9

File tree

6 files changed

+76
-14
lines changed

6 files changed

+76
-14
lines changed

src/contentmanager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ void ContentManager::setLanguages()
295295
for (auto language : languageData) {
296296
auto langCode = QString::fromStdString(language);
297297
auto selfName = QString::fromStdString(kiwix::getLanguageSelfName(language));
298+
// qDebug() << langCode;
299+
// qDebug() << selfName << "!";
298300
languages.push_back({langCode, selfName});
299301
}
300302
m_languages = languages;

src/contentmanagerside.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,9 @@ void ContentManagerSide::setCategories(QStringList categories)
9797

9898
void ContentManagerSide::setLanguages(ContentManager::LanguageList langList)
9999
{
100+
qDebug() << "List of languages:";
101+
for (const QPair<QString, QString>& languagePair : langList) {
102+
qDebug() << languagePair.first;
103+
}
100104
mp_languages->setSelections(langList, KiwixApp::instance()->getSettingsManager()->getLanguageList());
101105
}

src/settingsmanager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ void SettingsManager::initSettings()
170170
*
171171
* QList(QVariant(QChar, 'E'), QVariant(QChar, 'n'), QVariant(QChar, 'g'), ...
172172
*/
173+
173174
QList<QString> defaultLangList; // Qt5 QList doesn't support supplying a constructor list
174175
defaultLangList.append(defaultLang);
175176
QVariant defaultLangVariant(defaultLangList);
176177
m_langList = m_settings.value("language", defaultLangVariant).toList();
177178

179+
180+
// ui->comboBoxLanguage->addItems(languageList);
181+
178182
m_categoryList = m_settings.value("category", {}).toList();
179183
m_contentTypeList = m_settings.value("contentType", {}).toList();
180184
}

src/settingsview.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SettingsView::SettingsView(QWidget *parent)
1515
connect(ui->reopenTabToggle, &QCheckBox::clicked, this, &SettingsView::setReopenTab);
1616
connect(ui->browseButton, &QPushButton::clicked, this, &SettingsView::browseDownloadDir);
1717
connect(ui->resetButton, &QPushButton::clicked, this, &SettingsView::resetDownloadDir);
18+
connect(ui->comboBoxLanguage, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsView::languageSelected);
1819
connect(ui->monitorBrowse, &QPushButton::clicked, this, &SettingsView::browseMonitorDir);
1920
connect(ui->monitorClear, &QPushButton::clicked, this, &SettingsView::clearMonitorDir);
2021
connect(KiwixApp::instance()->getSettingsManager(), &SettingsManager::downloadDirChanged, this, &SettingsView::onDownloadDirChanged);
@@ -52,6 +53,10 @@ void SettingsView::init(int zoomPercent, const QString &downloadDir,
5253
ui->monitorClear->hide();
5354
}
5455
ui->monitorDirPath->setText(monitorDir);
56+
QStringList languageList;
57+
languageList << "English" << "Spanish" << "French" << "German" << "Chinese";
58+
ui->comboBoxLanguage->addItems(languageList);
59+
ui->comboBoxLanguage->setCurrentText("Spanish");
5560
ui->moveToTrashToggle->setChecked(moveToTrash);
5661
ui->reopenTabToggle->setChecked(reopentab);
5762
}
@@ -159,6 +164,14 @@ void SettingsView::onDownloadDirChanged(const QString &dir)
159164
ui->downloadDirPath->setText(dir);
160165
}
161166

167+
void SettingsView::languageSelected(const int &languageIndex)
168+
{
169+
qInfo() << languageIndex;
170+
// ui->comboBoxLanguage->setCurrentText(language);
171+
ui->comboBoxLanguage->setCurrentIndex(languageIndex);
172+
//KiwixApp::instance()->getSettingsManager()->setDownloadDir(dir);
173+
}
174+
162175
void SettingsView::onMonitorDirChanged(const QString &dir)
163176
{
164177
if (dir == "") {

src/settingsview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SettingsView : public QWidget
2323
void setMoveToTrash(bool moveToTrash);
2424
void setReopenTab(bool reopen);
2525
void onDownloadDirChanged(const QString &dir);
26+
void languageSelected(const int &languageIndex);
2627
void onMonitorDirChanged(const QString &dir);
2728
void onZoomChanged(qreal zoomFactor);
2829
void onMoveToTrashChanged(bool moveToTrash);

ui/settings.ui

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
</widget>
5252
</item>
5353
<item>
54-
<widget class="Line" name="line_3">
54+
<widget class="Line" name="lineSettings">
5555
<property name="orientation">
5656
<enum>Qt::Horizontal</enum>
5757
</property>
5858
</widget>
5959
</item>
6060
<item>
61-
<layout class="QHBoxLayout" name="horizontalLayout_2">
61+
<layout class="QHBoxLayout" name="horizontalLayoutZoom">
6262
<item>
6363
<widget class="QLabel" name="zoomPercentLabel">
6464
<property name="text">
@@ -67,7 +67,7 @@
6767
</widget>
6868
</item>
6969
<item>
70-
<spacer name="horizontalSpacer_4">
70+
<spacer name="horizontalSpacerZoom">
7171
<property name="orientation">
7272
<enum>Qt::Horizontal</enum>
7373
</property>
@@ -104,7 +104,7 @@
104104
</layout>
105105
</item>
106106
<item>
107-
<widget class="Line" name="line_2">
107+
<widget class="Line" name="lineZoom">
108108
<property name="frameShadow">
109109
<enum>QFrame::Plain</enum>
110110
</property>
@@ -114,7 +114,7 @@
114114
</widget>
115115
</item>
116116
<item>
117-
<layout class="QHBoxLayout" name="horizontalLayout_3">
117+
<layout class="QHBoxLayout" name="horizontalLayoutDownload1">
118118
<item>
119119
<widget class="QLabel" name="downloadDirLabel">
120120
<property name="text">
@@ -123,7 +123,7 @@
123123
</widget>
124124
</item>
125125
<item>
126-
<spacer name="horizontalSpacer">
126+
<spacer name="horizontalSpacerDownload1">
127127
<property name="orientation">
128128
<enum>Qt::Horizontal</enum>
129129
</property>
@@ -145,9 +145,9 @@
145145
</layout>
146146
</item>
147147
<item>
148-
<layout class="QHBoxLayout" name="horizontalLayout_5">
148+
<layout class="QHBoxLayout" name="horizontalLayoutDownload2">
149149
<item>
150-
<spacer name="horizontalSpacer_2">
150+
<spacer name="horizontalSpacerDownload2">
151151
<property name="orientation">
152152
<enum>Qt::Horizontal</enum>
153153
</property>
@@ -200,14 +200,14 @@
200200
</layout>
201201
</item>
202202
<item>
203-
<widget class="Line" name="line_4">
203+
<widget class="Line" name="lineDownload">
204204
<property name="orientation">
205205
<enum>Qt::Horizontal</enum>
206206
</property>
207207
</widget>
208208
</item>
209209
<item>
210-
<layout class="QHBoxLayout" name="horizontalLayout_6">
210+
<layout class="QHBoxLayout" name="horizontalLayoutMonitor1">
211211
<item>
212212
<widget class="QLabel" name="monitorDirLabel">
213213
<property name="text">
@@ -232,7 +232,7 @@
232232
</widget>
233233
</item>
234234
<item>
235-
<spacer name="horizontalSpacer_6">
235+
<spacer name="horizontalSpacerMonitor1">
236236
<property name="orientation">
237237
<enum>Qt::Horizontal</enum>
238238
</property>
@@ -254,9 +254,9 @@
254254
</layout>
255255
</item>
256256
<item>
257-
<layout class="QHBoxLayout" name="horizontalLayout_8">
257+
<layout class="QHBoxLayout" name="horizontalLayoutMonitor2">
258258
<item>
259-
<spacer name="horizontalSpacer_7">
259+
<spacer name="horizontalSpacerMonitor2">
260260
<property name="orientation">
261261
<enum>Qt::Horizontal</enum>
262262
</property>
@@ -285,7 +285,45 @@
285285
</layout>
286286
</item>
287287
<item>
288-
<widget class="Line" name="line_5">
288+
<widget class="Line" name="lineMonitor">
289+
<property name="orientation">
290+
<enum>Qt::Horizontal</enum>
291+
</property>
292+
</widget>
293+
</item>
294+
<item>
295+
<layout class="QHBoxLayout" name="horizontalLayoutLanguage">
296+
<item>
297+
<widget class="QLabel" name="languageLabel">
298+
<property name="text">
299+
<string>Language</string>
300+
</property>
301+
</widget>
302+
</item>
303+
<item>
304+
<spacer name="horizontalSpacerLanguage">
305+
<property name="orientation">
306+
<enum>Qt::Horizontal</enum>
307+
</property>
308+
<property name="sizeHint" stdset="0">
309+
<size>
310+
<width>40</width>
311+
<height>20</height>
312+
</size>
313+
</property>
314+
</spacer>
315+
</item>
316+
<item>
317+
<widget class="QComboBox" name="comboBoxLanguage">
318+
<property name="currentText">
319+
<string/>
320+
</property>
321+
</widget>
322+
</item>
323+
</layout>
324+
</item>
325+
<item>
326+
<widget class="Line" name="lineLanguage">
289327
<property name="orientation">
290328
<enum>Qt::Horizontal</enum>
291329
</property>

0 commit comments

Comments
 (0)