Added many initial implementations.

This commit is contained in:
Martin Rotter 2013-12-11 14:07:18 +01:00
parent 7825f6150a
commit 5e470be83c
21 changed files with 229 additions and 11 deletions

View File

@ -13,10 +13,16 @@
# "-DCMAKE_INSTALL_PREFIX=/usr"
# Installation path, replace with something like "C:\rssguard" on Windows.
#
# "-DUSE_QT_5=ON"
# "-DUSE_QT_5=OFF"
# Specifies which major Qt version to use. Qt 4 and Qt 5 are supported.
# If "OFF" is passed as an argument, then Qt 4 is used. Default is "OFF".
#
# "-DBUNDLE_ICON_THEMES=ON"
# If "ON", then custom icons theme(s) will be bundled with application
# installation. If "OFF", then no icon theme(s) will be available for
# the application and application will run in iconless mode.
# Default and recommended value is "ON".
#
# Other information:
# - supports Windows, Linux, OS/2 (eComStation),
# - Qt 4.7.3 and higher is required,
@ -35,7 +41,7 @@ cmake_minimum_required(VERSION 2.8.11)
project(rssguard)
set(APP_NAME "RSS Guard")
set(APP_LOW_NAME "rssguard")
set(APP_VERSION "2.0.0-prealpha-3")
set(APP_VERSION "2.0.0-prealpha-4")
set(FILE_VERSION "2,0,0,0")
set(APP_AUTHOR "Martin Rotter")
set(APP_URL "http://rssguard.sf.net")
@ -77,6 +83,7 @@ message(STATUS "[${APP_LOW_NAME}] Obtaining revision number.")
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
# TODO: https://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines#Git
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
@ -262,6 +269,11 @@ set(APP_SOURCES
src/core/messagesproxymodel.cpp
src/core/feedsmodel.cpp
src/core/feedsproxymodel.cpp
src/core/basefeedsmodelitem.cpp
src/core/basefeedsmodelcategory.cpp
src/core/feedsmodelrootitem.cpp
src/core/feedsmodelnonrootitem.cpp
src/core/feedsmodelfeed.cpp
# Basic application sources.
src/main.cpp

View File

@ -11,10 +11,14 @@ DROP TABLE IF EXISTS Categories;
-- !
CREATE TABLE IF NOT EXISTS Categories (
id INTEGER PRIMARY KEY,
parent_id INTEGER NOT NULL,
title TEXT NOT NULL UNIQUE CHECK (title != ''),
description TEXT,
date_created TEXT NOT NULL CHECK (date_created != ''),
icon BLOB
icon BLOB,
type INTEGER NOT NULL,
FOREIGN KEY (parent_id) REFERENCES Categories (id)
);
-- !
DROP TABLE IF EXISTS Feeds;

View File

@ -0,0 +1,10 @@
#include "core/basefeedsmodelcategory.h"
BaseFeedsModelCategory::BaseFeedsModelCategory(BaseFeedsModelItem *parent_item)
: FeedsModelNonRootItem(parent_item) {
}
BaseFeedsModelCategory::~BaseFeedsModelCategory() {
qDebug("Destroying BaseFeedsModelCategory instance.");
}

View File

@ -0,0 +1,18 @@
#ifndef FEEDSMODELCLASSICCATEGORY_H
#define FEEDSMODELCLASSICCATEGORY_H
#include "core/feedsmodelnonrootitem.h"
// Base class for all categories contained in FeedsModel.
// NOTE: This class is derived to create PARTICULAR category types.
class BaseFeedsModelCategory : public FeedsModelNonRootItem
{
public:
// Constructors and destructors
explicit BaseFeedsModelCategory(BaseFeedsModelItem *parent_item);
virtual ~BaseFeedsModelCategory();
};
#endif // FEEDSMODELCLASSICCATEGORY_H

View File

@ -0,0 +1,11 @@
#include <QDebug>
#include "core/basefeedsmodelitem.h"
BaseFeedsModelItem::BaseFeedsModelItem() {
}
BaseFeedsModelItem::~BaseFeedsModelItem() {
qDebug("Destroying BaseFeedsModelItem instance.");
}

View File

@ -0,0 +1,26 @@
#ifndef BASEFEEDSMODELITEM_H
#define BASEFEEDSMODELITEM_H
#include <QList>
#include <QIcon>
// Base class for all items contained in FeedsModel.
class BaseFeedsModelItem {
public:
// Constructors and destructors.
explicit BaseFeedsModelItem();
virtual ~BaseFeedsModelItem();
// Returns parent item of this item.
// NOTE: Model ROOT item has NULL parent.
virtual BaseFeedsModelItem *parent() = 0;
virtual int childCount() const = 0;
virtual int columnCount() const = 0;
protected:
QIcon m_icon;
};
#endif // BASEFEEDSMODELITEM_H

View File

@ -3,3 +3,7 @@
FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) {
}
FeedsModel::~FeedsModel() {
qDebug("Destroying FeedsModel instance.");
}

View File

@ -9,6 +9,7 @@ class FeedsModel : public QAbstractItemModel {
public:
explicit FeedsModel(QObject *parent = 0);
virtual ~FeedsModel();
signals:

View File

@ -0,0 +1,10 @@
#include "core/feedsmodelfeed.h"
FeedsModelFeed::FeedsModelFeed(BaseFeedsModelItem *parent_item)
:FeedsModelNonRootItem(parent_item) {
}
FeedsModelFeed::~FeedsModelFeed() {
qDebug("Destroying FeedsModelFeed instance.");
}

17
src/core/feedsmodelfeed.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef FEEDSMODELFEED_H
#define FEEDSMODELFEED_H
#include "core/feedsmodelnonrootitem.h"
// Represents BASE class for feeds contained in FeedsModel.
// NOTE: This class is derived to create PARTICULAR feed types.
class FeedsModelFeed : public FeedsModelNonRootItem
{
public:
// Constructors and destructors.
explicit FeedsModelFeed(BaseFeedsModelItem *parent_item);
virtual ~FeedsModelFeed();
};
#endif // FEEDSMODELFEED_H

View File

@ -0,0 +1,14 @@
#include "core/feedsmodelnonrootitem.h"
FeedsModelNonRootItem::FeedsModelNonRootItem(BaseFeedsModelItem *parent_item)
: FeedsModelRootItem(), m_parentItem(parent_item) {
}
FeedsModelNonRootItem::~FeedsModelNonRootItem() {
qDebug("Destroying FeedsModelNonRootItem instance.");
}
BaseFeedsModelItem *FeedsModelNonRootItem::parent() {
return m_parentItem;
}

View File

@ -0,0 +1,22 @@
#ifndef FEEDSMODELNONROOTITEM_H
#define FEEDSMODELNONROOTITEM_H
#include "core/feedsmodelrootitem.h"
// Base class for non-root items of FeedsModel.
// NOTE: This class add member for pointer to parent item (which is not needed
// for root item).
class FeedsModelNonRootItem : public FeedsModelRootItem {
public:
// Constructors and destructors.
explicit FeedsModelNonRootItem(BaseFeedsModelItem *parent_item);
virtual ~FeedsModelNonRootItem();
BaseFeedsModelItem *parent();
protected:
BaseFeedsModelItem *m_parentItem;
};
#endif // FEEDSMODELNONROOTITEM_H

View File

@ -0,0 +1,23 @@
#include "core/feedsmodelrootitem.h"
FeedsModelRootItem::FeedsModelRootItem()
: BaseFeedsModelItem() {
}
FeedsModelRootItem::~FeedsModelRootItem() {
qDebug("Destroying FeedsModelRootItem instance.");
qDeleteAll(m_childItems);
}
BaseFeedsModelItem *FeedsModelRootItem::parent() {
return NULL;
}
int FeedsModelRootItem::columnCount() const {
return 2;
}
int FeedsModelRootItem::childCount() const {
return m_childItems.count();
}

View File

@ -0,0 +1,25 @@
#ifndef FEEDMODELROOTITEM_H
#define FEEDMODELROOTITEM_H
#include "core/basefeedsmodelitem.h"
// Represents ROOT item of FeedsModel.
// NOTE: This class is derived to add functionality for
// all non-root items of FeedsModel.
class FeedsModelRootItem : public BaseFeedsModelItem {
public:
// Constructors and destructors.
explicit FeedsModelRootItem();
virtual ~FeedsModelRootItem();
BaseFeedsModelItem *parent();
int childCount() const;
int columnCount() const;
protected:
QList<BaseFeedsModelItem*> m_childItems;
};
#endif // FEEDMODELROOTITEM_H

View File

@ -4,3 +4,7 @@
FeedsProxyModel::FeedsProxyModel(QObject *parent)
: QSortFilterProxyModel(parent) {
}
FeedsProxyModel::~FeedsProxyModel() {
qDebug("Destroying FeedsProxyModel instance");
}

View File

@ -9,6 +9,7 @@ class FeedsProxyModel : public QSortFilterProxyModel {
public:
explicit FeedsProxyModel(QObject *parent = 0);
virtual ~FeedsProxyModel();
signals:

View File

@ -126,13 +126,7 @@ void FormSettings::changeBrowserProgressColor() {
void FormSettings::loadFeedsMessages() {
Settings *settings = Settings::getInstance();
// TODO: dodělat
m_ui->m_cmbExternalBrowserPreset->addItem("Chromium", "aa %1");
m_ui->m_cmbExternalBrowserPreset->addItem("Mozilla Firefox", "aa %1");
m_ui->m_cmbExternalBrowserPreset->addItem("Safari", "aa %1");
m_ui->m_cmbExternalBrowserPreset->addItem("Microsoft Internet Explorer", "aa %1");
m_ui->m_cmbExternalBrowserPreset->addItem("Opera 12 or older", "-nosession %1");
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older)", "-nosession %1"));
m_ui->m_txtExternalBrowserExecutable->setText(settings->value(APP_CFG_MESSAGES,
"external_browser_executable").toString());
m_ui->m_txtExternalBrowserArguments->setText(settings->value(APP_CFG_MESSAGES,

View File

@ -715,7 +715,7 @@
<item>
<widget class="QComboBox" name="m_cmbExternalBrowserPreset">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">

View File

@ -23,6 +23,24 @@ TabBar::TabType TabBar::tabType(int index) {
return static_cast<TabBar::TabType>(tabData(index).value<int>());
}
void TabBar::wheelEvent(QWheelEvent *event) {
int current_index = currentIndex();
int number_of_tabs = count();
// Make sure rotating works.
if (number_of_tabs > 1) {
if (event->delta() > 0 && current_index == 0) {
setCurrentIndex(number_of_tabs - 1);
}
else if (event->delta() < 0 && current_index == number_of_tabs - 1) {
setCurrentIndex(0);
}
}
else {
QTabBar::wheelEvent(event);
}
}
void TabBar::mousePressEvent(QMouseEvent *event) {
QTabBar::mousePressEvent(event);

View File

@ -26,6 +26,7 @@ class TabBar : public QTabBar {
// Reimplementations.
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
signals:
// Emmited if empty space on tab bar is double clicked.

View File

@ -172,11 +172,14 @@ void WebBrowser::clear() {
}
void WebBrowser::navigateToMessage(const Message &message) {
m_webView->setHtml(SkinFactory::getInstance()->getCurrentMarkup().arg(message.m_title,
tr("Written by ") + message.m_author,
message.m_url,
message.m_contents,
message.m_updated.toString(Qt::DefaultLocaleLongDate)));
emit iconChanged(m_index,
IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
}
void WebBrowser::updateZoomGui() {