Started to work on #16.

This commit is contained in:
Martin Rotter 2016-07-25 09:47:16 +02:00
parent c439d734a3
commit aa04571eee
7 changed files with 196 additions and 8 deletions

View File

@ -266,7 +266,9 @@ HEADERS += src/core/feeddownloader.h \
src/network-web/webpage.h \
src/gui/locationlineedit.h \
src/network-web/googlesuggest.h \
src/gui/discoverfeedsbutton.h
src/gui/discoverfeedsbutton.h \
src/gui/settings/settingspanel.h \
src/gui/settings/settingsgeneral.h
SOURCES += src/core/feeddownloader.cpp \
src/core/feedsmodel.cpp \
@ -377,7 +379,9 @@ SOURCES += src/core/feeddownloader.cpp \
src/network-web/webpage.cpp \
src/gui/locationlineedit.cpp \
src/network-web/googlesuggest.cpp \
src/gui/discoverfeedsbutton.cpp
src/gui/discoverfeedsbutton.cpp \
src/gui/settings/settingspanel.cpp \
src/gui/settings/settingsgeneral.cpp
FORMS += \
src/gui/toolbareditor.ui \
@ -395,7 +399,8 @@ FORMS += \
src/services/owncloud/gui/formeditowncloudaccount.ui \
src/services/standard/gui/formstandardcategorydetails.ui \
src/services/standard/gui/formstandardimportexport.ui \
src/services/tt-rss/gui/formeditaccount.ui
src/services/tt-rss/gui/formeditaccount.ui \
src/gui/settings/settingsgeneral.ui
TRANSLATIONS += localization/qtbase-cs.ts \
localization/qtbase-da.ts \

View File

@ -88,7 +88,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5">
@ -417,8 +417,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>742</width>
<height>451</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -495,8 +495,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>742</width>
<height>426</height>
<width>736</width>
<height>425</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">

View File

@ -0,0 +1,12 @@
#include "gui/settings/settingsgeneral.h"
SettingsGeneral::SettingsGeneral(Settings *settings, QWidget *parent)
: SettingsPanel(settings, parent), m_ui(new Ui::SettingsGeneral) {
m_ui->setupUi(this);
m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text().arg(APP_NAME));
}
SettingsGeneral::~SettingsGeneral() {
delete m_ui;
}

View File

@ -0,0 +1,20 @@
#ifndef SETTINGSGENERAL_H
#define SETTINGSGENERAL_H
#include "gui/settings/settingspanel.h"
#include "ui_settingsgeneral.h"
class SettingsGeneral : public SettingsPanel {
Q_OBJECT
public:
explicit SettingsGeneral(Settings *settings, QWidget *parent = 0);
virtual ~SettingsGeneral();
private:
Ui::SettingsGeneral *m_ui;
};
#endif // SETTINGSGENERAL_H

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsGeneral</class>
<widget class="QWidget" name="SettingsGeneral">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<height>148</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="m_checkAutostart">
<property name="text">
<string>Launch %1 on operating system startup</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_checkForUpdatesOnStart">
<property name="text">
<string>Check for updates on application startup</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkRemoveTrolltechJunk">
<property name="text">
<string>Remove junk Trolltech registry key (HKCU\Software\Trolltech) when application quits (Use at your own risk!)</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,46 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard 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.
//
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#include "gui/settings/settingspanel.h"
#include "miscellaneous/settings.h"
SettingsPanel::SettingsPanel(Settings *settings, QWidget *parent) : QWidget(parent) {
}
void SettingsPanel::loadSettings() {
setIsDirty(false);
}
void SettingsPanel::saveSettings() {
setIsDirty(false);
}
void SettingsPanel::dirtifySettings() {
setIsDirty(true);
emit settingsChanged();
}
bool SettingsPanel::isDirty() const {
return m_isDirty;
}
void SettingsPanel::setIsDirty(bool is_dirty) {
m_isDirty = is_dirty;
}

View File

@ -0,0 +1,51 @@
// This file is part of RSS Guard.
//
// Copyright (C) 2011-2016 by Martin Rotter <rotter.martinos@gmail.com>
//
// RSS Guard 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.
//
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
#ifndef SETTINGSPANEL_H
#define SETTINGSPANEL_H
#include <QWidget>
class Settings;
class SettingsPanel : public QWidget {
Q_OBJECT
public:
explicit SettingsPanel(Settings *settings, QWidget *parent = 0);
virtual void loadSettings();
virtual void saveSettings();
protected:
// Sets this settings panel as dirty (some settings are changed) and emits the signal.
void dirtifySettings();
// These methods should not be probably called by subclasses.
bool isDirty() const;
void setIsDirty(bool is_dirty);
signals:
void settingsChanged();
private:
bool m_isDirty;
};
#endif // SETTINGSPANEL_H