1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
25 #include "model_jobList.h"
30 ///////////////////////////////////////////////////////////////////////////////
31 // Constructor & Destructor
32 ///////////////////////////////////////////////////////////////////////////////
34 MainWindow::MainWindow(void)
36 //Init the dialog, from the .ui file
38 setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
41 qRegisterMetaType<QUuid>("QUuid");
42 qRegisterMetaType<EncodeThread::JobStatus>("EncodeThread::JobStatus");
45 setMinimumSize(size());
48 setWindowTitle(QString("%1 [%2]").arg(windowTitle(), x264_version_date().toString(Qt::ISODate)));
51 m_jobList = new JobListModel();
52 jobsView->setModel(m_jobList);
55 jobsView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
56 jobsView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
57 jobsView->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
58 jobsView->horizontalHeader()->resizeSection(1, 150);
59 jobsView->horizontalHeader()->resizeSection(2, 90);
60 jobsView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
61 connect(jobsView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(jobSelected(QModelIndex, QModelIndex)));
64 connect(buttonAddJob, SIGNAL(clicked()), this, SLOT(addButtonPressed()));
67 MainWindow::~MainWindow(void)
71 ///////////////////////////////////////////////////////////////////////////////
73 ///////////////////////////////////////////////////////////////////////////////
75 void MainWindow::addButtonPressed(void)
77 EncodeThread *thrd = new EncodeThread();
78 m_jobList->insertJob(thrd);
80 QTimer::singleShot(2500, thrd, SLOT(start()));
83 void MainWindow::jobSelected(const QModelIndex & current, const QModelIndex & previous)
85 qDebug("Job selected: %d", current.row());
86 logView->setModel(m_jobList->getLogFile(current));
87 logView->scrollToBottom();