2010-11-17 19:35:50 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2013-02-08 23:50:51 +01:00
|
|
|
// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
|
2010-11-17 19:35:50 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
#include <QDialog>
|
2010-11-20 22:14:10 +01:00
|
|
|
#include <QUuid>
|
2010-12-10 22:17:44 +01:00
|
|
|
#include <QSystemTrayIcon>
|
2012-12-08 00:21:10 +01:00
|
|
|
#include <QMap>
|
2010-11-20 22:14:10 +01:00
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
class AbstractEncoder;
|
2010-11-19 21:11:54 +01:00
|
|
|
class AudioFileModel;
|
2011-10-29 16:26:09 +02:00
|
|
|
class CPUObserverThread;
|
2011-03-28 04:26:47 +02:00
|
|
|
class DiskObserverThread;
|
2012-12-08 00:21:10 +01:00
|
|
|
class FileListModel;
|
|
|
|
class ProcessThread;
|
|
|
|
class ProgressModel;
|
|
|
|
class QActionGroup;
|
|
|
|
class QLabel;
|
|
|
|
class QMenu;
|
|
|
|
class QModelIndex;
|
|
|
|
class QMovie;
|
|
|
|
class RAMObserverThread;
|
|
|
|
class SettingsModel;
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2011-10-22 01:13:28 +02:00
|
|
|
enum shutdownFlag_t
|
|
|
|
{
|
|
|
|
shutdownFlag_None = 0,
|
|
|
|
shutdownFlag_TurnPowerOff = 1,
|
|
|
|
shutdownFlag_Hibernate = 2
|
|
|
|
};
|
|
|
|
|
2012-12-08 00:21:10 +01:00
|
|
|
//UIC forward declartion
|
|
|
|
namespace Ui {
|
|
|
|
class ProcessingDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
//ProcessingDialog class
|
|
|
|
class ProcessingDialog : public QDialog
|
2010-11-17 19:35:50 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-11-20 19:16:04 +01:00
|
|
|
ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent = 0);
|
2010-11-17 19:35:50 +01:00
|
|
|
~ProcessingDialog(void);
|
2011-03-18 01:12:17 +01:00
|
|
|
|
2011-10-22 01:13:28 +02:00
|
|
|
int getShutdownFlag(void) { return m_shutdownFlag; }
|
2010-11-17 19:35:50 +01:00
|
|
|
|
2010-11-18 00:32:46 +01:00
|
|
|
private slots:
|
|
|
|
void initEncoding(void);
|
|
|
|
void doneEncoding(void);
|
2011-12-29 14:42:20 +01:00
|
|
|
void abortEncoding(bool force = false);
|
2012-11-11 18:33:55 +01:00
|
|
|
void processFinished(const QUuid &jobId, const QString &outFileName, int success);
|
2010-11-21 21:51:22 +01:00
|
|
|
void progressModelChanged(void);
|
2010-11-22 21:45:00 +01:00
|
|
|
void logViewDoubleClicked(const QModelIndex &index);
|
2011-08-23 17:01:11 +02:00
|
|
|
void logViewSectionSizeChanged(int, int, int);
|
2010-11-24 21:00:59 +01:00
|
|
|
void contextMenuTriggered(const QPoint &pos);
|
2011-02-11 23:16:11 +01:00
|
|
|
void contextMenuDetailsActionTriggered(void);
|
|
|
|
void contextMenuShowFileActionTriggered(void);
|
2012-11-11 18:33:55 +01:00
|
|
|
void contextMenuFilterActionTriggered(void);
|
2010-12-10 22:17:44 +01:00
|
|
|
void systemTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
2011-10-29 16:26:09 +02:00
|
|
|
void cpuUsageHasChanged(const double val);
|
|
|
|
void ramUsageHasChanged(const double val);
|
|
|
|
void diskUsageHasChanged(const quint64 val);
|
2012-11-11 18:33:55 +01:00
|
|
|
void progressViewFilterChanged(void);
|
2010-11-18 00:32:46 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
2011-12-29 14:42:20 +01:00
|
|
|
virtual bool event(QEvent *e);
|
|
|
|
virtual bool winEvent(MSG *message, long *result);
|
2012-11-15 18:06:04 +01:00
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2010-11-18 00:32:46 +01:00
|
|
|
|
2010-11-17 19:35:50 +01:00
|
|
|
private:
|
2012-12-08 00:21:10 +01:00
|
|
|
Ui::ProcessingDialog *ui; //for Qt UIC
|
|
|
|
|
2010-11-18 00:32:46 +01:00
|
|
|
void setCloseButtonEnabled(bool enabled);
|
2010-11-20 19:16:04 +01:00
|
|
|
void startNextJob(void);
|
2011-12-22 21:53:25 +01:00
|
|
|
AbstractEncoder *makeEncoder(bool *nativeResampling);
|
2010-11-20 19:16:04 +01:00
|
|
|
AudioFileModel updateMetaInfo(const AudioFileModel &audioFile);
|
2010-11-20 22:14:10 +01:00
|
|
|
void writePlayList(void);
|
2011-03-18 12:37:18 +01:00
|
|
|
bool shutdownComputer(void);
|
2011-11-28 00:35:43 +01:00
|
|
|
QString time2text(const double timeVal) const;
|
2010-11-18 00:32:46 +01:00
|
|
|
|
2010-11-19 21:11:54 +01:00
|
|
|
QList<AudioFileModel> m_pendingJobs;
|
2010-11-20 02:14:22 +01:00
|
|
|
SettingsModel *m_settings;
|
2010-11-20 19:16:04 +01:00
|
|
|
AudioFileModel *m_metaInfo;
|
2010-11-19 21:11:54 +01:00
|
|
|
QList<ProcessThread*> m_threadList;
|
2010-11-17 19:35:50 +01:00
|
|
|
QMovie *m_progressIndicator;
|
2010-11-18 00:32:46 +01:00
|
|
|
ProgressModel *m_progressModel;
|
2010-12-10 21:24:42 +01:00
|
|
|
QMap<QUuid,QString> m_playList;
|
2010-11-24 21:00:59 +01:00
|
|
|
QMenu *m_contextMenu;
|
2012-11-11 18:33:55 +01:00
|
|
|
QActionGroup *m_progressViewFilterGroup;
|
2012-11-15 18:06:04 +01:00
|
|
|
QLabel *m_filterInfoLabel;
|
2012-11-17 19:26:55 +01:00
|
|
|
QLabel *m_filterInfoLabelIcon;
|
2010-11-19 21:11:54 +01:00
|
|
|
unsigned int m_runningThreads;
|
2010-11-20 19:16:04 +01:00
|
|
|
unsigned int m_currentFile;
|
2010-12-10 21:24:42 +01:00
|
|
|
QList<QUuid> m_allJobs;
|
|
|
|
QList<QUuid> m_succeededJobs;
|
|
|
|
QList<QUuid> m_failedJobs;
|
2012-11-11 18:33:55 +01:00
|
|
|
QList<QUuid> m_skippedJobs;
|
2010-11-19 21:11:54 +01:00
|
|
|
bool m_userAborted;
|
2011-12-29 14:42:20 +01:00
|
|
|
bool m_forcedAbort;
|
2012-04-11 00:44:40 +02:00
|
|
|
bool m_firstShow;
|
2010-12-10 22:17:44 +01:00
|
|
|
QSystemTrayIcon *m_systemTray;
|
2011-10-22 01:13:28 +02:00
|
|
|
int m_shutdownFlag;
|
2011-10-29 16:26:09 +02:00
|
|
|
CPUObserverThread *m_cpuObserver;
|
|
|
|
RAMObserverThread *m_ramObserver;
|
2011-03-28 04:26:47 +02:00
|
|
|
DiskObserverThread *m_diskObserver;
|
2011-11-28 00:35:43 +01:00
|
|
|
qint64 m_timerStart;
|
2012-11-11 18:33:55 +01:00
|
|
|
int m_progressViewFilter;
|
2010-11-17 19:35:50 +01:00
|
|
|
};
|