OSDN Git Service

Add option "Brose Output File Location" to context menu in processing window.
authorlordmulder <mulder2@gmx.de>
Fri, 11 Feb 2011 22:16:11 +0000 (23:16 +0100)
committerlordmulder <mulder2@gmx.de>
Fri, 11 Feb 2011 22:16:11 +0000 (23:16 +0100)
12 files changed:
etc/Translation/Blank.ts
etc/Translation/LameXP_DE.ts
etc/Translation/LameXP_ES.ts
etc/Translation/LameXP_FR.ts
etc/Translation/LameXP_IT.ts
res/localization/LameXP_DE.qm
src/Config.h
src/Dialog_MainWindow.cpp
src/Dialog_Processing.cpp
src/Dialog_Processing.h
src/Model_Progress.cpp
src/Model_Progress.h

index 48d9f74..3d20ace 100644 (file)
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Browse Output File Location</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Encoding Files</source>
         <translation type="unfinished"></translation>
     </message>
index a28e5aa..af06dd9 100644 (file)
     </message>
     <message>
         <source>LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors.</source>
-        <translation>Das Urheberrecht an LameXP liegt bei LoRd_MuldeR. Das Urheberrecht an der eingesetzten Drittsoftware liegt bei den jeweiligen Authoren.</translation>
+        <translation>Das Urheberrecht an LameXP liegt bei LoRd_MuldeR. Das Urheberrecht an der eingesetzten Drittsoftware liegt bei den jeweiligen Autoren.</translation>
     </message>
     <message>
         <source>LameXP &amp;minus; Audio Encoder Front-end</source>
         <source>Multi-threading enabled: Running %1 instances in parallel!</source>
         <translation>Multithreading aktiviert: Führe %1 Instanzen parallel aus!</translation>
     </message>
+    <message>
+        <source>Browse Output File Location</source>
+        <translation>Ausgabe-Datei Suchen</translation>
+    </message>
 </context>
 <context>
     <name>ProgressModel</name>
index 84fb3ef..bda5dbb 100644 (file)
         <source>Multi-threading enabled: Running %1 instances in parallel!</source>
         <translation>Ejecución multi-hilo habilitada: ¡Ejecutando %1 instancias en paralelo!</translation>
     </message>
+    <message>
+        <source>Browse Output File Location</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProgressModel</name>
index 1012d7b..9212f98 100644 (file)
@@ -1499,6 +1499,10 @@ Votre dossier TEMP est situé ici:</translation>
         <source>Multi-threading enabled: Running %1 instances in parallel!</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Browse Output File Location</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProgressModel</name>
index 43a46f1..bb8558a 100644 (file)
         <source>Multi-threading enabled: Running %1 instances in parallel!</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Browse Output File Location</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ProgressModel</name>
index d23f446..01adb39 100644 (file)
Binary files a/res/localization/LameXP_DE.qm and b/res/localization/LameXP_DE.qm differ
index 5c01468..7283670 100644 (file)
@@ -25,7 +25,7 @@
 #define VER_LAMEXP_MAJOR                               4
 #define VER_LAMEXP_MINOR_HI                            0
 #define VER_LAMEXP_MINOR_LO                            0
-#define VER_LAMEXP_BUILD                               305
+#define VER_LAMEXP_BUILD                               307
 #define VER_LAMEXP_SUFFIX                              Beta-4
 
 /*
index 132cc65..e62220f 100644 (file)
@@ -548,12 +548,12 @@ void MainWindow::changeEvent(QEvent *e)
        {
                int comboBoxIndex[3];
                
-               //Backup combobox indices
+               //Backup combobox indices, as retranslateUi() resets
                comboBoxIndex[0] = comboBoxMP3ChannelMode->currentIndex();
                comboBoxIndex[1] = comboBoxSamplingRate->currentIndex();
                comboBoxIndex[2] = comboBoxNeroAACProfile->currentIndex();
                
-               //Re.translate from UIC
+               //Re-translate from UIC
                Ui::MainWindow::retranslateUi(this);
 
                //Restore combobox indices
@@ -566,7 +566,7 @@ void MainWindow::changeEvent(QEvent *e)
                        setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
                }
        
-               //Manual re-translate
+               //Manually re-translate widgets that UIC doesn't handle
                m_dropNoteLabel->setText(QString("» %1 «").arg(tr("You can drop in audio files here!")));
                m_showDetailsContextAction->setText(tr("Show Details"));
                m_previewContextAction->setText(tr("Open File in External Application"));
@@ -579,6 +579,7 @@ void MainWindow::changeEvent(QEvent *e)
                updateEncoder(m_settings->compressionEncoder());
                updateLameAlgoQuality(sliderLameAlgoQuality->value());
 
+               //Re-install shell integration
                if(m_settings->shellIntegrationEnabled())
                {
                        ShellIntegration::install();
@@ -1135,13 +1136,18 @@ void MainWindow::tabActionActivated(QAction *action)
  */
 void MainWindow::styleActionActivated(QAction *action)
 {
+       //Change style setting
        if(action && action->data().isValid())
        {
                bool ok = false;
                int actionIndex = action->data().toInt(&ok);
-               m_settings->interfaceStyle(actionIndex);
+               if(ok)
+               {
+                       m_settings->interfaceStyle(actionIndex);
+               }
        }
 
+       //Set up the new style
        switch(m_settings->interfaceStyle())
        {
        case 1:
@@ -1177,6 +1183,9 @@ void MainWindow::styleActionActivated(QAction *action)
                QApplication::setStyle(new QPlastiqueStyle());
                break;
        }
+
+       //Force re-translate after style change
+       changeEvent(new QEvent(QEvent::LanguageChange));
 }
 
 /*
index 9e04d54..ca92a65 100644 (file)
@@ -52,6 +52,7 @@
 #include <QDir>
 #include <QMenu>
 #include <QSystemTrayIcon>
+#include <QProcess>
 
 #include <Windows.h>
 
@@ -117,10 +118,13 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
 
        //Create context menu
        m_contextMenu = new QMenu();
-       QAction *contextMenuAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
+       QAction *contextMenuDetailsAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
+       QAction *contextMenuShowFileAction = m_contextMenu->addAction(QIcon(":/icons/folder_go.png"), tr("Browse Output File Location"));
+
        view_log->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
-       connect(contextMenuAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuActionTriggered()));
+       connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
+       connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
        
        //Enque jobs
        if(fileListModel)
@@ -424,12 +428,55 @@ void ProcessingDialog::contextMenuTriggered(const QPoint &pos)
        }
 }
 
-void ProcessingDialog::contextMenuActionTriggered(void)
+void ProcessingDialog::contextMenuDetailsActionTriggered(void)
 {
        QModelIndex index = view_log->indexAt(view_log->mapFromGlobal(m_contextMenu->pos()));
        logViewDoubleClicked(index.isValid() ? index : view_log->currentIndex());
 }
 
+void ProcessingDialog::contextMenuShowFileActionTriggered(void)
+{
+       QModelIndex index = view_log->indexAt(view_log->mapFromGlobal(m_contextMenu->pos()));
+       const QUuid &jobId = m_progressModel->getJobId(index.isValid() ? index : view_log->currentIndex());
+       QString filePath = m_playList.value(jobId, QString());
+
+       if(filePath.isEmpty())
+       {
+               MessageBeep(MB_ICONWARNING);
+               return;
+       }
+
+       if(QFileInfo(filePath).exists())
+       {
+               QString systemRootPath;
+
+               QDir systemRoot(lamexp_known_folder(lamexp_folder_systemfolder));
+               if(systemRoot.exists() && systemRoot.cdUp())
+               {
+                       systemRootPath = systemRoot.canonicalPath();
+               }
+
+               if(!systemRootPath.isEmpty())
+               {
+                       QFileInfo explorer(QString("%1/explorer.exe").arg(systemRootPath));
+                       if(explorer.exists() && explorer.isFile())
+                       {
+                               QProcess::execute(explorer.canonicalFilePath(), QStringList() << "/select," << QDir::toNativeSeparators(QFileInfo(filePath).canonicalFilePath()));
+                               return;
+                       }
+               }
+               else
+               {
+                       qWarning("SystemRoot directory could not be detected!");
+               }
+       }
+       else
+       {
+               qWarning("File not found: %s", filePath.toLatin1().constData());
+               MessageBeep(MB_ICONERROR);
+       }
+}
+
 ////////////////////////////////////////////////////////////
 // Private Functions
 ////////////////////////////////////////////////////////////
index 91f3dd8..8a16052 100644 (file)
@@ -50,7 +50,8 @@ private slots:
        void progressModelChanged(void);
        void logViewDoubleClicked(const QModelIndex &index);
        void contextMenuTriggered(const QPoint &pos);
-       void contextMenuActionTriggered(void);
+       void contextMenuDetailsActionTriggered(void);
+       void contextMenuShowFileActionTriggered(void);
        void systemTrayActivated(QSystemTrayIcon::ActivationReason reason);
 
 protected:
index 58233c1..d31bac7 100644 (file)
@@ -177,6 +177,16 @@ const QStringList &ProgressModel::getLogFile(const QModelIndex &index)
        return *(reinterpret_cast<QStringList*>(NULL));
 }
 
+const QUuid &ProgressModel::getJobId(const QModelIndex &index)
+{
+       if(index.row() < m_jobList.count())
+       {
+               return m_jobList.at(index.row());
+       }
+
+       return *(reinterpret_cast<QUuid*>(NULL));
+}
+
 void ProgressModel::addSystemMessage(const QString &text)
 {
        const QUuid &jobId = QUuid::createUuid();
index 4afd251..9ab84a3 100644 (file)
@@ -55,6 +55,7 @@ public:
 
        //Public functions
        const QStringList &getLogFile(const QModelIndex &index);
+       const QUuid &getJobId(const QModelIndex &index);
 
 public slots:
        void addJob(const QUuid &jobId, const QString &jobName, const QString &jobInitialStatus = QString("Initializing..."), int jobInitialState = JobRunning);