Skip to content

Commit 2e839cf

Browse files
committed
fix regressions introduced in last commit
1 parent e88be93 commit 2e839cf

File tree

5 files changed

+28
-18
lines changed

5 files changed

+28
-18
lines changed

ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
6.1.4 23-November 2018
1+
6.1.4 26-November 2018
22
- fix potential config corruption. Thanks to @slackuser0xae34 for the patch
33
- fix segfault on thumbnail update (view may have changed since loading thumbnails)
44
- don't cut file(s) if moving to same directory in bookmarks
55
- verify reply from udisks (avoid crash)
66
- populate view if not watched
77
- fix refresh view
8+
- improved performance
89

910
6.1.3 07-October 2018
1011
- update grid on paste/remove

fm/src/mainwindow.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ MainWindow::MainWindow()
243243
show();
244244

245245
trashDir = Common::trashDir();
246+
ignoreReload = false;
246247

247248
QTimer::singleShot(0, this, SLOT(lateStart()));
248249
}
@@ -716,9 +717,15 @@ void MainWindow::updateDir()
716717

717718
void MainWindow::handleReloadDir(const QString &path)
718719
{
720+
if (ignoreReload) {
721+
qDebug() << "ignore reload";
722+
return;
723+
}
724+
ignoreReload = true;
719725
qDebug() << "handle reload dir" << path << modelList->getRootPath();
720726
if (path != modelList->getRootPath()) { return; }
721727
dirLoaded();
728+
QTimer::singleShot(500, this, SLOT(enableReload()));
722729
}
723730

724731
void MainWindow::thumbUpdate(const QString &path)
@@ -1549,7 +1556,7 @@ void MainWindow::refresh(bool modelRefresh, bool loadDir)
15491556
qDebug() << "refresh";
15501557
if (modelRefresh) {
15511558
modelList->refreshItems();
1552-
modelList->update();
1559+
modelList->forceRefresh();
15531560
}
15541561
QModelIndex baseIndex = modelView->mapFromSource(modelList->index(pathEdit->currentText()));
15551562
if (currentView == 2) { detailTree->setRootIndex(baseIndex); }
@@ -1559,6 +1566,12 @@ void MainWindow::refresh(bool modelRefresh, bool loadDir)
15591566
dirLoaded();
15601567
}
15611568
}
1569+
1570+
void MainWindow::enableReload()
1571+
{
1572+
qDebug() << "enable reload";
1573+
ignoreReload = false;
1574+
}
15621575
//---------------------------------------------------------------------------
15631576

15641577
/**

fm/src/mainwindow.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ private slots:
315315
void handlePathRequested(QString path);
316316
void slowPathEdit();
317317
void refresh(bool modelRefresh = true, bool loadDir = true);
318+
void enableReload();
318319
private:
319320
void createActions();
320321
void createActionIcons();
@@ -453,6 +454,8 @@ private slots:
453454
QString copyXof;
454455
// custom timestamp for copy of
455456
QString copyXofTS;
457+
458+
bool ignoreReload;
456459
};
457460

458461
//---------------------------------------------------------------------------------

fm/src/mymodel.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ myModel::myModel(bool realMime, MimeUtils *mimeUtils) {
4545
thumbs = new QHash<QString,QByteArray>;
4646
icons = new QCache<QString,QIcon>;
4747
icons->setMaxCost(500);
48-
lockNotify = false;
4948

5049
// Loads cached mime icons
5150
QFile fileIcons(QString("%1/file.cache").arg(Common::configDir()));
@@ -109,6 +108,13 @@ void myModel::clearIconCache() {
109108
QFile(QString("%1/folder.cache").arg(Common::configDir())).remove();
110109
QFile(QString("%1/file.cache").arg(Common::configDir())).remove();
111110
}
111+
112+
void myModel::forceRefresh()
113+
{
114+
qDebug() << "force refresh model view";
115+
beginResetModel();
116+
endResetModel();
117+
}
112118
//---------------------------------------------------------------------------
113119

114120
/**
@@ -287,11 +293,6 @@ void myModel::eventTimeout()
287293
void myModel::notifyProcess(int eventID, QString fileName)
288294
{
289295
qDebug() << "notifyProcess" << eventID << fileName;
290-
if (lockNotify) {
291-
qDebug() << "ignore notify";
292-
return;
293-
}
294-
lockNotify = true;
295296
QString folderChanged;
296297
if (watchers.contains(eventID)) {
297298
myModelItem *parent = rootItem->matchPath(watchers.value(eventID).split(SEPARATOR));
@@ -333,7 +334,6 @@ void myModel::notifyProcess(int eventID, QString fileName)
333334
qDebug() << "folder modified" << folderChanged;
334335
emit reloadDir(folderChanged);
335336
}
336-
QTimer::singleShot(500, this, SLOT(unlockNotify()));
337337
}
338338

339339
//---------------------------------------------------------------------------------
@@ -454,6 +454,7 @@ void myModel::refreshItems()
454454
{
455455
myModelItem *item = rootItem->matchPath(currentRootPath.split(SEPARATOR));
456456
if (item == NULL) { return; }
457+
qDebug() << "refresh items";
457458
item->clearAll();
458459
populateItem(item);
459460
}
@@ -927,11 +928,6 @@ QVariant myModel::findMimeIcon(myModelItem *item) const {
927928
return theIcon;
928929
}
929930

930-
void myModel::unlockNotify()
931-
{
932-
qDebug() << "unlock notify";
933-
lockNotify = false;
934-
}
935931
//---------------------------------------------------------------------------
936932

937933
bool myModel::setData(const QModelIndex & index, const QVariant & value, int role)

fm/src/mymodel.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public slots:
8686
void addWatcher(myModelItem* path);
8787
void clearCutItems();
8888
void clearIconCache();
89+
void forceRefresh();
8990
signals:
9091
void dragDropPaste(const QMimeData *data, QString newPath,
9192
Common::DragMode mode = Common::DM_UNKNOWN);
@@ -104,7 +105,6 @@ public slots:
104105
bool realMimeTypes;
105106
bool showThumbs;
106107
int thumbCount;
107-
bool lockNotify;
108108

109109
QPalette colors;
110110
QStringList cutItems;
@@ -123,9 +123,6 @@ public slots:
123123
QTimer eventTimer;
124124
int lastEventID;
125125
QString lastEventFilename;
126-
127-
private slots:
128-
void unlockNotify();
129126
};
130127

131128
#endif // MYMODEL_H

0 commit comments

Comments
 (0)