From 348f5ea0f1854c1c6a9555d84054b60cc3bac365 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Thu, 12 Feb 2015 00:05:44 +0100 Subject: [PATCH] Basic general page configuration --- src/generalpage.cpp | 47 ++++++++++++++++++++++++ src/generalpage.h | 40 ++++++++++++++++++++ src/ui/generalpage.ui | 85 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 src/generalpage.cpp create mode 100644 src/generalpage.h create mode 100644 src/ui/generalpage.ui diff --git a/src/generalpage.cpp b/src/generalpage.cpp new file mode 100644 index 0000000..1a4a255 --- /dev/null +++ b/src/generalpage.cpp @@ -0,0 +1,47 @@ +/* + * Copyright 2015 Luca Beltrame + * + * This file is part of Danbooru Client. + * + * Danbooru Client is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Danbooru Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Danbooru Client. If not, see . + */ + +#include "generalpage.h" + +#include +#include +#include + +#include "danboorusettings.h" + +static QLatin1String urlRegex("(http|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?"); + +namespace Danbooru { + +GeneralPage::GeneralPage(DanbooruSettings* preferences, QWidget* parent): QWidget(parent) +{ + setupUi(this); + kcfg_boards->insertStringList(preferences->boards()); + QRegularExpression regex(urlRegex); + QRegularExpressionValidator* validator = new QRegularExpressionValidator(regex); + kcfg_boards->lineEdit()->setValidator(validator); + +} + +GeneralPage::~GeneralPage() +{ +} + + +} // namespace Danbooru diff --git a/src/generalpage.h b/src/generalpage.h new file mode 100644 index 0000000..eb2c23c --- /dev/null +++ b/src/generalpage.h @@ -0,0 +1,40 @@ +/* + * Copyright 2015 Luca Beltrame + * + * This file is part of Danbooru Client. + * + * Danbooru Client is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Danbooru Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Danbooru Client. If not, see . + */ + +#ifndef DANBOORU_GENERALPAGE_H +#define DANBOORU_GENERALPAGE_H + +#include "ui_generalpage.h" + +namespace Danbooru { + +class DanbooruSettings; + +class GeneralPage: public QWidget, public Ui::GeneralPage { + +Q_OBJECT + +public: + explicit GeneralPage(DanbooruSettings* preferences, QWidget* parent=0); + ~GeneralPage(); + +}; + +} // namespace Danbooru +#endif \ No newline at end of file diff --git a/src/ui/generalpage.ui b/src/ui/generalpage.ui new file mode 100644 index 0000000..21eadeb --- /dev/null +++ b/src/ui/generalpage.ui @@ -0,0 +1,85 @@ + + + GeneralPage + + + + 0 + 0 + 501 + 637 + + + + + + + + + + Danbooru URls + + + + + + + + + + + + General settings + + + true + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 131 + 20 + + + + + + + + 1 + + + 100 + + + + + + + Default number of thumbnails to retrieve + + + + + + + + + + + KEditListWidget + QWidget +
keditlistwidget.h
+
+
+ + +