Skip to content

Commit

Permalink
fix regressions introduced in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Nov 24, 2018
1 parent e88be93 commit 2e839cf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
6.1.4 23-November 2018
6.1.4 26-November 2018
- fix potential config corruption. Thanks to @slackuser0xae34 for the patch
- fix segfault on thumbnail update (view may have changed since loading thumbnails)
- don't cut file(s) if moving to same directory in bookmarks
- verify reply from udisks (avoid crash)
- populate view if not watched
- fix refresh view
- improved performance

6.1.3 07-October 2018
- update grid on paste/remove
Expand Down
15 changes: 14 additions & 1 deletion fm/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ MainWindow::MainWindow()
show();

trashDir = Common::trashDir();
ignoreReload = false;

QTimer::singleShot(0, this, SLOT(lateStart()));
}
Expand Down Expand Up @@ -716,9 +717,15 @@ void MainWindow::updateDir()

void MainWindow::handleReloadDir(const QString &path)
{
if (ignoreReload) {
qDebug() << "ignore reload";
return;
}
ignoreReload = true;
qDebug() << "handle reload dir" << path << modelList->getRootPath();
if (path != modelList->getRootPath()) { return; }
dirLoaded();
QTimer::singleShot(500, this, SLOT(enableReload()));
}

void MainWindow::thumbUpdate(const QString &path)
Expand Down Expand Up @@ -1549,7 +1556,7 @@ void MainWindow::refresh(bool modelRefresh, bool loadDir)
qDebug() << "refresh";
if (modelRefresh) {
modelList->refreshItems();
modelList->update();
modelList->forceRefresh();
}
QModelIndex baseIndex = modelView->mapFromSource(modelList->index(pathEdit->currentText()));
if (currentView == 2) { detailTree->setRootIndex(baseIndex); }
Expand All @@ -1559,6 +1566,12 @@ void MainWindow::refresh(bool modelRefresh, bool loadDir)
dirLoaded();
}
}

void MainWindow::enableReload()
{
qDebug() << "enable reload";
ignoreReload = false;
}
//---------------------------------------------------------------------------

/**
Expand Down
3 changes: 3 additions & 0 deletions fm/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ private slots:
void handlePathRequested(QString path);
void slowPathEdit();
void refresh(bool modelRefresh = true, bool loadDir = true);
void enableReload();
private:
void createActions();
void createActionIcons();
Expand Down Expand Up @@ -453,6 +454,8 @@ private slots:
QString copyXof;
// custom timestamp for copy of
QString copyXofTS;

bool ignoreReload;
};

//---------------------------------------------------------------------------------
Expand Down
20 changes: 8 additions & 12 deletions fm/src/mymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ myModel::myModel(bool realMime, MimeUtils *mimeUtils) {
thumbs = new QHash<QString,QByteArray>;
icons = new QCache<QString,QIcon>;
icons->setMaxCost(500);
lockNotify = false;

// Loads cached mime icons
QFile fileIcons(QString("%1/file.cache").arg(Common::configDir()));
Expand Down Expand Up @@ -109,6 +108,13 @@ void myModel::clearIconCache() {
QFile(QString("%1/folder.cache").arg(Common::configDir())).remove();
QFile(QString("%1/file.cache").arg(Common::configDir())).remove();
}

void myModel::forceRefresh()
{
qDebug() << "force refresh model view";
beginResetModel();
endResetModel();
}
//---------------------------------------------------------------------------

/**
Expand Down Expand Up @@ -287,11 +293,6 @@ void myModel::eventTimeout()
void myModel::notifyProcess(int eventID, QString fileName)
{
qDebug() << "notifyProcess" << eventID << fileName;
if (lockNotify) {
qDebug() << "ignore notify";
return;
}
lockNotify = true;
QString folderChanged;
if (watchers.contains(eventID)) {
myModelItem *parent = rootItem->matchPath(watchers.value(eventID).split(SEPARATOR));
Expand Down Expand Up @@ -333,7 +334,6 @@ void myModel::notifyProcess(int eventID, QString fileName)
qDebug() << "folder modified" << folderChanged;
emit reloadDir(folderChanged);
}
QTimer::singleShot(500, this, SLOT(unlockNotify()));
}

//---------------------------------------------------------------------------------
Expand Down Expand Up @@ -454,6 +454,7 @@ void myModel::refreshItems()
{
myModelItem *item = rootItem->matchPath(currentRootPath.split(SEPARATOR));
if (item == NULL) { return; }
qDebug() << "refresh items";
item->clearAll();
populateItem(item);
}
Expand Down Expand Up @@ -927,11 +928,6 @@ QVariant myModel::findMimeIcon(myModelItem *item) const {
return theIcon;
}

void myModel::unlockNotify()
{
qDebug() << "unlock notify";
lockNotify = false;
}
//---------------------------------------------------------------------------

bool myModel::setData(const QModelIndex & index, const QVariant & value, int role)
Expand Down
5 changes: 1 addition & 4 deletions fm/src/mymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public slots:
void addWatcher(myModelItem* path);
void clearCutItems();
void clearIconCache();
void forceRefresh();
signals:
void dragDropPaste(const QMimeData *data, QString newPath,
Common::DragMode mode = Common::DM_UNKNOWN);
Expand All @@ -104,7 +105,6 @@ public slots:
bool realMimeTypes;
bool showThumbs;
int thumbCount;
bool lockNotify;

QPalette colors;
QStringList cutItems;
Expand All @@ -123,9 +123,6 @@ public slots:
QTimer eventTimer;
int lastEventID;
QString lastEventFilename;

private slots:
void unlockNotify();
};

#endif // MYMODEL_H

0 comments on commit 2e839cf

Please sign in to comment.