mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Remember last opened directory when loading decks (#5418)
* remember last directory when loading deck * move shared code into new dlg class
This commit is contained in:
parent
9c38c9ed1b
commit
93fab3d78f
7 changed files with 61 additions and 6 deletions
22
cockatrice/src/dialogs/dlg_load_deck.cpp
Normal file
22
cockatrice/src/dialogs/dlg_load_deck.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "dlg_load_deck.h"
|
||||
|
||||
#include "../deck/deck_loader.h"
|
||||
#include "../settings/cache_settings.h"
|
||||
|
||||
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
||||
{
|
||||
QString startingDir = SettingsCache::instance().recents().getLatestDeckDirPath();
|
||||
if (startingDir.isEmpty()) {
|
||||
startingDir = SettingsCache::instance().getDeckPath();
|
||||
}
|
||||
|
||||
setDirectory(startingDir);
|
||||
setNameFilters(DeckLoader::fileNameFilters);
|
||||
|
||||
connect(this, &DlgLoadDeck::accepted, this, &DlgLoadDeck::actAccepted);
|
||||
}
|
||||
|
||||
void DlgLoadDeck::actAccepted()
|
||||
{
|
||||
SettingsCache::instance().recents().setLatestDeckDirPath(directory().absolutePath());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue