Basic general page configuration
This commit is contained in:
		
					parent
					
						
							
								9620581a2f
							
						
					
				
			
			
				commit
				
					
						348f5ea0f1
					
				
			
		
					 3 changed files with 172 additions and 0 deletions
				
			
		
							
								
								
									
										47
									
								
								src/generalpage.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/generalpage.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright 2015 Luca Beltrame <lbeltrame@kde.org>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 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 <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "generalpage.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QRegularExpression>
 | 
				
			||||||
 | 
					#include <QRegularExpressionValidator>
 | 
				
			||||||
 | 
					#include <QLineEdit>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#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
 | 
				
			||||||
							
								
								
									
										40
									
								
								src/generalpage.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/generalpage.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,40 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright 2015 Luca Beltrame <lbeltrame@kde.org>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 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 <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#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
 | 
				
			||||||
							
								
								
									
										85
									
								
								src/ui/generalpage.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								src/ui/generalpage.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,85 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<ui version="4.0">
 | 
				
			||||||
 | 
					 <class>GeneralPage</class>
 | 
				
			||||||
 | 
					 <widget class="QWidget" name="GeneralPage">
 | 
				
			||||||
 | 
					  <property name="geometry">
 | 
				
			||||||
 | 
					   <rect>
 | 
				
			||||||
 | 
					    <x>0</x>
 | 
				
			||||||
 | 
					    <y>0</y>
 | 
				
			||||||
 | 
					    <width>501</width>
 | 
				
			||||||
 | 
					    <height>637</height>
 | 
				
			||||||
 | 
					   </rect>
 | 
				
			||||||
 | 
					  </property>
 | 
				
			||||||
 | 
					  <property name="windowTitle">
 | 
				
			||||||
 | 
					   <string/>
 | 
				
			||||||
 | 
					  </property>
 | 
				
			||||||
 | 
					  <layout class="QVBoxLayout" name="verticalLayout">
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <widget class="QGroupBox" name="urlGroupBox">
 | 
				
			||||||
 | 
					     <property name="title">
 | 
				
			||||||
 | 
					      <string>Danbooru URls</string>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <layout class="QGridLayout" name="gridLayout_2">
 | 
				
			||||||
 | 
					      <item row="0" column="0">
 | 
				
			||||||
 | 
					       <widget class="KEditListWidget" name="kcfg_boards"/>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					     </layout>
 | 
				
			||||||
 | 
					    </widget>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <widget class="QGroupBox" name="groupBox">
 | 
				
			||||||
 | 
					     <property name="title">
 | 
				
			||||||
 | 
					      <string>General settings</string>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <property name="flat">
 | 
				
			||||||
 | 
					      <bool>true</bool>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <layout class="QGridLayout" name="gridLayout">
 | 
				
			||||||
 | 
					      <item row="0" column="3">
 | 
				
			||||||
 | 
					       <spacer name="horizontalSpacer">
 | 
				
			||||||
 | 
					        <property name="orientation">
 | 
				
			||||||
 | 
					         <enum>Qt::Horizontal</enum>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					        <property name="sizeType">
 | 
				
			||||||
 | 
					         <enum>QSizePolicy::Fixed</enum>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					        <property name="sizeHint" stdset="0">
 | 
				
			||||||
 | 
					         <size>
 | 
				
			||||||
 | 
					          <width>131</width>
 | 
				
			||||||
 | 
					          <height>20</height>
 | 
				
			||||||
 | 
					         </size>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </spacer>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item row="0" column="1">
 | 
				
			||||||
 | 
					       <widget class="QSpinBox" name="kcfg_maxPosts">
 | 
				
			||||||
 | 
					        <property name="minimum">
 | 
				
			||||||
 | 
					         <number>1</number>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					        <property name="maximum">
 | 
				
			||||||
 | 
					         <number>100</number>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </widget>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item row="0" column="0">
 | 
				
			||||||
 | 
					       <widget class="QLabel" name="thumbnalLabel">
 | 
				
			||||||
 | 
					        <property name="text">
 | 
				
			||||||
 | 
					         <string>Default number of thumbnails to retrieve</string>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </widget>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					     </layout>
 | 
				
			||||||
 | 
					    </widget>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					  </layout>
 | 
				
			||||||
 | 
					 </widget>
 | 
				
			||||||
 | 
					 <customwidgets>
 | 
				
			||||||
 | 
					  <customwidget>
 | 
				
			||||||
 | 
					   <class>KEditListWidget</class>
 | 
				
			||||||
 | 
					   <extends>QWidget</extends>
 | 
				
			||||||
 | 
					   <header>keditlistwidget.h</header>
 | 
				
			||||||
 | 
					  </customwidget>
 | 
				
			||||||
 | 
					 </customwidgets>
 | 
				
			||||||
 | 
					 <resources/>
 | 
				
			||||||
 | 
					 <connections/>
 | 
				
			||||||
 | 
					</ui>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue