2 * Copyright (C) 2011, Jamie Thompson
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this program; If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include "ProgressWindow.h"
21 #include "SyncerThread.h"
23 #include <QProgressBar>
24 #include <QVBoxLayout>
27 using namespace Windows;
29 ProgressWindow::ProgressWindow(Settings& settings, SyncerThread* syncThread, QWidget *parent) :
30 BaseWindow(settings, parent)
32 CreateContents(syncThread);
35 void ProgressWindow::CreateContents(SyncerThread* syncThread)
37 switch(CurrentSettings().AppMode())
39 case Settings::APPMODE_GUI:
41 QVBoxLayout *layout = new QVBoxLayout();
43 // QLabel* lblTest = new QLabel(CurrentSettings().Directory());
44 // layout->addWidget(lblTest);
45 // //layout->setAlignment(lblTest, Qt::AlignHCenter | Qt::AlignTop);
47 m_ProgressBar = new QProgressBar(this);
48 QObject::connect(syncThread, SIGNAL(EventProcessed(int,int)), this, SLOT(UpdateBar(int,int)));
49 layout->addWidget(m_ProgressBar);
50 //layout->setAlignment(btnChoose, Qt::AlignHCenter);
52 // layout->addWidget(new QLabel());
54 centralWidget()->setLayout(layout);
60 case Settings::APPMODE_CONSOLE:
67 void ProgressWindow::UpdateBar(int message, int total)
69 m_ProgressBar->setMaximum(total);
70 m_ProgressBar->setValue(message);
73 void ProgressWindow::Advance()