mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Improved/fixed data dir changes handling
This commit is contained in:
parent
59e680d695
commit
a53f20314f
@ -83,8 +83,10 @@ QString FileBrowser::first()
|
||||
void FileBrowser::reloadDirectory(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
QFileInfo current = _files.at(_index);
|
||||
QFileInfo current = (_index >= 0) ? _files.at(_index) : QFileInfo();
|
||||
|
||||
_files = dir.entryInfoList(_filter, QDir::Files);
|
||||
_index = _files.empty() ? -1 : _files.indexOf(current);
|
||||
|
||||
emit listChanged();
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ public:
|
||||
bool isLast() const;
|
||||
bool isFirst() const;
|
||||
|
||||
signals:
|
||||
void listChanged();
|
||||
|
||||
private slots:
|
||||
void reloadDirectory(const QString &path);
|
||||
|
||||
|
@ -109,6 +109,8 @@ void GUI::createBrowser()
|
||||
{
|
||||
_browser = new FileBrowser(this);
|
||||
_browser->setFilter(Data::filter());
|
||||
connect(_browser, &FileBrowser::listChanged, this,
|
||||
&GUI::updateNavigationActions);
|
||||
}
|
||||
|
||||
TreeNode<MapAction*> GUI::createMapActions()
|
||||
@ -1791,21 +1793,10 @@ void GUI::graphChanged(int index)
|
||||
|
||||
void GUI::updateNavigationActions()
|
||||
{
|
||||
if (_browser->isLast()) {
|
||||
_nextAction->setEnabled(false);
|
||||
_lastAction->setEnabled(false);
|
||||
} else {
|
||||
_nextAction->setEnabled(true);
|
||||
_lastAction->setEnabled(true);
|
||||
}
|
||||
|
||||
if (_browser->isFirst()) {
|
||||
_prevAction->setEnabled(false);
|
||||
_firstAction->setEnabled(false);
|
||||
} else {
|
||||
_prevAction->setEnabled(true);
|
||||
_firstAction->setEnabled(true);
|
||||
}
|
||||
_lastAction->setEnabled(!_browser->isLast());
|
||||
_nextAction->setEnabled(!_browser->isLast());
|
||||
_firstAction->setEnabled(!_browser->isFirst());
|
||||
_prevAction->setEnabled(!_browser->isFirst());
|
||||
}
|
||||
|
||||
bool GUI::updateGraphTabs()
|
||||
|
@ -82,6 +82,7 @@ private slots:
|
||||
void prev();
|
||||
void last();
|
||||
void first();
|
||||
void updateNavigationActions();
|
||||
|
||||
void setTotalTime() {setTimeType(Total);}
|
||||
void setMovingTime() {setTimeType(Moving);}
|
||||
@ -136,7 +137,6 @@ private:
|
||||
QMenu *menu, const QList<QAction*> &existingActions);
|
||||
void updateStatusBarInfo();
|
||||
void updateWindowTitle();
|
||||
void updateNavigationActions();
|
||||
bool updateGraphTabs();
|
||||
|
||||
TimeType timeType() const;
|
||||
|
Loading…
Reference in New Issue
Block a user