Stick to astlye, refacatoring.
This commit is contained in:
parent
dedf70a8a9
commit
b0ff27c232
14 changed files with 423 additions and 2348 deletions
|
|
@ -28,7 +28,16 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ASTYLE_CMD="astyle"
|
ASTYLE_CMD="astyle"
|
||||||
ASTYLE_RC="$(dirname $0)/.astylerc"
|
|
||||||
|
if [[ "$(uname -o)" == "Cygwin" ]]; then
|
||||||
|
ASTYLE_RC="$(cygpath -w $(realpath $(dirname $0)))/.astylerc"
|
||||||
|
else
|
||||||
|
ASTYLE_RC="$(realpath $(dirname $0))/.astylerc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ASTYLE_RC="$(cygpath -w $(realpath $(dirname $0)))/.astylerc"
|
||||||
|
|
||||||
|
echo "ASTYLE config file: $ASTYLE_RC"
|
||||||
|
|
||||||
# Check all args.
|
# Check all args.
|
||||||
for dir in "$@"; do
|
for dir in "$@"; do
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -66,7 +66,7 @@ QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
||||||
QByteArray encoded_data;
|
QByteArray encoded_data;
|
||||||
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, indexes) {
|
foreach (const QModelIndex& index, indexes) {
|
||||||
if (index.column() != 0) {
|
if (index.column() != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
||||||
RootItem* item_for_index = itemForIndex(index);
|
RootItem* item_for_index = itemForIndex(index);
|
||||||
|
|
||||||
if (item_for_index->kind() != RootItemKind::Root) {
|
if (item_for_index->kind() != RootItemKind::Root) {
|
||||||
stream << (quintptr)item_for_index;
|
stream << (quintptr) item_for_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
|
||||||
quintptr pointer_to_item;
|
quintptr pointer_to_item;
|
||||||
stream >> pointer_to_item;
|
stream >> pointer_to_item;
|
||||||
// We have item we want to drag, we also determine the target item.
|
// We have item we want to drag, we also determine the target item.
|
||||||
RootItem* dragged_item = (RootItem*)pointer_to_item;
|
RootItem* dragged_item = (RootItem*) pointer_to_item;
|
||||||
RootItem* target_item = itemForIndex(parent);
|
RootItem* target_item = itemForIndex(parent);
|
||||||
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
||||||
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
||||||
|
|
@ -288,8 +288,8 @@ void FeedsModel::reassignNodeToNewParent(RootItem* original_node, RootItem* new_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceRoot*> FeedsModel::serviceRoots() const {
|
QList<ServiceRoot*>FeedsModel::serviceRoots() const {
|
||||||
QList<ServiceRoot*> roots;
|
QList<ServiceRoot*>roots;
|
||||||
|
|
||||||
foreach (RootItem* root, m_rootItem->childItems()) {
|
foreach (RootItem* root, m_rootItem->childItems()) {
|
||||||
if (root->kind() == RootItemKind::ServiceRoot) {
|
if (root->kind() == RootItemKind::ServiceRoot) {
|
||||||
|
|
@ -322,8 +322,8 @@ StandardServiceRoot* FeedsModel::standardServiceRoot() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Feed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
|
QList<Feed*>FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
|
||||||
QList<Feed*> feeds_for_update;
|
QList<Feed*>feeds_for_update;
|
||||||
|
|
||||||
foreach (Feed* feed, m_rootItem->getSubTreeFeeds()) {
|
foreach (Feed* feed, m_rootItem->getSubTreeFeeds()) {
|
||||||
switch (feed->autoUpdateType()) {
|
switch (feed->autoUpdateType()) {
|
||||||
|
|
@ -361,7 +361,7 @@ QList<Feed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
|
||||||
return feeds_for_update;
|
return feeds_for_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> FeedsModel::messagesForItem(RootItem* item) const {
|
QList<Message>FeedsModel::messagesForItem(RootItem* item) const {
|
||||||
return item->undeletedMessages();
|
return item->undeletedMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -385,7 +385,7 @@ QModelIndex FeedsModel::indexForItem(const RootItem* item) const {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStack<const RootItem*> chain;
|
QStack<const RootItem*>chain;
|
||||||
|
|
||||||
while (item->kind() != RootItemKind::Root) {
|
while (item->kind() != RootItemKind::Root) {
|
||||||
chain.push(item);
|
chain.push(item);
|
||||||
|
|
@ -405,7 +405,7 @@ QModelIndex FeedsModel::indexForItem(const RootItem* item) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FeedsModel::hasAnyFeedNewMessages() const {
|
bool FeedsModel::hasAnyFeedNewMessages() const {
|
||||||
foreach (const Feed * feed, m_rootItem->getSubTreeFeeds()) {
|
foreach (const Feed* feed, m_rootItem->getSubTreeFeeds()) {
|
||||||
if (feed->status() == Feed::NewMessages) {
|
if (feed->status() == Feed::NewMessages) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -448,7 +448,7 @@ void FeedsModel::onItemDataChanged(const QList<RootItem*>& items) {
|
||||||
else {
|
else {
|
||||||
qDebug("There is request to reload feed model, reloading the %d items individually.", items.size());
|
qDebug("There is request to reload feed model, reloading the %d items individually.", items.size());
|
||||||
|
|
||||||
foreach (RootItem * item, items) {
|
foreach (RootItem* item, items) {
|
||||||
reloadChangedItem(item);
|
reloadChangedItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -480,7 +480,7 @@ bool FeedsModel::addServiceAccount(ServiceRoot* root, bool freshly_activated) {
|
||||||
bool FeedsModel::restoreAllBins() {
|
bool FeedsModel::restoreAllBins() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
foreach (ServiceRoot * root, serviceRoots()) {
|
foreach (ServiceRoot* root, serviceRoots()) {
|
||||||
RecycleBin* bin_of_root = root->recycleBin();
|
RecycleBin* bin_of_root = root->recycleBin();
|
||||||
|
|
||||||
if (bin_of_root != nullptr) {
|
if (bin_of_root != nullptr) {
|
||||||
|
|
@ -494,7 +494,7 @@ bool FeedsModel::restoreAllBins() {
|
||||||
bool FeedsModel::emptyAllBins() {
|
bool FeedsModel::emptyAllBins() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
foreach (ServiceRoot * root, serviceRoots()) {
|
foreach (ServiceRoot* root, serviceRoots()) {
|
||||||
RecycleBin* bin_of_root = root->recycleBin();
|
RecycleBin* bin_of_root = root->recycleBin();
|
||||||
|
|
||||||
if (bin_of_root != nullptr) {
|
if (bin_of_root != nullptr) {
|
||||||
|
|
@ -509,7 +509,7 @@ void FeedsModel::loadActivatedServiceAccounts() {
|
||||||
// Iterate all globally available feed "service plugins".
|
// Iterate all globally available feed "service plugins".
|
||||||
foreach (const ServiceEntryPoint* entry_point, qApp->feedReader()->feedServices()) {
|
foreach (const ServiceEntryPoint* entry_point, qApp->feedReader()->feedServices()) {
|
||||||
// Load all stored root nodes from the entry point and add those to the model.
|
// Load all stored root nodes from the entry point and add those to the model.
|
||||||
QList<ServiceRoot*> roots = entry_point->initializeSubtree();
|
QList<ServiceRoot*>roots = entry_point->initializeSubtree();
|
||||||
|
|
||||||
foreach (ServiceRoot* root, roots) {
|
foreach (ServiceRoot* root, roots) {
|
||||||
addServiceAccount(root, false);
|
addServiceAccount(root, false);
|
||||||
|
|
@ -524,12 +524,12 @@ void FeedsModel::loadActivatedServiceAccounts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::stopServiceAccounts() {
|
void FeedsModel::stopServiceAccounts() {
|
||||||
foreach (ServiceRoot * account, serviceRoots()) {
|
foreach (ServiceRoot* account, serviceRoots()) {
|
||||||
account->stop();
|
account->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Feed*> FeedsModel::feedsForIndex(const QModelIndex& index) const {
|
QList<Feed*>FeedsModel::feedsForIndex(const QModelIndex& index) const {
|
||||||
return itemForIndex(index)->getSubTreeFeeds();
|
return itemForIndex(index)->getSubTreeFeeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
// Returns all activated service roots.
|
// Returns all activated service roots.
|
||||||
// NOTE: Service root nodes are lying directly UNDER
|
// NOTE: Service root nodes are lying directly UNDER
|
||||||
// the model root item.
|
// the model root item.
|
||||||
QList<ServiceRoot*> serviceRoots() const;
|
QList<ServiceRoot*>serviceRoots() const;
|
||||||
|
|
||||||
// Determines if there is any account activated from given entry point.
|
// Determines if there is any account activated from given entry point.
|
||||||
bool containsServiceRootFromEntryPoint(const ServiceEntryPoint* point) const;
|
bool containsServiceRootFromEntryPoint(const ServiceEntryPoint* point) const;
|
||||||
|
|
@ -79,15 +79,15 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
// so feeds with "default" auto-update strategy should be updated.
|
// so feeds with "default" auto-update strategy should be updated.
|
||||||
//
|
//
|
||||||
// This method might change some properties of some feeds.
|
// This method might change some properties of some feeds.
|
||||||
QList<Feed*> feedsForScheduledUpdate(bool auto_update_now);
|
QList<Feed*>feedsForScheduledUpdate(bool auto_update_now);
|
||||||
|
|
||||||
// Returns (undeleted) messages for given feeds.
|
// Returns (undeleted) messages for given feeds.
|
||||||
// This is usually used for displaying whole feeds
|
// This is usually used for displaying whole feeds
|
||||||
// in "newspaper" mode.
|
// in "newspaper" mode.
|
||||||
QList<Message> messagesForItem(RootItem* item) const;
|
QList<Message>messagesForItem(RootItem* item) const;
|
||||||
|
|
||||||
// Returns ALL RECURSIVE CHILD feeds contained within single index.
|
// Returns ALL RECURSIVE CHILD feeds contained within single index.
|
||||||
QList<Feed*> feedsForIndex(const QModelIndex& index) const;
|
QList<Feed*>feedsForIndex(const QModelIndex& index) const;
|
||||||
|
|
||||||
// Returns feed/category which lies at the specified index or
|
// Returns feed/category which lies at the specified index or
|
||||||
// root item if index is invalid.
|
// root item if index is invalid.
|
||||||
|
|
@ -159,7 +159,7 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
void messageCountsChanged(int unread_messages, bool any_feed_has_unread_messages);
|
void messageCountsChanged(int unread_messages, bool any_feed_has_unread_messages);
|
||||||
|
|
||||||
// Emitted if any item requested that any view should expand it.
|
// Emitted if any item requested that any view should expand it.
|
||||||
void itemExpandRequested(QList<RootItem*> items, bool expand);
|
void itemExpandRequested(QList<RootItem*>items, bool expand);
|
||||||
|
|
||||||
// Emitted if any item requested that its expand states should be explicitly saved.
|
// Emitted if any item requested that its expand states should be explicitly saved.
|
||||||
// NOTE: Normally expand states are saved when application quits.
|
// NOTE: Normally expand states are saved when application quits.
|
||||||
|
|
@ -174,8 +174,8 @@ class FeedsModel : public QAbstractItemModel {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RootItem* m_rootItem;
|
RootItem* m_rootItem;
|
||||||
QList<QString> m_headerData;
|
QList<QString>m_headerData;
|
||||||
QList<QString> m_tooltipData;
|
QList<QString>m_tooltipData;
|
||||||
QIcon m_countsIcon;
|
QIcon m_countsIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
#define ID_RECYCLE_BIN -2
|
#define ID_RECYCLE_BIN -2
|
||||||
#define TRAY_ICON_BUBBLE_TIMEOUT 20000
|
#define TRAY_ICON_BUBBLE_TIMEOUT 20000
|
||||||
#define CLOSE_LOCK_TIMEOUT 500
|
#define CLOSE_LOCK_TIMEOUT 500
|
||||||
#define DOWNLOAD_TIMEOUT 5000
|
#define DOWNLOAD_TIMEOUT 15000
|
||||||
#define MESSAGES_VIEW_DEFAULT_COL 170
|
#define MESSAGES_VIEW_DEFAULT_COL 170
|
||||||
#define MESSAGES_VIEW_MINIMUM_COL 36
|
#define MESSAGES_VIEW_MINIMUM_COL 36
|
||||||
#define FEEDS_VIEW_COLUMN_COUNT 2
|
#define FEEDS_VIEW_COLUMN_COUNT 2
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>45000</number>
|
<number>120000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
class UpdateUrl {
|
class UpdateUrl {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QString m_fileUrl;
|
QString m_fileUrl;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_size;
|
QString m_size;
|
||||||
|
|
@ -37,10 +38,12 @@ class UpdateUrl {
|
||||||
|
|
||||||
class UpdateInfo {
|
class UpdateInfo {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QString m_availableVersion;
|
QString m_availableVersion;
|
||||||
QString m_changes;
|
QString m_changes;
|
||||||
QList<UpdateUrl> m_urls;
|
|
||||||
QDateTime m_date;
|
QDateTime m_date;
|
||||||
|
|
||||||
|
QList<UpdateUrl> m_urls;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(UpdateInfo)
|
Q_DECLARE_METATYPE(UpdateInfo)
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ OwnCloudGetFeedsCategoriesResponse::~OwnCloudGetFeedsCategoriesResponse() {
|
||||||
|
|
||||||
RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) const {
|
RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) const {
|
||||||
RootItem* parent = new RootItem();
|
RootItem* parent = new RootItem();
|
||||||
QMap<int, RootItem*> cats;
|
QMap<int, RootItem*>cats;
|
||||||
cats.insert(0, parent);
|
cats.insert(0, parent);
|
||||||
|
|
||||||
// Process categories first, then process feeds.
|
// Process categories first, then process feeds.
|
||||||
|
|
@ -535,8 +535,8 @@ OwnCloudGetMessagesResponse::OwnCloudGetMessagesResponse(const QString& raw_cont
|
||||||
OwnCloudGetMessagesResponse::~OwnCloudGetMessagesResponse() {
|
OwnCloudGetMessagesResponse::~OwnCloudGetMessagesResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> OwnCloudGetMessagesResponse::messages() const {
|
QList<Message>OwnCloudGetMessagesResponse::messages() const {
|
||||||
QList<Message> msgs;
|
QList<Message>msgs;
|
||||||
|
|
||||||
foreach (const QJsonValue& message, m_rawContent["items"].toArray()) {
|
foreach (const QJsonValue& message, m_rawContent["items"].toArray()) {
|
||||||
QJsonObject message_map = message.toObject();
|
QJsonObject message_map = message.toObject();
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ void StandardServiceRoot::loadFromDatabase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandardServiceRoot::checkArgumentsForFeedAdding() {
|
void StandardServiceRoot::checkArgumentsForFeedAdding() {
|
||||||
foreach (const QString &arg, qApp->arguments().mid(1)) {
|
foreach (const QString& arg, qApp->arguments().mid(1)) {
|
||||||
checkArgumentForFeedAdding(arg);
|
checkArgumentForFeedAdding(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue