This commit is contained in:
Martin Rotter 2020-08-05 15:08:17 +02:00
parent 3a35c6c286
commit f21b2679ac
2 changed files with 18 additions and 11 deletions

View File

@ -51,9 +51,7 @@ FeedsModel::FeedsModel(QObject* parent) : QAbstractItemModel(parent), m_itemHeig
} }
FeedsModel::~FeedsModel() { FeedsModel::~FeedsModel() {
qDebug("Destroying FeedsModel instance."); qDebugNN << LOGSEC_FEEDMODEL << "Destroying FeedsModel instance.";
// Delete all model items.
delete m_rootItem; delete m_rootItem;
} }
@ -83,15 +81,15 @@ QStringList FeedsModel::mimeTypes() const {
return QStringList() << QSL(MIME_TYPE_ITEM_POINTER); return QStringList() << QSL(MIME_TYPE_ITEM_POINTER);
} }
bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row,
const QModelIndex& parent) { int column, const QModelIndex& parent) {
Q_UNUSED(row) Q_UNUSED(row)
Q_UNUSED(column) Q_UNUSED(column)
if (action == Qt::IgnoreAction) { if (action == Qt::DropAction::IgnoreAction) {
return true; return true;
} }
else if (action != Qt::MoveAction) { else if (action != Qt::DropAction::MoveAction) {
return false; return false;
} }
@ -124,7 +122,8 @@ bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
QSystemTrayIcon::Warning, QSystemTrayIcon::Warning,
qApp->mainFormWidget(), qApp->mainFormWidget(),
true); true);
qDebug("Dragged item cannot be dragged into different account. Cancelling drag-drop action."); qDebugNN << LOGSEC_FEEDMODEL
<< "Dragged item cannot be dragged into different account. Cancelling drag-drop action.";
return false; return false;
} }
@ -367,7 +366,8 @@ QList<Message> FeedsModel::messagesForItem(RootItem* item) const {
} }
int FeedsModel::columnCount(const QModelIndex& parent) const { int FeedsModel::columnCount(const QModelIndex& parent) const {
Q_UNUSED(parent) return FEEDS_VIEW_COLUMN_COUNT; Q_UNUSED(parent)
return FEEDS_VIEW_COLUMN_COUNT;
} }
RootItem* FeedsModel::itemForIndex(const QModelIndex& index) const { RootItem* FeedsModel::itemForIndex(const QModelIndex& index) const {
@ -443,11 +443,17 @@ void FeedsModel::notifyWithCounts() {
void FeedsModel::onItemDataChanged(const QList<RootItem*>& items) { void FeedsModel::onItemDataChanged(const QList<RootItem*>& items) {
if (items.size() > RELOAD_MODEL_BORDER_NUM) { if (items.size() > RELOAD_MODEL_BORDER_NUM) {
qDebug("There is request to reload feed model for more than %d items, reloading model fully.", RELOAD_MODEL_BORDER_NUM); qDebugNN << LOGSEC_FEEDMODEL
<< "There is request to reload feed model for more than "
<< RELOAD_MODEL_BORDER_NUM
<< " items, reloading model fully.";
reloadWholeLayout(); reloadWholeLayout();
} }
else { else {
qDebug("There is request to reload feed model, reloading the %d items individually.", items.size()); qDebugNN << LOGSEC_FEEDMODEL
<< "There is request to reload feed model, reloading the "
<< items.size()
<< " items individually.";
for (RootItem* item : items) { for (RootItem* item : items) {
reloadChangedItem(item); reloadChangedItem(item);

View File

@ -82,6 +82,7 @@
#define HTTP_HEADERS_AUTHORIZATION "Authorization" #define HTTP_HEADERS_AUTHORIZATION "Authorization"
#define HTTP_HEADERS_USER_AGENT "User-Agent" #define HTTP_HEADERS_USER_AGENT "User-Agent"
#define LOGSEC_FEEDMODEL "feed-model: "
#define LOGSEC_FEEDDOWNLOADER "feed-downloader: " #define LOGSEC_FEEDDOWNLOADER "feed-downloader: "
#define MAX_ZOOM_FACTOR 5.0f #define MAX_ZOOM_FACTOR 5.0f