Remember most recent path for "add file(s)" and "add directory" dialogs.
This commit is contained in:
parent
10ae6c8451
commit
b84f66f741
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 3
|
#define VER_LAMEXP_MINOR_LO 3
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 15
|
#define VER_LAMEXP_PATCH 15
|
||||||
#define VER_LAMEXP_BUILD 662
|
#define VER_LAMEXP_BUILD 664
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -159,7 +159,29 @@ void CueImportDialog::modelChanged(void)
|
|||||||
|
|
||||||
void CueImportDialog::browseButtonClicked(void)
|
void CueImportDialog::browseButtonClicked(void)
|
||||||
{
|
{
|
||||||
QString newOutDir = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory"));
|
QString newOutDir, currentDir = m_outputDir;
|
||||||
|
|
||||||
|
while(QDir(currentDir).exists())
|
||||||
|
{
|
||||||
|
int pos = max(currentDir.lastIndexOf(QChar('\\')), currentDir.lastIndexOf(QChar('/')));
|
||||||
|
if(pos > 0) currentDir.left(pos - 1); else break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
||||||
|
{
|
||||||
|
newOutDir = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory"), currentDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFileDialog dialog(this, tr("Choose Output Directory"));
|
||||||
|
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
||||||
|
dialog.setDirectory(currentDir);
|
||||||
|
if(dialog.exec())
|
||||||
|
{
|
||||||
|
newOutDir = dialog.selectedFiles().first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!newOutDir.isEmpty())
|
if(!newOutDir.isEmpty())
|
||||||
{
|
{
|
||||||
m_outputDir = newOutDir;
|
m_outputDir = newOutDir;
|
||||||
|
@ -73,7 +73,8 @@
|
|||||||
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
|
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
|
||||||
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
|
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
|
||||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
|
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
|
||||||
#define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); CMD; if(__dropBoxVisible) m_dropBox->show(); }
|
#define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); {CMD}; if(__dropBoxVisible) m_dropBox->show(); }
|
||||||
|
#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
@ -1516,9 +1517,27 @@ void MainWindow::importCueSheetActionTriggered(bool checked)
|
|||||||
|
|
||||||
TEMP_HIDE_DROPBOX
|
TEMP_HIDE_DROPBOX
|
||||||
(
|
(
|
||||||
QString selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), QString(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
|
QString selectedCueFile;
|
||||||
|
|
||||||
|
if(USE_NATIVE_FILE_DIALOG)
|
||||||
|
{
|
||||||
|
selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), m_settings->mostRecentInputPath(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFileDialog dialog(this, tr("Open Cue Sheet"));
|
||||||
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
dialog.setNameFilter(QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
|
||||||
|
dialog.setDirectory(m_settings->mostRecentInputPath());
|
||||||
|
if(dialog.exec())
|
||||||
|
{
|
||||||
|
selectedCueFile = dialog.selectedFiles().first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!selectedCueFile.isEmpty())
|
if(!selectedCueFile.isEmpty())
|
||||||
{
|
{
|
||||||
|
m_settings->mostRecentInputPath(QFileInfo(selectedCueFile).canonicalPath());
|
||||||
CueImportDialog *cueImporter = new CueImportDialog(this, m_fileListModel, selectedCueFile);
|
CueImportDialog *cueImporter = new CueImportDialog(this, m_fileListModel, selectedCueFile);
|
||||||
cueImporter->exec();
|
cueImporter->exec();
|
||||||
LAMEXP_DELETE(cueImporter);
|
LAMEXP_DELETE(cueImporter);
|
||||||
@ -1695,12 +1714,13 @@ void MainWindow::addFilesButtonClicked(void)
|
|||||||
|
|
||||||
TEMP_HIDE_DROPBOX
|
TEMP_HIDE_DROPBOX
|
||||||
(
|
(
|
||||||
if(lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
if(USE_NATIVE_FILE_DIALOG)
|
||||||
{
|
{
|
||||||
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
|
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
|
||||||
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;"));
|
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), m_settings->mostRecentInputPath(), fileTypeFilters.join(";;"));
|
||||||
if(!selectedFiles.isEmpty())
|
if(!selectedFiles.isEmpty())
|
||||||
{
|
{
|
||||||
|
m_settings->mostRecentInputPath(QFileInfo(selectedFiles.first()).canonicalPath());
|
||||||
addFiles(selectedFiles);
|
addFiles(selectedFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1710,10 +1730,15 @@ void MainWindow::addFilesButtonClicked(void)
|
|||||||
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
|
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
|
||||||
dialog.setFileMode(QFileDialog::ExistingFiles);
|
dialog.setFileMode(QFileDialog::ExistingFiles);
|
||||||
dialog.setNameFilter(fileTypeFilters.join(";;"));
|
dialog.setNameFilter(fileTypeFilters.join(";;"));
|
||||||
|
dialog.setDirectory(m_settings->mostRecentInputPath());
|
||||||
if(dialog.exec())
|
if(dialog.exec())
|
||||||
{
|
{
|
||||||
QStringList selectedFiles = dialog.selectedFiles();
|
QStringList selectedFiles = dialog.selectedFiles();
|
||||||
addFiles(selectedFiles);
|
if(!selectedFiles.isEmpty())
|
||||||
|
{
|
||||||
|
m_settings->mostRecentInputPath(QFileInfo(selectedFiles.first()).canonicalPath());
|
||||||
|
addFiles(selectedFiles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -1731,15 +1756,15 @@ void MainWindow::openFolderActionActivated(void)
|
|||||||
{
|
{
|
||||||
TEMP_HIDE_DROPBOX
|
TEMP_HIDE_DROPBOX
|
||||||
(
|
(
|
||||||
if(lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
|
if(USE_NATIVE_FILE_DIALOG)
|
||||||
{
|
{
|
||||||
selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add Folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add Folder"), m_settings->mostRecentInputPath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this, tr("Add Folder"));
|
QFileDialog dialog(this, tr("Add Folder"));
|
||||||
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
||||||
dialog.setDirectory(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
dialog.setDirectory(m_settings->mostRecentInputPath());
|
||||||
if(dialog.exec())
|
if(dialog.exec())
|
||||||
{
|
{
|
||||||
selectedFolder = dialog.selectedFiles().first();
|
selectedFolder = dialog.selectedFiles().first();
|
||||||
@ -1748,6 +1773,7 @@ void MainWindow::openFolderActionActivated(void)
|
|||||||
|
|
||||||
if(!selectedFolder.isEmpty())
|
if(!selectedFolder.isEmpty())
|
||||||
{
|
{
|
||||||
|
m_settings->mostRecentInputPath(QDir(selectedFolder).canonicalPath());
|
||||||
addFolder(selectedFolder, action->data().toBool());
|
addFolder(selectedFolder, action->data().toBool());
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -1866,7 +1892,6 @@ void MainWindow::sourceFilesContextMenu(const QPoint &pos)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::sourceFilesScrollbarMoved(int)
|
void MainWindow::sourceFilesScrollbarMoved(int)
|
||||||
{
|
{
|
||||||
qDebug("sourceFileView->resizeColumnToContents(0);");
|
|
||||||
sourceFileView->resizeColumnToContents(0);
|
sourceFileView->resizeColumnToContents(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2854,7 +2879,22 @@ void MainWindow::autoDetectInstancesChanged(bool checked)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::browseCustomTempFolderButtonClicked(void)
|
void MainWindow::browseCustomTempFolderButtonClicked(void)
|
||||||
{
|
{
|
||||||
QString newTempFolder = QFileDialog::getExistingDirectory(this);
|
QString newTempFolder;
|
||||||
|
|
||||||
|
if(USE_NATIVE_FILE_DIALOG)
|
||||||
|
{
|
||||||
|
newTempFolder = QFileDialog::getExistingDirectory(this, QString(), m_settings->customTempPath());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFileDialog dialog(this);
|
||||||
|
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
||||||
|
dialog.setDirectory(m_settings->customTempPath());
|
||||||
|
if(dialog.exec())
|
||||||
|
{
|
||||||
|
newTempFolder = dialog.selectedFiles().first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!newTempFolder.isEmpty())
|
if(!newTempFolder.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,7 @@ LAMEXP_MAKE_ID(outputDir, "OutputDirectory/SelectedPath");
|
|||||||
LAMEXP_MAKE_ID(outputToSourceDir, "OutputDirectory/OutputToSourceFolder");
|
LAMEXP_MAKE_ID(outputToSourceDir, "OutputDirectory/OutputToSourceFolder");
|
||||||
LAMEXP_MAKE_ID(prependRelativeSourcePath, "OutputDirectory/PrependRelativeSourcePath");
|
LAMEXP_MAKE_ID(prependRelativeSourcePath, "OutputDirectory/PrependRelativeSourcePath");
|
||||||
LAMEXP_MAKE_ID(favoriteOutputFolders, "OutputDirectory/Favorites");
|
LAMEXP_MAKE_ID(favoriteOutputFolders, "OutputDirectory/Favorites");
|
||||||
|
LAMEXP_MAKE_ID(mostRecentInputPath, "InputDirectory/MostRecentPath");
|
||||||
LAMEXP_MAKE_ID(writeMetaTags, "Flags/WriteMetaTags");
|
LAMEXP_MAKE_ID(writeMetaTags, "Flags/WriteMetaTags");
|
||||||
LAMEXP_MAKE_ID(createPlaylist, "Flags/AutoCreatePlaylist");
|
LAMEXP_MAKE_ID(createPlaylist, "Flags/AutoCreatePlaylist");
|
||||||
LAMEXP_MAKE_ID(autoUpdateLastCheck, "AutoUpdate/LastCheck");
|
LAMEXP_MAKE_ID(autoUpdateLastCheck, "AutoUpdate/LastCheck");
|
||||||
@ -213,7 +214,14 @@ void SettingsModel::validate(void)
|
|||||||
|
|
||||||
if(this->outputDir().isEmpty() || !QFileInfo(this->outputDir()).isDir())
|
if(this->outputDir().isEmpty() || !QFileInfo(this->outputDir()).isDir())
|
||||||
{
|
{
|
||||||
this->outputDir(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
|
||||||
|
this->outputDir(musicLocation.isEmpty() ? QDesktopServices::storageLocation(QDesktopServices::HomeLocation) : musicLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->mostRecentInputPath().isEmpty() || !QFileInfo(this->mostRecentInputPath()).isDir())
|
||||||
|
{
|
||||||
|
QString musicLocation = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
|
||||||
|
this->outputDir(musicLocation.isEmpty() ? QDesktopServices::storageLocation(QDesktopServices::HomeLocation) : musicLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive))
|
if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive))
|
||||||
@ -268,7 +276,7 @@ LAMEXP_MAKE_OPTION_I(interfaceStyle, 0)
|
|||||||
LAMEXP_MAKE_OPTION_I(compressionEncoder, 0)
|
LAMEXP_MAKE_OPTION_I(compressionEncoder, 0)
|
||||||
LAMEXP_MAKE_OPTION_I(compressionRCMode, 0)
|
LAMEXP_MAKE_OPTION_I(compressionRCMode, 0)
|
||||||
LAMEXP_MAKE_OPTION_I(compressionBitrate, 7)
|
LAMEXP_MAKE_OPTION_I(compressionBitrate, 7)
|
||||||
LAMEXP_MAKE_OPTION_S(outputDir, QString())
|
LAMEXP_MAKE_OPTION_S(outputDir, QDesktopServices::storageLocation(QDesktopServices::MusicLocation))
|
||||||
LAMEXP_MAKE_OPTION_B(outputToSourceDir, false)
|
LAMEXP_MAKE_OPTION_B(outputToSourceDir, false)
|
||||||
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath, false)
|
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath, false)
|
||||||
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders, QString());
|
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders, QString());
|
||||||
@ -312,3 +320,4 @@ LAMEXP_MAKE_OPTION_U(maximumInstances, 0);
|
|||||||
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation));
|
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation));
|
||||||
LAMEXP_MAKE_OPTION_B(customTempPathEnabled, false);
|
LAMEXP_MAKE_OPTION_B(customTempPathEnabled, false);
|
||||||
LAMEXP_MAKE_OPTION_B(slowStartup, false);
|
LAMEXP_MAKE_OPTION_B(slowStartup, false);
|
||||||
|
LAMEXP_MAKE_OPTION_S(mostRecentInputPath, QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
||||||
|
@ -126,6 +126,7 @@ public:
|
|||||||
LAMEXP_MAKE_OPTION_S(customTempPath);
|
LAMEXP_MAKE_OPTION_S(customTempPath);
|
||||||
LAMEXP_MAKE_OPTION_B(customTempPathEnabled);
|
LAMEXP_MAKE_OPTION_B(customTempPathEnabled);
|
||||||
LAMEXP_MAKE_OPTION_B(slowStartup);
|
LAMEXP_MAKE_OPTION_B(slowStartup);
|
||||||
|
LAMEXP_MAKE_OPTION_S(mostRecentInputPath);
|
||||||
|
|
||||||
//Misc
|
//Misc
|
||||||
void validate(void);
|
void validate(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user