Added command-line support.

This commit is contained in:
LoRd_MuldeR 2013-05-19 23:30:15 +02:00
parent 526da5f0d6
commit feee78444a
2 changed files with 26 additions and 0 deletions

View File

@ -58,6 +58,7 @@ CMainWindow::CMainWindow(const QString &tempFolder, QWidget *parent)
:
QMainWindow(parent),
m_tempFolder(tempFolder),
m_firstShow(true),
ui(new Ui::MainWindow)
{
//Init UI
@ -120,6 +121,30 @@ void CMainWindow::showEvent(QShowEvent *event)
ui->versionLabel->setText(QString("v%1 (%2)").arg(QString().sprintf("%u.%02u", mixp_versionMajor, mixp_versionMinor), getBuildDate().toString(Qt::ISODate)));
resizeEvent(NULL);
setAcceptDrops(true);
if(m_firstShow)
{
const QStringList arguments = qApp->arguments();
for(QStringList::ConstIterator iter = arguments.constBegin(); iter != arguments.constEnd(); iter++)
{
if(QString::compare(*iter, "--open", Qt::CaseInsensitive) == 0)
{
if(++iter != arguments.constEnd())
{
QFileInfo currentFile = QFileInfo(*iter);
if(currentFile.exists() && currentFile.isFile())
{
m_droppedFile = currentFile.canonicalFilePath();
QTimer::singleShot(0, this, SLOT(handleDroppedFile()));
break;
}
continue;
}
break;
}
}
m_firstShow = false;
}
}
void CMainWindow::closeEvent(QCloseEvent *event)

View File

@ -63,6 +63,7 @@ private:
Ui::MainWindow *ui; //for Qt UIC
const QString &m_tempFolder;
bool m_firstShow;
QString m_mediaInfoPath;
HANDLE m_mediaInfoHandle;
QProcess *m_process;