Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Hometrainer source code (version 2.0)

 

Hometrainer source code (version 1.8).

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ToolHometrainerDesktop.pro

 

#-------------------------------------------------
#
# Project created by QtCreator 2011-04-11T09:14:30
#
#-------------------------------------------------

QT       += core gui

TARGET = ToolTestOpenQuestionDesktop
TEMPLATE = app

QMAKE_CXXFLAGS += -std=c++0x

INCLUDEPATH += \
    ../../Classes/CppAbout \
    ../../Classes/CppMultipleChoiceQuestion \
    ../../Classes/CppMultipleChoiceQuestionDialog \
    ../../Classes/CppOpenQuestion \
    ../../Classes/CppOpenQuestionDialog \
    ../../Classes/CppQtAboutDialog \
    ../../Classes/CppQtMultipleChoiceQuestionDialog \
    ../../Classes/CppQtOpenQuestionDialog \
    ../../Classes/CppQtQuestionDialog \
    ../../Classes/CppQuestion \
    ../../Classes/CppQtQuestionDialog

SOURCES += qtmain.cpp \
    ../../Classes/CppAbout/about.cpp \
    ../../Classes/CppMultipleChoiceQuestion/multiplechoicequestion.cpp \
    ../../Classes/CppMultipleChoiceQuestionDialog/multiplechoicequestiondialog.cpp \
    ../../Classes/CppOpenQuestion/openquestion.cpp \
    ../../Classes/CppOpenQuestionDialog/openquestiondialog.cpp \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.cpp \
    ../../Classes/CppQtMultipleChoiceQuestionDialog/qtmultiplechoicequestiondialog.cpp \
    ../../Classes/CppQtOpenQuestionDialog/qtopenquestiondialog.cpp \
    ../../Classes/CppQtQuestionDialog/qtquestiondialog.cpp \
    ../../Classes/CppQuestion/question.cpp \
    ../../Classes/CppQtQuestionDialog/questiondialog.cpp \
    qttestquestionmaindialog.cpp \
    qttestquestionmenudialog.cpp \
    testquestionmaindialog.cpp \
    testquestionmenudialog.cpp

HEADERS  += \
    ../../Classes/CppAbout/about.h \
    ../../Classes/CppMultipleChoiceQuestion/multiplechoicequestion.h \
    ../../Classes/CppMultipleChoiceQuestionDialog/multiplechoicequestiondialog.h \
    ../../Classes/CppOpenQuestion/openquestion.h \
    ../../Classes/CppOpenQuestionDialog/openquestiondialog.h \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.h \
    ../../Classes/CppQtMultipleChoiceQuestionDialog/qtmultiplechoicequestiondialog.h \
    ../../Classes/CppQtOpenQuestionDialog/qtopenquestiondialog.h \
    ../../Classes/CppQtQuestionDialog/qtquestiondialog.h \
    ../../Classes/CppQuestion/question.h \
    ../../Classes/CppQtQuestionDialog/questiondialog.h \
    qttestquestionmaindialog.h \
    qttestquestionmenudialog.h \
    testquestionmaindialog.h \
    testquestionmenudialog.h

FORMS += \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.ui \
    ../../Classes/CppQtMultipleChoiceQuestionDialog/qtmultiplechoicequestiondialog.ui \
    ../../Classes/CppQtOpenQuestionDialog/qtopenquestiondialog.ui \
    qttestquestionmaindialog.ui \
    qttestquestionmenudialog.ui

RESOURCES += \
    ToolTestQuestion.qrc

 

 

 

 

 

Qt project file: ToolHometrainerWebsite.pro

 

#-------------------------------------------------
#
# Project created by QtCreator 2011-04-11T09:14:30
#
#-------------------------------------------------
QT       += core
QT       -= gui
LIBS += \
  -lboost_filesystem \
  -lboost_program_options \
  -lboost_regex \
  -lboost_signals \
  -lboost_system \
  -lwt \
  -lwthttp

QMAKE_CXXFLAGS += -std=c++0x

TARGET = HometrainerWebsite
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app

INCLUDEPATH += \
    ../../Classes/CppAbout \
    ../../Classes/CppExercise \
    ../../Classes/CppMultipleChoiceQuestion \
    ../../Classes/CppMultipleChoiceQuestionDialog \
    ../../Classes/CppOpenQuestion \
    ../../Classes/CppOpenQuestionDialog \
    ../../Classes/CppQuestion \
    ../../Classes/CppQtQuestionDialog \
    ../../Classes/CppTrace \
    ../../Classes/CppWtAboutDialog \
    ../../Classes/CppWtAutoConfig \
    ../../Classes/CppWtExercise \
    ../../Classes/CppWtMultipleChoiceQuestionDialog \
    ../../Classes/CppWtOpenQuestionDialog \
    ../../Classes/CppWtQuestionDialog \
    ../../Classes/CppWtSelectFileDialog

SOURCES += wtmain.cpp \
    ../../Classes/CppAbout/about.cpp \
    ../../Classes/CppMultipleChoiceQuestion/multiplechoicequestion.cpp \
    ../../Classes/CppMultipleChoiceQuestionDialog/multiplechoicequestiondialog.cpp \
    ../../Classes/CppOpenQuestion/openquestion.cpp \
    ../../Classes/CppOpenQuestionDialog/openquestiondialog.cpp \
    ../../Classes/CppWtAboutDialog/wtaboutdialog.cpp \
    ../../Classes/CppWtAutoConfig/wtautoconfig.cpp \
    ../../Classes/CppWtMultipleChoiceQuestionDialog/wtmultiplechoicequestiondialog.cpp \
    ../../Classes/CppWtOpenQuestionDialog/wtopenquestiondialog.cpp \
    ../../Classes/CppWtQuestionDialog/wtquestiondialog.cpp \
    ../../Classes/CppQuestion/question.cpp \
    ../../Classes/CppQtQuestionDialog/questiondialog.cpp \
    wthometrainermenudialog.cpp \
    hometrainermenudialog.cpp \
    hometrainerresources.cpp \
    ../../Classes/CppExercise/exercise.cpp \
    ../../Classes/CppWtExercise/wtexercise.cpp \
    wthometrainerstartexercisedialog.cpp \
    wthometrainerloadexercisedialog.cpp \
    ../../Classes/CppWtSelectFileDialog/wtselectfiledialog.cpp \
    wtselecthometrainerfiledialog.cpp

HEADERS  += \
    ../../Classes/CppAbout/about.h \
    ../../Classes/CppMultipleChoiceQuestion/multiplechoicequestion.h \
    ../../Classes/CppMultipleChoiceQuestionDialog/multiplechoicequestiondialog.h \
    ../../Classes/CppOpenQuestion/openquestion.h \
    ../../Classes/CppOpenQuestionDialog/openquestiondialog.h \
    ../../Classes/CppWtAboutDialog/wtaboutdialog.h \
    ../../Classes/CppWtAutoConfig/wtautoconfig.h \
    ../../Classes/CppWtMultipleChoiceQuestionDialog/wtmultiplechoicequestiondialog.h \
    ../../Classes/CppWtOpenQuestionDialog/wtopenquestiondialog.h \
    ../../Classes/CppWtQuestionDialog/wtquestiondialog.h \
    ../../Classes/CppQuestion/question.h \
    ../../Classes/CppQtQuestionDialog/questiondialog.h \
    hometrainermenudialog.h \
    hometrainerresources.h \
    ../../Classes/CppExercise/exercise.h \
    ../../Classes/CppWtExercise/wtexercise.h \
    wthometrainerstartexercisedialog.h \
    wthometrainerloadexercisedialog.h \
    ../../Classes/CppWtSelectFileDialog/wtselectfiledialog.h \
    wtselecthometrainerfiledialog.h \
    wthometrainermenudialog.h

RESOURCES += \
    ToolHometrainer.qrc

 

 

 

 

 

hometrainermenudialog.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef HOMETRAINERMENUDIALOG_H
#define HOMETRAINERMENUDIALOG_H
//---------------------------------------------------------------------------
#include "about.h"
//---------------------------------------------------------------------------
///The logic behind the menu dialog
struct HometrainerMenuDialog
{
  ///Creates the resources needed
  HometrainerMenuDialog();

  ///Obtain the about information
  ///
  ///\note
  ///This is a non-static method, to ensure users of this class
  ///call HometrainerMenuDialog its constructor: this is where
  ///the resources needed are created
  const About GetAbout() const;

  ///Obtain the version
  static const std::string GetVersion();

  ///Obtain the version history
  static const std::vector<std::string> GetVersionHistory();
};
//---------------------------------------------------------------------------
#endif // HOMETRAINERMENUDIALOG_H

 

 

 

 

 

hometrainermenudialog.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <boost/foreach.hpp>
//---------------------------------------------------------------------------
#include "exercise.h"
#include "multiplechoicequestion.h"
#include "multiplechoicequestiondialog.h"
#include "openquestion.h"
#include "openquestiondialog.h"
#include "question.h"
#include "questiondialog.h"
#include "hometrainermenudialog.h"
//#include "trace.h"
//---------------------------------------------------------------------------
#include <QFile>
//---------------------------------------------------------------------------
HometrainerMenuDialog::HometrainerMenuDialog()
{

}
//---------------------------------------------------------------------------
const About HometrainerMenuDialog::GetAbout() const
{
  About a(
    "Richel Bilderbeek",
    "Hometrainer",
    "exercise and survey suite",
    "the 16th of October 2011",
    "2011",
    "http://www.richelbilderbeek.nl/ToolHometrainer.htm",
    GetVersion(),
    GetVersionHistory());
  a.AddLibrary("Exercise version: " + Exercise::GetVersion());
  a.AddLibrary("Hometrainer version: " + HometrainerMenuDialog::GetVersion());
  a.AddLibrary("MultipleChoiceQuestion version: " + MultipleChoiceQuestion::GetVersion());
  a.AddLibrary("MultipleChoiceQuestionDialog version: " + MultipleChoiceQuestionDialog::GetVersion());
  a.AddLibrary("OpenQuestion version: " + OpenQuestion::GetVersion());
  a.AddLibrary("OpenQuestionDialog version: " + OpenQuestionDialog::GetVersion());
  a.AddLibrary("Question version: " + Question::GetVersion());
  a.AddLibrary("QuestionDialog version: " + QuestionDialog::GetVersion());
  //a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}
//---------------------------------------------------------------------------
const std::string HometrainerMenuDialog::GetVersion()
{
  return "2.0";
}
//---------------------------------------------------------------------------
const std::vector<std::string> HometrainerMenuDialog::GetVersionHistory()
{
  std::vector<std::string> v;
  v.push_back("2009-xx-xx: Version 0.9: initial version (called HomeTrainer)");
  v.push_back("2009-04-28: Version 1.0: renamed 'HomeTrainer' to 'Hometrainer 2'");
  v.push_back("09-05-2009: Version 1.1");
  v.push_back("23-08-2009: Version 1.2");
  v.push_back("29-08-2009: Version 1.3");
  v.push_back("20-09-2009: Version 1.4");
  v.push_back("29-10-2009: Version 1.5");
  v.push_back("03-11-2009: Version 1.6");
  v.push_back("07-01-2010: Version 1.7");
  v.push_back("28-01-2010: Version 1.8");
  v.push_back("16-10-2011: Version 2.0: initial website version, renamed 'Hometrainer 2' to 'Hometrainer'");
  return v;
}
//---------------------------------------------------------------------------

 

 

 

 

 

hometrainerresources.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTWEBSITERESOURCES_H
#define WTWEBSITERESOURCES_H
//---------------------------------------------------------------------------
struct HometrainerResources
{
  HometrainerResources();
  const std::string GetQuestion() const { return "ToolHometrainerQuestion.png"; }
  const std::string GetExerciseClouds() const { return "ToolHometrainerExerciseClouds.txt"; }
  const std::string GetExerciseTest() const { return "ToolHometrainerExerciseTest.txt"; }
  const std::string GetQuestionMark() const { return "ToolHometrainerQuestionmark.png"; }
  const std::string GetWelcome() const { return "ToolHometrainerWelcome.png"; }
};
//---------------------------------------------------------------------------
#endif // WTWEBSITERESOURCES_H

 

 

 

 

 

hometrainerresources.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <cassert>
//---------------------------------------------------------------------------
#include <boost/filesystem.hpp>
//---------------------------------------------------------------------------
#include "trace.h"
#include "hometrainerresources.h"
//---------------------------------------------------------------------------
//Must be #included after Wt header files
#include <QFile>
//---------------------------------------------------------------------------
HometrainerResources::HometrainerResources()
{
  const std::vector<std::string> files
    =
    {
      GetQuestion(),
      GetQuestionMark(),
      GetWelcome(),
      "ToolHometrainerExerciseAdapter.jpg",
      "ToolHometrainerExerciseAuks.jpg",
      "ToolHometrainerExerciseBakMetFilters.jpg",
      "ToolHometrainerExerciseCdSpelerNumarck.jpg",
      "ToolHometrainerExerciseDcc.jpg",
      "ToolHometrainerExerciseDi.jpg",
      "ToolHometrainerExerciseDimmerpack.jpg",
      "ToolHometrainerExerciseDmxMannetjeConnector.jpg",
      "ToolHometrainerExerciseDmxMannetje.jpg",
      "ToolHometrainerExerciseDmxVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseDmxVrouwtje.jpg",
      "ToolHometrainerExerciseEffect.jpg",
      "ToolHometrainerExerciseEuroMannetjeConnector.jpg",
      "ToolHometrainerExerciseEuroVrouwtje.jpg",
      "ToolHometrainerExerciseFilterboekje.jpg",
      "ToolHometrainerExerciseFilterhouder.jpg",
      "ToolHometrainerExerciseFilter.jpg",
      "ToolHometrainerExerciseFiltervellen.jpg",
      "ToolHometrainerExerciseFlightcase.jpg",
      "ToolHometrainerExerciseFresnel.jpg",
      "ToolHometrainerExerciseGeluidstafelAchterkantLinks.jpg",
      "ToolHometrainerExerciseGeluidstafelAchterkantRechts.jpg",
      "ToolHometrainerExerciseGeluidstafelAlesis.jpg",
      "ToolHometrainerExerciseGeluidstafelBovenkantMiddenboven.jpg",
      "ToolHometrainerExerciseGeluidstafelBovenkantMidden.jpg",
      "ToolHometrainerExerciseGeluidstafelBovenkantRechtsboven.jpg",
      "ToolHometrainerExerciseGeluidstafelBovenkantRechtsonder.jpg",
      "ToolHometrainerExerciseGeluidstafelYamaha.jpg",
      "ToolHometrainerExerciseGordijnhaak.jpg",
      "ToolHometrainerExerciseHaspel.jpg",
      "ToolHometrainerExerciseJackMannetjeMono.jpg",
      "ToolHometrainerExerciseJackVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseJackVrouwtjeEnXlrVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseKabeltester.jpg",
      "ToolHometrainerExerciseKrachtstroomMannetjeConnector.jpg",
      "ToolHometrainerExerciseKrachtstroomMannetje.jpg",
      "ToolHometrainerExerciseKrachtstroomVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseLamp500W.jpg",
      "ToolHometrainerExerciseLichtplanDeBruiloften.jpg",
      "ToolHometrainerExerciseLichtplan.jpg",
      "ToolHometrainerExerciseLichttafel.jpg",
      "ToolHometrainerExerciseMdGrijs.jpg",
      "ToolHometrainerExerciseMdSpeler.jpg",
      "ToolHometrainerExerciseMdTransparent.jpg",
      "ToolHometrainerExerciseMicrofoonShureSm58.jpg",
      "ToolHometrainerExerciseMiniJackStereoVrouwJackStereoMan.jpg",
      "ToolHometrainerExerciseMonitorTorqueConnectors.jpg",
      "ToolHometrainerExerciseMultikabelMannetjeConnector.jpg",
      "ToolHometrainerExerciseMultikabelVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseMultimeterMetex.jpg",
      "ToolHometrainerExerciseMultistekkerdoos.jpg",
      "ToolHometrainerExerciseOn.jpg",
      "ToolHometrainerExerciseOpwindstatief.jpg",
      "ToolHometrainerExercisePar.jpg",
      "ToolHometrainerExercisePc.jpg",
      "ToolHometrainerExercisePriklijst.jpg",
      "ToolHometrainerExerciseProfielspot.jpg",
      "ToolHometrainerExerciseRcf322aAchterkant.jpg",
      "ToolHometrainerExerciseRgbLamp.jpg",
      "ToolHometrainerExerciseSafety.jpg",
      "ToolHometrainerExerciseScartMannetje.jpg",
      "ToolHometrainerExerciseSchukoVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseShureSm58.jpg",
      "ToolHometrainerExerciseSpanningsmeterFluke.jpg",
      "ToolHometrainerExerciseSpeakerEvent3000.jpg",
      "ToolHometrainerExerciseSpeakonVrouwSpeakonVrouw.jpg",
      "ToolHometrainerExerciseSpeakonVrouwtjeConnector.jpg",
      "ToolHometrainerExerciseSpringV2.jpg",
      "ToolHometrainerExerciseStandenplot.jpg",
      "ToolHometrainerExerciseStekkerdoos.jpg",
      "ToolHometrainerExerciseTbar.jpg",
      "ToolHometrainerExerciseTrussHaarspeld.jpg",
      "ToolHometrainerExerciseTruss.jpg",
      "ToolHometrainerExerciseTrussklem.jpg",
      "ToolHometrainerExerciseTrussPin.jpg",
      "ToolHometrainerExerciseTrussVerbindingsstuk.jpg",
      "ToolHometrainerExerciseTulpMannetje.jpg",
      "ToolHometrainerExerciseVerloopstukje.jpg",
      "ToolHometrainerExerciseVersterkerSamsonAchterkant.jpg",
      "ToolHometrainerExerciseVersterkerSamson.jpg",
      "ToolHometrainerExerciseVgaVrouwVgaVrouw.jpg",
      "ToolHometrainerExerciseVoetstatief.jpg",
      "ToolHometrainerExerciseWijkenArnhemGenummerd.bmp",
      "ToolHometrainerExerciseXlrMannetjeConnector.jpg",
      "ToolHometrainerExerciseXlrVrouwtje.jpg",
      "ToolHometrainerExerciseZekering.jpg"
  };
  std::for_each(files.begin(),files.end(),
    [](const std::string& s)
    {
      if (!boost::filesystem::exists(s))
      {
        const std::string filename = ":/images/" + s;
        QFile f(filename.c_str());
        f.copy(s.c_str());
        if (!boost::filesystem::exists(s)) { TRACE(s); }
        assert(boost::filesystem::exists(s));
      }
      if (!boost::filesystem::exists(s)) { TRACE(s); }
      assert(boost::filesystem::exists(s));
    }
  );

  {
    const std::vector<std::string> files
    =
    {
      GetExerciseClouds(),
      GetExerciseTest(),
      "ToolHometrainerExerciseClouds.txt",
      "ToolHometrainerExerciseTest.txt",
      "ToolHometrainerExerciseTtBasis.txt",
      "ToolHometrainerExerciseTtGeluid.txt",
      "ToolHometrainerExerciseTtLicht.txt",
      "ToolHometrainerExerciseWijkenArnhem.txt"
    };
    std::for_each(files.begin(),files.end(),
      [](const std::string& filename)
      {
        if (!(QFile::exists(filename.c_str())))
        {
          QFile f( (std::string(":/textfiles/") + filename).c_str() );
          f.copy(filename.c_str());
        }
        if (!boost::filesystem::exists(filename.c_str()))
        {
          std::cerr << "File not found: " << filename << '\n';
        }
        assert(boost::filesystem::exists(filename.c_str()));
      }
    );
  }
{
  const std::vector<std::string> files
  =
  {
    "ToolHometrainerManual.odt"
  };
  std::for_each(files.begin(),files.end(),
    [](const std::string& filename)
    {
      if (!(QFile::exists(filename.c_str())))
      {
        QFile f( (std::string(":/docs/") + filename).c_str() );
        f.copy(filename.c_str());
      }
      if (!boost::filesystem::exists(filename.c_str()))
      {
        std::cerr << "File not found: " << filename << '\n';
      }
      assert(boost::filesystem::exists(filename.c_str()));
    }
  );
}
}
//---------------------------------------------------------------------------

 

 

 

 

 

qtmain.cpp

 

//---------------------------------------------------------------------------
/*
TestQuestion, tool to test the Question and QuestionDialog classes
Copyright (C) 2011 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolTestQuestion.htm
//---------------------------------------------------------------------------
#include <cassert>
//---------------------------------------------------------------------------
#include <boost/foreach.hpp>
//---------------------------------------------------------------------------
#include <QtGui/QApplication>
#include <QFile>
#include "qttestquestionmenudialog.h"
//#include "trace.h"
//---------------------------------------------------------------------------
int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  //START_TRACE();
  QtTestQuestionMenuDialog w;
  w.show();
  return a.exec();
}
//---------------------------------------------------------------------------

 

 

 

 

 

wthometrainerloadexercisedialog.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTHOMETRAINERLOADEXERCISEDIALOG_H
#define WTHOMETRAINERLOADEXERCISEDIALOG_H
//---------------------------------------------------------------------------
#include <vector>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
//---------------------------------------------------------------------------
#include <boost/signals2.hpp>
//---------------------------------------------------------------------------
#include <Wt/WContainerWidget>
//---------------------------------------------------------------------------
struct WtSelectHometrainerFileDialog;
//---------------------------------------------------------------------------
struct WtHometrainerLoadExerciseDialog : public Wt::WContainerWidget
{
  WtHometrainerLoadExerciseDialog();

  ///Check the folder for files again
  void DoRefresh();

  ///When a file is selected, m_signal_selected_file is emitted
  boost::signals2::signal<void (const std::string)> m_signal_selected_file;

  private:
  struct Ui
  {
    Ui();
    Wt::WLabel * const m_label_status;
    WtSelectHometrainerFileDialog * const m_select_file;
  } ui;

  ///OnSelectedFile is called when a file is selected in m_select_file
  ///and emits m_signal_selected_file with the filename
  void OnSelectedFile() const;
};
//---------------------------------------------------------------------------
#endif // WTHOMETRAINERLOADEXERCISEDIALOG_H

 

 

 

 

 

wthometrainerloadexercisedialog.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/signals2.hpp>
//---------------------------------------------------------------------------
#include <Wt/WBreak>
#include <Wt/WFileUpload>
#include <Wt/WGroupBox>
#include <Wt/WLabel>
#include <Wt/WLineEdit>
#include <Wt/WMenu>
#include <Wt/WMenuItem>
#include <Wt/WPushButton>
#include <Wt/WStackedWidget>
//---------------------------------------------------------------------------
#include "exercise.h"
#include "multiplechoicequestion.h"
#include "multiplechoicequestiondialog.h"
#include "openquestion.h"
#include "openquestiondialog.h"
#include "questiondialog.h"
#include "wtaboutdialog.h"
#include "wtexercise.h"
#include "wthometrainerloadexercisedialog.h"
#include "wtopenquestiondialog.h"
#include "wtmultiplechoicequestiondialog.h"
#include "wtselecthometrainerfiledialog.h"
//---------------------------------------------------------------------------
WtHometrainerLoadExerciseDialog::Ui::Ui()
  : m_label_status(new Wt::WLabel("Please select a Hometrainer file")),
    m_select_file(new WtSelectHometrainerFileDialog)
{

}
//---------------------------------------------------------------------------
WtHometrainerLoadExerciseDialog::WtHometrainerLoadExerciseDialog()
{
  this->addWidget(ui.m_select_file);
  this->addWidget(new Wt::WBreak);
  this->addWidget(ui.m_label_status);
  ui.m_select_file->m_signal_selected.connect(
    boost::bind(&WtHometrainerLoadExerciseDialog::OnSelectedFile,this));

}
//---------------------------------------------------------------------------
void WtHometrainerLoadExerciseDialog::DoRefresh()
{
  ui.m_select_file->DoRefresh();
}
//---------------------------------------------------------------------------
void WtHometrainerLoadExerciseDialog::OnSelectedFile() const
{
  const std::string s = std::string("Selected file ") + ui.m_select_file->GetSelectedFile();
  ui.m_label_status->setText(s.c_str());

  //Emit the filename
  m_signal_selected_file(ui.m_select_file->GetSelectedFile());

}
//---------------------------------------------------------------------------

 

 

 

 

 

wthometrainermenudialog.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTHOMETRAINERMENUDIALOG_H
#define WTHOMETRAINERMENUDIALOG_H
//---------------------------------------------------------------------------
#include <Wt/WContainerWidget>
//---------------------------------------------------------------------------
struct WtHometrainerLoadExerciseDialog;
struct WtHometrainerStartExerciseDialog;
//---------------------------------------------------------------------------

struct WtHometrainerMenuDialog : public Wt::WContainerWidget
{
  WtHometrainerMenuDialog();

private:

  struct Ui
  {
    Ui();
    WtHometrainerLoadExerciseDialog * const m_load_exercise;
    WtHometrainerStartExerciseDialog * const m_start_exercise;
  } ui;

  Wt::WWidget * CreateNewAboutDialog() const;
  Wt::WWidget * CreateNewWelcomeDialog() const;

  ///Respond to the user that has selected an exercise file in the 'Load Exercise' dialog
  void OnSelectedFile(const std::string filename);
};
//---------------------------------------------------------------------------


#endif // WTHOMETRAINERMENUDIALOG_H

 

 

 

 

 

wthometrainermenudialog.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <cassert>
//---------------------------------------------------------------------------
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
//---------------------------------------------------------------------------
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WGroupBox>
#include <Wt/WImage>
#include <Wt/WLabel>
#include <Wt/WStackedWidget>
#include <Wt/WMenu>
#include <Wt/WMenuItem>
//---------------------------------------------------------------------------
#include "hometrainermenudialog.h"
#include "hometrainerresources.h"
#include "wtaboutdialog.h"
#include "wtautoconfig.h"
#include "wtexercise.h"
#include "wthometrainerloadexercisedialog.h"
#include "wthometrainerstartexercisedialog.h"
#include "wthometrainermenudialog.h"
#include "wtmultiplechoicequestiondialog.h"
#include "wtopenquestiondialog.h"
#include "wtquestiondialog.h"
#include "wtselectfiledialog.h"
//---------------------------------------------------------------------------
#include <QFile>
//---------------------------------------------------------------------------
WtHometrainerMenuDialog::Ui::Ui()
  : m_load_exercise(new WtHometrainerLoadExerciseDialog),
    m_start_exercise(new WtHometrainerStartExerciseDialog)
{

}
//---------------------------------------------------------------------------
WtHometrainerMenuDialog::WtHometrainerMenuDialog()
{
  HometrainerResources();
  ui.m_load_exercise->DoRefresh();

  this->setContentAlignment(Wt::AlignCenter);
  {
    Wt::WLabel * const title = new Wt::WLabel("Hometrainer");
    title->setStyleClass("title");
    this->addWidget(title);
  }
  //Menu
  {
    Wt::WStackedWidget * const contents = new Wt::WStackedWidget;
    Wt::WMenu * const menu = new Wt::WMenu(contents,Wt::Horizontal);
    menu->setStyleClass("menu");
    {
      Wt::WMenuItem * const item = new Wt::WMenuItem(
        "Welcome",
        CreateNewWelcomeDialog());
      menu->addItem(item);
    }
    {
      Wt::WMenuItem * const item = new Wt::WMenuItem(
        "Load exercise",
        ui.m_load_exercise);
      menu->addItem(item);
    }
    {
      Wt::WMenuItem * const item = new Wt::WMenuItem(
        "Start exercise",
        ui.m_start_exercise);
      menu->addItem(item);
    }
    {
      Wt::WMenuItem * const item = new Wt::WMenuItem(
        "About",
        CreateNewAboutDialog());
      menu->addItem(item);
    }
    //Display menu on top
    this->addWidget(menu);
    this->addWidget(new Wt::WBreak);
    //Display contents below menu
    this->addWidget(contents);
  }

  ui.m_load_exercise->m_signal_selected_file.connect(
    boost::bind(&WtHometrainerMenuDialog::OnSelectedFile,this,boost::lambda::_1));
}
//---------------------------------------------------------------------------
Wt::WWidget * WtHometrainerMenuDialog::CreateNewAboutDialog() const
{
  HometrainerMenuDialog dialog;
  About a = dialog.GetAbout();
  a.AddLibrary("WtAutoConfig version: " + WtAutoConfig::GetVersion());
  a.AddLibrary("WtExercise version: " + WtExercise::GetVersion());
  a.AddLibrary("WtMultipleChoiceQuestionDialog version: " + WtMultipleChoiceQuestionDialog::GetVersion());
  a.AddLibrary("WtOpenQuestionDialog version: " + WtOpenQuestionDialog::GetVersion());
  a.AddLibrary("WtQuestionDialog version: " + WtQuestionDialog::GetVersion());
  a.AddLibrary("WtSelectFileDialog version: " + WtSelectFileDialog::GetVersion());
  WtAboutDialog * const d = new WtAboutDialog(a,false);
  assert(d);
  return d;
}
//---------------------------------------------------------------------------
Wt::WWidget * WtHometrainerMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * const dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to Hometrainer",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("Hometrainer is an exercise and survey suite",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
   Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolHometrainerWelcome.png"));
  return dialog;
}
//---------------------------------------------------------------------------
void WtHometrainerMenuDialog::OnSelectedFile(const std::string filename)
{
  ui.m_start_exercise->LoadExercise(filename);
}
//---------------------------------------------------------------------------


 

 

 

 

 

wthometrainerstartexercisedialog.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTHOMETRAINERSTARTEXERCISEDIALOG_H
#define WTHOMETRAINERSTARTEXERCISEDIALOG_H
//---------------------------------------------------------------------------
#include <vector>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
//---------------------------------------------------------------------------
#include <Wt/WContainerWidget>
//---------------------------------------------------------------------------
struct WtExercise;
//---------------------------------------------------------------------------
struct WtHometrainerStartExerciseDialog : public Wt::WContainerWidget
{
  WtHometrainerStartExerciseDialog();

  void LoadExercise(const std::string& filename);

  private:
  struct Ui
  {
    Ui();
    Wt::WGroupBox * const m_box_exercise;
  } ui;
};
//---------------------------------------------------------------------------
#endif // WTHOMETRAINERSTARTEXERCISEDIALOG_H

 

 

 

 

 

wthometrainerstartexercisedialog.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/numeric/conversion/cast.hpp>
//---------------------------------------------------------------------------
#include <Wt/WBreak>
#include <Wt/WFileUpload>
#include <Wt/WGroupBox>
#include <Wt/WLabel>
#include <Wt/WLineEdit>
#include <Wt/WMenu>
#include <Wt/WMenuItem>
#include <Wt/WPushButton>
#include <Wt/WStackedWidget>
//---------------------------------------------------------------------------
#include "exercise.h"
#include "multiplechoicequestion.h"
#include "multiplechoicequestiondialog.h"
#include "openquestion.h"
#include "openquestiondialog.h"
#include "questiondialog.h"
#include "wtaboutdialog.h"
#include "wtexercise.h"
#include "wtopenquestiondialog.h"
#include "wtmultiplechoicequestiondialog.h"
#include "wthometrainerstartexercisedialog.h"
//---------------------------------------------------------------------------
WtHometrainerStartExerciseDialog::Ui::Ui()
  : m_box_exercise(new Wt::WGroupBox)
{

}
//---------------------------------------------------------------------------
WtHometrainerStartExerciseDialog::WtHometrainerStartExerciseDialog()
{
  ui.m_box_exercise->addWidget(new Wt::WLabel("No exercise loaded: select a file from the 'Load Exercise' menu item"));
  this->addWidget(ui.m_box_exercise);
}
//---------------------------------------------------------------------------
void WtHometrainerStartExerciseDialog::LoadExercise(const std::string& filename)
{
  WtExercise * const exercise = new WtExercise;
  ui.m_box_exercise->clear();
  exercise->SetQuestions(filename);
  ui.m_box_exercise->addWidget(exercise);
}
//---------------------------------------------------------------------------

 

 

 

 

 

wtmain.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <boost/filesystem.hpp>
//---------------------------------------------------------------------------
#include <Wt/WApplication>
#include <Wt/WEnvironment>
//---------------------------------------------------------------------------
#include "hometrainerresources.h"
#include "wtautoconfig.h"
#include "wthometrainermenudialog.h"
#include "wtselectfiledialog.h"
//---------------------------------------------------------------------------
struct WtApplication : public Wt::WApplication
{
  WtApplication(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
  {
    this->setTitle("Hometrainer");
    this->useStyleSheet("wt.css");
    root()->addWidget(new WtHometrainerMenuDialog);
  }
};
//---------------------------------------------------------------------------
Wt::WApplication *createApplication(
  const Wt::WEnvironment& env)
{
  return new WtApplication(env);
}
//---------------------------------------------------------------------------
int main(int argc, char **argv)
{
  WtSelectFileDialog::SetPath(boost::filesystem::path(argv[0]).parent_path().string());
  WtAutoConfig a(argc,argv,createApplication);
  WtAutoConfig::SaveDefaultStylesheet();
  return a.Run();
}
//---------------------------------------------------------------------------

 

 

 

 

 

wtselecthometrainerfiledialog.h

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#ifndef WTSELECTHOMETRAINERFILEDIALOG_H
#define WTSELECTHOMETRAINERFILEDIALOG_H
//---------------------------------------------------------------------------
#include <string>
#include <vector>
//---------------------------------------------------------------------------
#include "wtselectfiledialog.h"
//---------------------------------------------------------------------------
struct WtSelectHometrainerFileDialog : public WtSelectFileDialog
{
  WtSelectHometrainerFileDialog();

  ///The virtual method how to select Hometrainer files from a folder
  const std::vector<std::string> SelectFiles() const;


  private:
  ///GetFirstLineFromFile reads the first line from a file
  static const std::string GetFirstLineFromFile(const std::string& filename);

};
//---------------------------------------------------------------------------
#endif // WTSELECTHOMETRAINERFILEDIALOG_H

 

 

 

 

 

wtselecthometrainerfiledialog.cpp

 

//---------------------------------------------------------------------------
/*
Hometrainer, exercise and survey suite
Copyright (C) 2009 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolHometrainer.htm
//---------------------------------------------------------------------------
#include <fstream>
//---------------------------------------------------------------------------
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
//---------------------------------------------------------------------------
#include <Wt/WLabel>
#include <Wt/WLineEdit>
//---------------------------------------------------------------------------
#include "wtselecthometrainerfiledialog.h"
//---------------------------------------------------------------------------
WtSelectHometrainerFileDialog::WtSelectHometrainerFileDialog()
{
  ui.m_edit_filter->hide();
  ui.m_label_filter->hide();
  OnUpdateDialog();
}
//---------------------------------------------------------------------------
const std::string WtSelectHometrainerFileDialog::GetFirstLineFromFile(
  const std::string& filename)
{
  assert(boost::filesystem::exists(filename));
  std::ifstream in(filename.c_str());
  for (int i=0; !in.eof(); ++i)
  {
    std::string s;
    std::getline(in,s);
    if (!s.empty())
    {
      return boost::algorithm::trim_copy(s);
    }
  }
  return "";
}
//---------------------------------------------------------------------------
const std::vector<std::string> WtSelectHometrainerFileDialog::SelectFiles() const
{
  //Get all filenames
  const std::vector<std::string> all_files = GetFilesInFolder(m_path);

  //Create the regex for a correct text file
  const boost::regex file_regex(".*.txt");

  std::vector<std::string> r;
  //Copy_if(v.begin(),v.end(),
  //  std::back_inserter(w),
  //    boost::regex_match(boost::bind(boost::lambda::_1),txt_file_regex));

  //Copy all filenames matching the regex in the resulting std::vector
  BOOST_FOREACH(const std::string& file, all_files)
  {
    if (boost::regex_match(file,file_regex))
    {
      //File matches regex
      const std::string s = GetFirstLineFromFile(file);
      if (s == "Hometrainer2 (C) 2009 Richel Bilderbeek"
       || s == "Hometrainer (C) 2009 Richel Bilderbeek")
      {
        r.push_back(file);
      }
    }
  }

  std::sort(r.begin(),r.end());
  return r;
}
//---------------------------------------------------------------------------

 

 

 

 

 

crosscompiletowindows.sh

 

#!/bin/sh
#From http://richelbilderbeek.nl/CppQtCrosscompileToWindowsExample15.htm

echo "Cross compiling to Windows"

echo "1/2: Creating Windows makefile"
i686-pc-mingw32-qmake ToolTestDialDesktop.pro

echo "2/2: making makefile"

make

echo "Done"

 

 

 

 

 

zip.sh

 

#!/bin/sh
#zip packs all the files to port into a single .zip file,
#minicking the same folder structure
#Folder structure
# *
#   * Classes
#     * CppAbout
#     * CppExercise
#     * CppMultipleChoiceQuestion
#     * CppMultipleChoiceQuestionDialog
#     * CppOpenQuestion
#     * CppOpenQuestionDialog
#     * CppQtAboutDialog
#     * CppQtMultipleChoiceQuestionDialog
#     * CppQtOpenQuestionDialog
#     * CppQtQuestionDialog
#     * CppQuestion
#     * CppQuestionDialog
#     * CppTrace
#     * CppWtAboutDialog
#     * CppWtAutoConfig
#     * CppWtExercise
#     * CppWtMultipleChoiceQuestionDialog
#     * CppWtOpenQuestionDialog
#     * CppWtQuestionDialog
#     * CppWtSelectFileDialog
#   * Tools
#    * ToolHometrainer

FOLDERNAME=ToolHometrainer
FILENAME=$FOLDERNAME"Source_2_0"
ZIP_FILENAME=$FILENAME".zip"
HTM_FILENAME=$FILENAME".htm"

rm *.user
rm $ZIP_FILENAME
rm $HTM_FILENAME

echo "Converting DIA to PNG"
dia --filter=png ToolHometrainerArchitecture.dia

echo "Mimicking file structure"
mkdir temp_zip
mkdir temp_zip/Classes
mkdir temp_zip/Classes/CppAbout
mkdir temp_zip/Classes/CppExercise
mkdir temp_zip/Classes/CppMultipleChoiceQuestion
mkdir temp_zip/Classes/CppMultipleChoiceQuestionDialog
mkdir temp_zip/Classes/CppOpenQuestion
mkdir temp_zip/Classes/CppOpenQuestionDialog
mkdir temp_zip/Classes/CppQtAboutDialog
mkdir temp_zip/Classes/CppQtMultipleChoiceQuestionDialog
mkdir temp_zip/Classes/CppQtOpenQuestionDialog
mkdir temp_zip/Classes/CppQtQuestionDialog
mkdir temp_zip/Classes/CppQuestion
mkdir temp_zip/Classes/CppQuestionDialog
mkdir temp_zip/Classes/CppTrace
mkdir temp_zip/Classes/CppWtAboutDialog
mkdir temp_zip/Classes/CppWtAutoConfig
mkdir temp_zip/Classes/CppWtExercise
mkdir temp_zip/Classes/CppWtMultipleChoiceQuestionDialog
mkdir temp_zip/Classes/CppWtOpenQuestionDialog
mkdir temp_zip/Classes/CppWtQuestionDialog
mkdir temp_zip/Classes/CppWtSelectFileDialog
mkdir temp_zip/Tools
mkdir temp_zip/Tools/ToolHometrainer

echo "Copying files"
cp ../../Classes/CppAbout/*.* temp_zip/Classes/CppAbout
cp ../../Classes/CppExercise/*.* temp_zip/Classes/CppExercise
cp ../../Classes/CppMultipleChoiceQuestion/*.* temp_zip/Classes/CppMultipleChoiceQuestion
cp ../../Classes/CppMultipleChoiceQuestionDialog/*.* temp_zip/Classes/CppMultipleChoiceQuestionDialog
cp ../../Classes/CppOpenQuestion/*.* temp_zip/Classes/CppOpenQuestion
cp ../../Classes/CppOpenQuestionDialog/*.* temp_zip/Classes/CppOpenQuestionDialog
cp ../../Classes/CppQtAboutDialog/*.* temp_zip/Classes/CppQtAboutDialog
cp ../../Classes/CppQtMultipleChoiceQuestionDialog/*.* temp_zip/Classes/CppQtMultipleChoiceQuestionDialog
cp ../../Classes/CppQtOpenQuestionDialog/*.* temp_zip/Classes/CppQtOpenQuestionDialog
cp ../../Classes/CppQtQuestionDialog/*.* temp_zip/Classes/CppQtQuestionDialog
cp ../../Classes/CppQuestion/*.* temp_zip/Classes/CppQuestion
cp ../../Classes/CppQuestionDialog/*.* temp_zip/Classes/CppQuestionDialog
cp ../../Classes/CppTrace/*.* temp_zip/Classes/CppTrace
cp ../../Classes/CppWtAboutDialog/*.* temp_zip/Classes/CppWtAboutDialog
cp ../../Classes/CppWtAutoConfig/*.* temp_zip/Classes/CppWtAutoConfig
cp ../../Classes/CppWtExercise/*.* temp_zip/Classes/CppWtExercise
cp ../../Classes/CppWtMultipleChoiceQuestionDialog/*.* temp_zip/Classes/CppWtMultipleChoiceQuestionDialog
cp ../../Classes/CppWtOpenQuestionDialog/*.* temp_zip/Classes/CppWtOpenQuestionDialog
cp ../../Classes/CppWtQuestionDialog/*.* temp_zip/Classes/CppWtQuestionDialog
cp ../../Classes/CppWtSelectFileDialog/*.* temp_zip/Classes/CppWtSelectFileDialog
cp ../../Tools/ToolHometrainer/*.* temp_zip/Tools/ToolHometrainer

#echo "Compressing files"
cd temp_zip
zip -r $FILENAME Classes
zip -r $FILENAME Games
zip -r $FILENAME Libraries
zip -r $FILENAME Projects
zip -r $FILENAME Tools
cd ..
cp "temp_zip/"$ZIP_FILENAME $ZIP_FILENAME

echo "Cleaning up"

#Classes
rm temp_zip/Classes/CppAbout/*.*
rm temp_zip/Classes/CppExercise/*.*
rm temp_zip/Classes/CppMultipleChoiceQuestion/*.*
rm temp_zip/Classes/CppMultipleChoiceQuestionDialog/*.*
rm temp_zip/Classes/CppOpenQuestion/*.*
rm temp_zip/Classes/CppOpenQuestionDialog/*.*
rm temp_zip/Classes/CppQtAboutDialog/*.*
rm temp_zip/Classes/CppQtMultipleChoiceQuestionDialog/*.*
rm temp_zip/Classes/CppQtOpenQuestionDialog/*.*
rm temp_zip/Classes/CppQtQuestionDialog/*.*
rm temp_zip/Classes/CppQuestion/*.*
rm temp_zip/Classes/CppQuestionDialog/*.*
rm temp_zip/Classes/CppTrace/*.*
rm temp_zip/Classes/CppWtAboutDialog/*.*
rm temp_zip/Classes/CppWtAutoConfig/*.*
rm temp_zip/Classes/CppWtExercise/*.*
rm temp_zip/Classes/CppWtMultipleChoiceQuestionDialog/*.*
rm temp_zip/Classes/CppWtOpenQuestionDialog/*.*
rm temp_zip/Classes/CppWtQuestionDialog/*.*
rm temp_zip/Classes/CppWtSelectFileDialog/*.*

rmdir temp_zip/Classes/CppAbout
rmdir temp_zip/Classes/CppExercise
rmdir temp_zip/Classes/CppMultipleChoiceQuestion
rmdir temp_zip/Classes/CppMultipleChoiceQuestionDialog
rmdir temp_zip/Classes/CppOpenQuestion
rmdir temp_zip/Classes/CppOpenQuestionDialog
rmdir temp_zip/Classes/CppQtAboutDialog
rmdir temp_zip/Classes/CppQtMultipleChoiceQuestionDialog
rmdir temp_zip/Classes/CppQtOpenQuestionDialog
rmdir temp_zip/Classes/CppQtQuestionDialog
rmdir temp_zip/Classes/CppQuestion
rmdir temp_zip/Classes/CppQuestionDialog
rmdir temp_zip/Classes/CppTrace
rmdir temp_zip/Classes/CppWtAboutDialog
rmdir temp_zip/Classes/CppWtAutoConfig
rmdir temp_zip/Classes/CppWtExercise
rmdir temp_zip/Classes/CppWtMultipleChoiceQuestionDialog
rmdir temp_zip/Classes/CppWtOpenQuestionDialog
rmdir temp_zip/Classes/CppWtQuestionDialog
rmdir temp_zip/Classes/CppWtSelectFileDialog
rmdir temp_zip/Classes

#Tools
rm temp_zip/Tools/ToolHometrainer/*.*
rmdir temp_zip/Tools/ToolHometrainer
rmdir temp_zip/Tools

rm temp_zip/*.*
rmdir temp_zip
echo "Done"

../../Tools/ToolCodeToHtmlConsole-build-desktop/codetohtml --source "../"$FOLDERNAME
cp $FOLDERNAME".htm" $HTM_FILENAME
rm $FOLDERNAME".htm"

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml