Added "Favorites" menu for output folders.

This commit is contained in:
LoRd_MuldeR 2011-08-08 20:26:30 +02:00
parent 3c87a01c59
commit 5ab869ed82
16 changed files with 579 additions and 468 deletions

View File

@ -20,6 +20,7 @@ a:visited { color: #0000EE; }
<li>Added an option to rename the output files (based on an user-defined pattern)
<li>Added an option to enforce Stereo Downmix for Multi-Channel sources
<li>Added "built-in" WMA decoder (see <a href="http://forum.doom9.org/showthread.php?t=140273">this</a> thread for details) and removed all remnants of "old" decoder
<li>Added a menu for bookmarking "favorite" output folders to the "output folder" tab
<li>Updated Qt runtime libraries to v4.8.0 Beta-1 (2011-07-19), compiled with MSVC 10.0
<li>Updated MediaInfo to v0.7.47 (2011-07-27), compiled with MSVC 10.0
<li>Updated language files (big thank-you to all contributors !!!)

View File

@ -457,6 +457,7 @@ FunctionEnd
;--------------------------------
Section "-PreInit"
SetShellVarContext all
SetOutPath "$INSTDIR"
SectionEnd
@ -491,10 +492,18 @@ Section "-Create Shortcuts"
!insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
SetShellVarContext current
Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
SetShellVarContext all
Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\LameXP.exe" "" "$INSTDIR\LameXP.exe" 0
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"

File diff suppressed because it is too large Load Diff

View File

@ -1622,6 +1622,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation>Surround (Mehrkanal-Ton) Quellen immer auf Stereo heruntermischen</translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1621,6 +1621,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1631,6 +1631,10 @@ Ouvrir le dossier récursivement...</translation>
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1622,6 +1622,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1621,6 +1621,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1627,6 +1627,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1622,6 +1622,10 @@
<source>Enforce Stereo Downmix of Surround (Multi-Channel) Sources</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bookmark Current Output Folder</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -277,57 +277,89 @@
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="outputFolderLabel">
<property name="palette">
<palette>
<active>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>3</number>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string notr="true">($OUTDIR)</string>
</property>
</widget>
<item>
<widget class="QLabel" name="outputFolderLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>200</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string notr="true">($OUTDIR)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="outputFoldersFovoritesLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/Icons.qrc">:/icons/star.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="outputFolderView">
@ -1067,8 +1099,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>1426</height>
<width>602</width>
<height>1423</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 9
#define VER_LAMEXP_BUILD 630
#define VER_LAMEXP_BUILD 634
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -147,6 +147,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
outputFolderView->setMouseTracking(false);
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
outputFolderView->installEventFilter(this);
outputFoldersFovoritesLabel->installEventFilter(this);
while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
prependRelativePathCheckBox->setChecked(m_settings->prependRelativeSourcePath());
connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
@ -161,11 +162,16 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged()));
m_outputFolderContextMenu = new QMenu();
m_showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A");
m_outputFolderFavoritesMenu = new QMenu();
m_addFavoriteFolderAction = m_outputFolderFavoritesMenu->addAction(QIcon(":/icons/add.png"), "N/A");
m_outputFolderFavoritesMenu->insertSeparator(m_addFavoriteFolderAction);
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
connect(m_showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered()));
connect(m_addFavoriteFolderAction, SIGNAL(triggered(bool)), this, SLOT(addFavoriteFolderActionTriggered()));
outputFolderLabel->installEventFilter(this);
outputFolderView->setCurrentIndex(m_fileSystemModel->index(m_settings->outputDir()));
outputFolderViewClicked(outputFolderView->currentIndex());
refreshFavorites();
//Setup "Meta Data" tab
m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
@ -448,6 +454,7 @@ MainWindow::~MainWindow(void)
LAMEXP_DELETE(m_encoderButtonGroup);
LAMEXP_DELETE(m_encoderButtonGroup);
LAMEXP_DELETE(m_sourceFilesContextMenu);
LAMEXP_DELETE(m_outputFolderFavoritesMenu);
LAMEXP_DELETE(m_dropBox);
}
@ -553,85 +560,6 @@ void MainWindow::addFolder(const QString &path, bool recursive, bool delayed)
}
}
/*
* Download and install WMA Decoder component
*/
//bool MainWindow::installWMADecoder(void)
//{
// static const char *download_url = "http://www.nch.com.au/components/wmawav.exe";
// static const char *download_hash = "52a3b0e6690faf3f830c336d3c0eadfb7a4e9bc6";
//
// bool bResult = false;
//
// QString binaryWGet = lamexp_lookup_tool("wget.exe");
// QString binaryElevator = lamexp_lookup_tool("elevator.exe");
//
// if(binaryWGet.isEmpty() || binaryElevator.isEmpty())
// {
// throw "Required binary is not available!";
// }
//
// while(true)
// {
// QString setupFile = QString("%1/%2.exe").arg(lamexp_temp_folder2(), lamexp_rand_str());
//
// QProcess process;
// process.setWorkingDirectory(QFileInfo(setupFile).absolutePath());
//
// QEventLoop loop;
// connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
// connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit()));
//
// process.start(binaryWGet, QStringList() << "-O" << QFileInfo(setupFile).fileName() << download_url);
// m_banner->show(tr("Downloading WMA Decoder Setup, please wait..."), &loop);
//
// if(process.exitCode() != 0 || QFileInfo(setupFile).size() < 10240)
// {
// QFile::remove(setupFile);
// if(QMessageBox::critical(this, tr("Download Failed"), tr("Failed to download the WMA Decoder setup. Check your internet connection!"), tr("Try Again"), tr("Cancel")) == 0)
// {
// continue;
// }
// break;
// }
//
// QFile setupFileContent(setupFile);
// QCryptographicHash setupFileHash(QCryptographicHash::Sha1);
//
// setupFileContent.open(QIODevice::ReadOnly);
// if(setupFileContent.isOpen() && setupFileContent.isReadable())
// {
// setupFileHash.addData(setupFileContent.readAll());
// setupFileContent.close();
// }
//
// if(_stricmp(setupFileHash.result().toHex().constData(), download_hash))
// {
// qWarning("Hash miscompare:\n Expected %s\n Detected %s\n", download_hash, setupFileHash.result().toHex().constData());
// QFile::remove(setupFile);
// if(QMessageBox::critical(this, tr("Download Failed"), tr("The download seems to be corrupted. Please try again!"), tr("Try Again"), tr("Cancel")) == 0)
// {
// continue;
// }
// break;
// }
//
// QApplication::setOverrideCursor(Qt::WaitCursor);
// process.start(binaryElevator, QStringList() << QString("/exec=%1").arg(setupFile));
// loop.exec(QEventLoop::ExcludeUserInputEvents);
// QFile::remove(setupFile);
// QApplication::restoreOverrideCursor();
//
// if(QMessageBox::information(this, tr("WMA Decoder"), tr("The WMA File Decoder has been installed. Please restart LameXP now!"), tr("Quit LameXP"), tr("Postpone")) == 0)
// {
// bResult = true;
// }
// break;
// }
//
// return bResult;
//}
/*
* Check for updates
*/
@ -652,6 +580,36 @@ bool MainWindow::checkForUpdates(void)
return bReadyToInstall;
}
void MainWindow::refreshFavorites(void)
{
QList<QAction*> folderList = m_outputFolderFavoritesMenu->actions();
QStringList favorites = m_settings->favoriteOutputFolders().split("|", QString::SkipEmptyParts);
while(favorites.count() > 6) favorites.removeFirst();
while(!folderList.isEmpty())
{
QAction *currentItem = folderList.takeFirst();
if(currentItem->isSeparator()) break;
m_outputFolderFavoritesMenu->removeAction(currentItem);
LAMEXP_DELETE(currentItem);
}
QAction *lastItem = m_outputFolderFavoritesMenu->actions().first();
while(!favorites.isEmpty())
{
QString path = favorites.takeLast();
if(QDir(path).exists())
{
QAction *action = new QAction(QIcon(":/icons/folder_go.png"), QDir::toNativeSeparators(path), this);
action->setData(path);
m_outputFolderFavoritesMenu->insertAction(lastItem, action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(gotoFavoriteFolder()));
lastItem = action;
}
}
}
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
@ -726,6 +684,7 @@ void MainWindow::changeEvent(QEvent *e)
m_previewContextAction->setText(tr("Open File in External Application"));
m_findFileContextAction->setText(tr("Browse File Location"));
m_showFolderContextAction->setText(tr("Browse Selected Folder"));
m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
//Force GUI update
m_metaInfoModel->clearData();
@ -871,6 +830,35 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
break;
}
}
else if(obj == outputFoldersFovoritesLabel)
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
QPoint pos = (mouseEvent != NULL) ? mouseEvent->pos() : QPoint();
QWidget *sender = dynamic_cast<QLabel*>(obj);
switch(event->type())
{
case QEvent::Enter:
outputFoldersFovoritesLabel->setFrameShadow(QFrame::Raised);
break;
case QEvent::MouseButtonPress:
outputFoldersFovoritesLabel->setFrameShadow(QFrame::Sunken);
break;
case QEvent::MouseButtonRelease:
outputFoldersFovoritesLabel->setFrameShadow(QFrame::Raised);
if(sender && mouseEvent)
{
if(pos.x() <= sender->width() && pos.y() <= sender->height() && pos.x() >= 0 && pos.y() >= 0 && mouseEvent->button() != Qt::MidButton)
{
m_outputFolderFavoritesMenu->popup(sender->mapToGlobal(pos));
}
}
break;
case QEvent::Leave:
outputFoldersFovoritesLabel->setFrameShadow(QFrame::Plain);
break;
}
}
return false;
}
@ -2100,6 +2088,31 @@ void MainWindow::gotoMusicFolderButtonClicked(void)
}
}
/*
* Goto music favorite output folder
*/
void MainWindow::gotoFavoriteFolder(void)
{
QAction *item = dynamic_cast<QAction*>(QObject::sender());
if(item)
{
QDir path(item->data().toString());
if(path.exists())
{
outputFolderView->setCurrentIndex(m_fileSystemModel->index(path.canonicalPath()));
outputFolderViewClicked(outputFolderView->currentIndex());
outputFolderView->setFocus();
}
else
{
MessageBeep(MB_ICONERROR);
m_outputFolderFavoritesMenu->removeAction(item);
item->deleteLater();
}
}
}
/*
* Make folder button
*/
@ -2146,6 +2159,8 @@ void MainWindow::makeFolderButtonClicked(void)
}
}
suggestedName = lamexp_clean_filename(suggestedName);
while(true)
{
bool bApplied = false;
@ -2153,15 +2168,7 @@ void MainWindow::makeFolderButtonClicked(void)
if(bApplied)
{
folderName.remove(":", Qt::CaseInsensitive);
folderName.remove("/", Qt::CaseInsensitive);
folderName.remove("\\", Qt::CaseInsensitive);
folderName.remove("?", Qt::CaseInsensitive);
folderName.remove("*", Qt::CaseInsensitive);
folderName.remove("<", Qt::CaseInsensitive);
folderName.remove(">", Qt::CaseInsensitive);
folderName = folderName.simplified();
folderName = lamexp_clean_filepath(folderName.simplified());
if(folderName.isEmpty())
{
@ -2177,7 +2184,7 @@ void MainWindow::makeFolderButtonClicked(void)
newFolder = QString(folderName).append(QString().sprintf(" (%d)", ++i));
}
if(basePath.mkdir(newFolder))
if(basePath.mkpath(newFolder))
{
QDir createdDir = basePath;
if(createdDir.cd(newFolder))
@ -2234,6 +2241,28 @@ void MainWindow::showFolderContextActionTriggered(void)
QDesktopServices::openUrl(QUrl::fromLocalFile(m_fileSystemModel->filePath(outputFolderView->currentIndex())));
}
/*
* Add current folder to favorites
*/
void MainWindow::addFavoriteFolderActionTriggered(void)
{
QString path = m_fileSystemModel->filePath(outputFolderView->currentIndex());
QStringList favorites = m_settings->favoriteOutputFolders().split("|", QString::SkipEmptyParts);
if(!favorites.contains(path, Qt::CaseInsensitive))
{
favorites.append(path);
while(favorites.count() > 6) favorites.removeFirst();
}
else
{
MessageBeep(MB_ICONWARNING);
}
m_settings->favoriteOutputFolders(favorites.join("|"));
refreshFavorites();
}
/*
* Initialize file system model
*/

View File

@ -51,6 +51,7 @@ private slots:
void addFileDelayed(const QString &filePath, bool tryASAP = false);
void addFilesButtonClicked(void);
void addFilesDelayed(const QStringList &filePaths, bool tryASAP = false);
void addFavoriteFolderActionTriggered(void);
void addFolderDelayed(const QString &folderPath, bool recursive);
void aftenCodingModeChanged(int value);
void aftenDRCModeChanged(int value);
@ -82,6 +83,7 @@ private slots:
void findFileContextActionTriggered(void);
void forceStereoDownmixEnabledChanged(bool checked);
void gotoDesktopButtonClicked(void);
void gotoFavoriteFolder(void);
void gotoHomeFolderButtonClicked(void);
void gotoMusicFolderButtonClicked(void);
void handleDelayedFiles(void);
@ -145,7 +147,7 @@ private:
void addFiles(const QStringList &files);
void addFolder(const QString &path, bool recursive = false, bool delayed = false);
bool checkForUpdates(void);
bool installWMADecoder(void);
void refreshFavorites(void);
bool m_accepted;
bool m_firstTimeShown;
@ -166,11 +168,13 @@ private:
QMenu *m_outputFolderContextMenu;
SettingsModel *m_settings;
QMenu *m_sourceFilesContextMenu;
QMenu *m_outputFolderFavoritesMenu;
QAction *m_findFileContextAction;
QAction *m_previewContextAction;
QAction *m_showDetailsContextAction;
QAction *m_showFolderContextAction;
QAction *m_addFavoriteFolderAction;
QActionGroup *m_languageActionGroup;
QActionGroup *m_styleActionGroup;
QActionGroup *m_tabActionGroup;

View File

@ -75,6 +75,7 @@ LAMEXP_MAKE_ID(compressionBitrate, "Compression/Bitrate");
LAMEXP_MAKE_ID(outputDir, "OutputDirectory/SelectedPath");
LAMEXP_MAKE_ID(outputToSourceDir, "OutputDirectory/OutputToSourceFolder");
LAMEXP_MAKE_ID(prependRelativeSourcePath, "OutputDirectory/PrependRelativeSourcePath");
LAMEXP_MAKE_ID(favoriteOutputFolders, "OutputDirectory/Favorites");
LAMEXP_MAKE_ID(writeMetaTags, "Flags/WriteMetaTags");
LAMEXP_MAKE_ID(createPlaylist, "Flags/AutoCreatePlaylist");
LAMEXP_MAKE_ID(autoUpdateLastCheck, "AutoUpdate/LastCheck");
@ -267,6 +268,7 @@ LAMEXP_MAKE_OPTION_I(compressionBitrate, 7)
LAMEXP_MAKE_OPTION_S(outputDir, QString())
LAMEXP_MAKE_OPTION_B(outputToSourceDir, false)
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath, false)
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders, QString());
LAMEXP_MAKE_OPTION_B(writeMetaTags, true)
LAMEXP_MAKE_OPTION_B(createPlaylist, true)
LAMEXP_MAKE_OPTION_S(autoUpdateLastCheck, "Never")

View File

@ -85,6 +85,7 @@ public:
LAMEXP_MAKE_OPTION_S(outputDir);
LAMEXP_MAKE_OPTION_B(outputToSourceDir);
LAMEXP_MAKE_OPTION_B(prependRelativeSourcePath);
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders);
LAMEXP_MAKE_OPTION_B(writeMetaTags);
LAMEXP_MAKE_OPTION_B(createPlaylist);
LAMEXP_MAKE_OPTION_S(autoUpdateLastCheck);