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