Skip to content

Commit

Permalink
Add initial wizard UI (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Aug 13, 2014
1 parent 466ec77 commit e767ce1
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 18 deletions.
21 changes: 5 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
along with Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#include "mainwindow.h"
#include "mainwizard.h"
#include "os/versioninfo.h"

#ifdef Q_OS_WIN
Expand All @@ -36,15 +36,6 @@
#define ORGANISATION_NAME QLatin1String("Paul Colby")
#define ORGANISATION_DOMAIN QLatin1String("bipolar.colby.id.au")

MainWindow * mainWindow = NULL;

void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
if (mainWindow) {
mainWindow->logMessage(type, context, msg);
}
}

int main(int argc, char *argv[]) {
// Setup the primary Qt application object.
QApplication app(argc, argv);
Expand All @@ -57,8 +48,8 @@ int main(int argc, char *argv[]) {
}

// Install the QErrorMessage class' Qt message handler.
//QErrorMessage::qtHandler();
qInstallMessageHandler(messageHandler);
QErrorMessage::qtHandler();
//qInstallMessageHandler(messageHandler);

// Try to load a localised translator.
QTranslator translator;
Expand Down Expand Up @@ -94,9 +85,7 @@ int main(int argc, char *argv[]) {
#endif

// Instantiate the main window.
mainWindow = new MainWindow;
qDebug() << QApplication::applicationName() << QApplication::applicationVersion()
<< versionInfo.fileInfo(QLatin1String("SpecialBuild"));
mainWindow->show();
MainWizard mainWizard;
mainWizard.show();
return app.exec();
}
31 changes: 31 additions & 0 deletions src/widgets/inputspage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#include "inputspage.h"
#include <QVBoxLayout>

InputsPage::InputsPage(QWidget *parent) : QWizardPage(parent) {
setTitle(tr("Select Input Paths"));
setSubTitle(tr("Select the path(s) containing training sessions to convert."));

setLayout(new QVBoxLayout());
}

//bool InputPage::isComplete() const {
//}
34 changes: 34 additions & 0 deletions src/widgets/inputspage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __INPUTS_PAGE__
#define __INPUTS_PAGE__

#include <QWizardPage>

class InputsPage : public QWizardPage {
Q_OBJECT

public:
InputsPage(QWidget *parent=0);
//virtual bool isComplete() const;

};

#endif // __INPUTS_PAGE__
34 changes: 34 additions & 0 deletions src/widgets/mainwizard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#include "mainwizard.h"
#include "inputspage.h"
#include "outputspage.h"
#include <QApplication>

MainWizard::MainWizard(QWidget *parent, Qt::WindowFlags flags): QWizard(parent,flags) {
setWindowTitle(tr("%1 %2")
.arg(QApplication::applicationName())
.arg(QStringList(QApplication::applicationVersion().split(QLatin1Char('.')).mid(0, 3)).join(QLatin1Char('.'))));

addPage(new InputsPage());
addPage(new OutputsPage());

setButtonText(FinishButton, tr("Convert"));
}
33 changes: 33 additions & 0 deletions src/widgets/mainwizard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __MAIN_WIZARD__
#define __MAIN_WIZARD__

#include <QWizard>

class MainWizard : public QWizard {
Q_OBJECT

public:
MainWizard(QWidget *parent=0, Qt::WindowFlags flags=0);

};

#endif // __MAIN_WIZARD__
31 changes: 31 additions & 0 deletions src/widgets/outputspage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#include "outputspage.h"
#include <QVBoxLayout>

OutputsPage::OutputsPage(QWidget *parent) : QWizardPage(parent) {
setTitle(tr("Select Output Paths"));
setSubTitle(tr("Select the blah blah blah."));

setLayout(new QVBoxLayout());
}

//bool InputPage::isComplete() const {
//}
34 changes: 34 additions & 0 deletions src/widgets/outputspage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2014 Paul Colby
This file is part of Bipolar.
Bipolar 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 3 of the License, or
(at your option) any later version.
Biplar 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 Bipolar. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __OUTPUTS_PAGE__
#define __OUTPUTS_PAGE__

#include <QWizardPage>

class OutputsPage : public QWizardPage {
Q_OBJECT

public:
OutputsPage(QWidget *parent=0);
//virtual bool isComplete() const;

};

#endif // __OUTPUTS_PAGE__
4 changes: 2 additions & 2 deletions src/widgets/widgets.pri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INCLUDEPATH += $$PWD
VPATH += $$PWD
HEADERS += mainwindow.h
SOURCES += mainwindow.cpp
HEADERS += inputspage.h mainwizard.h outputspage.h
SOURCES += inputspage.cpp mainwizard.cpp outputspage.cpp

0 comments on commit e767ce1

Please sign in to comment.