Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) TestQtModels

 

TestQtModels is a tool to test my model classes.

 

 

 

 

 

Downloads

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolTestQtModels/ToolTestQtModelsDesktop.pro

 

include(../../DesktopApplication.pri)
include(../../Libraries/Boost.pri)
include(../../Libraries/Fparser.pri)
include(../../Libraries/Qwt.pri)
include(../../Libraries/GeneralConsole.pri)
include(../../Libraries/GeneralDesktop.pri)

include(../../Classes/CppQtMatrix/CppQtMatrix.pri)
include(../../Classes/CppQtModel/CppQtModel.pri)
include(../../Classes/CppMatrix/CppMatrix.pri)
include(ToolTestQtModelsDesktop.pri)

SOURCES += qtmain.cpp

 

 

 

 

 

./ToolTestQtModels/ToolTestQtModelsConsole.pri

 

INCLUDEPATH += \
    ../../Tools/ToolTestQtModels

SOURCES += \
    ../../Tools/ToolTestQtModels/testqtmodelsmenudialog.cpp

HEADERS += \
    ../../Tools/ToolTestQtModels/testqtmodelsmenudialog.h

OTHER_FILES += \
    ../../Tools/ToolTestQtModels/Licence.txt

 

 

 

 

 

./ToolTestQtModels/ToolTestQtModelsDesktop.pri

 

include(../../Tools/ToolTestQtModels/ToolTestQtModelsConsole.pri)

HEADERS += \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmaindialog.h \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmenudialog.h

SOURCES += \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmaindialog.cpp \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmenudialog.cpp

FORMS += \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmaindialog.ui \
    ../../Tools/ToolTestQtModels/qttestqtmodelsmenudialog.ui

 

 

 

 

 

./ToolTestQtModels/ToolTestQtModelsWebsite.pri

 

include(../../Tools/ToolTestQtModels/ToolTestQtModelsConsole.pri)

 

 

 

 

 

./ToolTestQtModels/qtmain.cpp

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <QApplication>
#include "qttestqtmodelsmenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  ribi::QtToolTestQtModelsMenuDialog w;
  w.show();
  return a.exec();
}

 

 

 

 

 

./ToolTestQtModels/qttestqtmodelsmaindialog.h

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#ifndef QTTOOLTESTQTMODELSMAINDIALOG_H
#define QTTOOLTESTQTMODELSMAINDIALOG_H

#include "qthideandshowdialog.h"

namespace Ui {
  class QtToolTestQtModelsMainDialog;
}

namespace ribi {

class QtToolTestQtModelsMainDialog : public QtHideAndShowDialog
{
  Q_OBJECT
  
public:
  explicit QtToolTestQtModelsMainDialog(QWidget *parent = 0);
  QtToolTestQtModelsMainDialog(const QtToolTestQtModelsMainDialog&) = delete;
  QtToolTestQtModelsMainDialog& operator=(const QtToolTestQtModelsMainDialog&) = delete;
  ~QtToolTestQtModelsMainDialog() noexcept;
  
private slots:
  void keyPressEvent(QKeyEvent *);
  void on_button_data_clicked();
  void on_button_headers_clicked();

private:
  Ui::QtToolTestQtModelsMainDialog *ui;

  static std::string CreateRandomText();
  static std::vector<std::string> CreateRandomTexts();

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif

};

} //~namespace ribi

#endif // QTTOOLTESTQTMODELSMAINDIALOG_H

 

 

 

 

 

./ToolTestQtModels/qttestqtmodelsmaindialog.cpp

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "qttestqtmodelsmaindialog.h"

#include <cassert>

#include <boost/lexical_cast.hpp>

#include <QKeyEvent>

#include "matrix.h"
#include "qtublasmatrixdoublemodel.h"
#include "qtublasvectordoublemodel.h"
#include "qtublasvectorintmodel.h"
#include "testtimer.h"
#include "qtstdvectorfunctionmodel.h"
#include "qtstdvectorstringmodel.h"
#include "trace.h"
#include "ui_qttestqtmodelsmaindialog.h"
#pragma GCC diagnostic pop

ribi::QtToolTestQtModelsMainDialog::QtToolTestQtModelsMainDialog(QWidget *parent) :
  QtHideAndShowDialog(parent),
  ui(new Ui::QtToolTestQtModelsMainDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
}

ribi::QtToolTestQtModelsMainDialog::~QtToolTestQtModelsMainDialog() noexcept
{
  delete ui;
}

std::string ribi::QtToolTestQtModelsMainDialog::CreateRandomText()
{
  const int sz = (std::rand() >> 4) % 10;
  std::string s;
  for (int i=0; i!=sz; ++i)
  {
    const std::string t = boost::lexical_cast<std::string,char>('a' + std::rand() % 26);
    s += t;
  }
  return s;
}

std::vector<std::string> ribi::QtToolTestQtModelsMainDialog::CreateRandomTexts()
{
  const int sz = (std::rand() >> 4) % 10;
  std::vector<std::string> v;
  for (int i=0; i!=sz; ++i)
  {
    const std::string s = CreateRandomText();
    v.push_back(s);
  }
  return v;
}

void ribi::QtToolTestQtModelsMainDialog::keyPressEvent(QKeyEvent * event)
{
  if (event->key() == Qt::Key_Escape) { close(); return; }
}

void ribi::QtToolTestQtModelsMainDialog::on_button_data_clicked()
{
  const int index = ui->box_type->currentIndex();
  switch (index)
  {
    case 0:
    {
      typedef QtStdVectorStringModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      std::vector<std::string> v = CreateRandomTexts();
      model->SetRawData(v);
      ui->table->setModel(model);
    }
    break;
    case 1:
    {
      const std::string variable = "x";
      typedef QtStdVectorFunctionModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model(variable);
      const int sz = (std::rand() >> 4) % 10;
      std::vector<std::string> v;
      for (int i=0; i!=sz; ++i)
      {
        const std::string s
          = boost::lexical_cast<std::string>(i)
          + " * " + variable;
        v.push_back(s);
      }
      model->SetRawData(v);
      ui->table->setModel(model);
    }
    break;
    case 2:
    {
      typedef QtUblasMatrixDoubleModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const int n_cols = (std::rand() >> 4) % 10;
      const int n_rows = (std::rand() >> 4) % 10;
      boost::numeric::ublas::matrix<double> m(n_rows,n_cols);
      for (int row=0; row!=n_rows; ++row)
      {
        for (int col=0; col!=n_cols; ++col)
        {
          const double x = boost::numeric_cast<double>(std::rand());
          m(row,col) = x;
        }
      }
      model->SetRawData(m);
      ui->table->setModel(model);
    }
    break;
    case 3:
    {
      typedef QtUblasVectorDoubleModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const int sz = (std::rand() >> 4) % 10;
      boost::numeric::ublas::vector<double> v(sz);
      for (int i=0; i!=sz; ++i)
      {
        const double x = boost::numeric_cast<double>(std::rand());
        v(i) = x;
      }
      model->SetRawData(v);
      ui->table->setModel(model);
    }
    break;
    case 4:
    {
      typedef QtUblasVectorIntModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const int sz = (std::rand() >> 4) % 10;
      boost::numeric::ublas::vector<int> v(sz);
      for (int i=0; i!=sz; ++i)
      {
        const int x = std::rand();
        v(i) = x;
      }
      model->SetRawData(v);
      ui->table->setModel(model);
    }
    break;
    default:
      assert(!"ribi::QtToolTestQtModelsMainDialog::on_button_data_clicked: Unimplemented ui->box_type->currentIndex()");
      throw std::logic_error("ribi::QtToolTestQtModelsMainDialog::on_button_data_clicked: Unimplemented ui->box_type->currentIndex()");
  }

}

void ribi::QtToolTestQtModelsMainDialog::on_button_headers_clicked()
{

  const int index = ui->box_type->currentIndex();
  switch (index)
  {
    case 0:
    {
      typedef QtStdVectorStringModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const std::string h = CreateRandomText();
      const std::vector<std::string> v = CreateRandomTexts();
      model->SetHeaderData(h,v);
      ui->table->setModel(model);
    }
    break;
    case 1:
    {
      const std::string variable = "x";
      typedef QtStdVectorFunctionModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model(variable);
      const std::string h = CreateRandomText();
      const std::vector<std::string> v = CreateRandomTexts();
      model->SetHeaderData(h,v);
      ui->table->setModel(model);
    }
    break;
    case 2:
    {
      typedef QtUblasMatrixDoubleModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const std::vector<std::string> v = CreateRandomTexts();
      const std::vector<std::string> w = CreateRandomTexts();
      model->SetHeaderData(v,w);
      ui->table->setModel(model);
    }
    break;
    case 3:
    {
      typedef QtUblasVectorDoubleModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const std::string h = CreateRandomText();
      const std::vector<std::string> v = CreateRandomTexts();
      model->SetHeaderData(h,v);
      ui->table->setModel(model);
    }
    break;
    case 4:
    {
      typedef QtUblasVectorIntModel Model;
      Model * const model
        = dynamic_cast<Model *>(ui->table->model())
        ? dynamic_cast<Model *>(ui->table->model())
        : new Model;
      const std::string h = CreateRandomText();
      const std::vector<std::string> v = CreateRandomTexts();
      model->SetHeaderData(h,v);
      ui->table->setModel(model);
    }
    break;
    default:
      assert(!"ribi::QtToolTestQtModelsMainDialog::on_button_headers_clicked: Unimplemented ui->box_type->currentIndex()");
      throw std::logic_error("ribi::QtToolTestQtModelsMainDialog::on_button_headers_clicked: Unimplemented ui->box_type->currentIndex()");
  }
}

#ifndef NDEBUG
void ribi::QtToolTestQtModelsMainDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
  {
    QtUblasVectorDoubleModel * const model = new QtUblasVectorDoubleModel;
    assert(model);
    model->SetRawData( Matrix::CreateVector( {                    } ) );
    model->SetRawData( Matrix::CreateVector( { 1.1, 2.2, 3.3      } ) );
    model->SetRawData( Matrix::CreateVector( {                    } ) );
    model->SetRawData( Matrix::CreateVector( {      2.2, 3.3      } ) );
    model->SetRawData( Matrix::CreateVector( {                    } ) );
    model->SetRawData( Matrix::CreateVector( { 1.1, 2.2, 3.3, 4.4 } ) );
    model->SetRawData( Matrix::CreateVector( {                    } ) );
  }
  //Test of dialog
  {
    QtToolTestQtModelsMainDialog d;
    const int n_types = d.ui->box_type->count();
    for (int i=0; i!=n_types; ++i)
    {
      d.ui->box_type->setCurrentIndex(i);
      const int n = 10;
      for (int j=0; j!=n; ++j)
      {
        d.ui->button_data->click();
      }
      for (int j=0; j!=n; ++j)
      {
        d.ui->button_headers->click();
      }
      for (int j=0; j!=n; ++j)
      {
        d.ui->button_headers->click();
        d.ui->button_data->click();
      }
      for (int j=0; j!=n; ++j)
      {
        d.ui->button_data->click();
        d.ui->button_headers->click();
      }
    }
  }
}
#endif

 

 

 

 

 

./ToolTestQtModels/qttestqtmodelsmenudialog.h

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#ifndef QTTOOLTESTQTMODELSMENUDIALOG
#define QTTOOLTESTQTMODELSMENUDIALOG

#include "qthideandshowdialog.h"

namespace Ui {
  class QtToolTestQtModelsMenuDialog;
}

namespace ribi {

class QtToolTestQtModelsMenuDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtToolTestQtModelsMenuDialog(QWidget *parent = 0);
  QtToolTestQtModelsMenuDialog(const QtToolTestQtModelsMenuDialog&) = delete;
  QtToolTestQtModelsMenuDialog& operator=(const QtToolTestQtModelsMenuDialog&) = delete;
  ~QtToolTestQtModelsMenuDialog() noexcept;

protected:
  
  void keyPressEvent(QKeyEvent * event);

private:
  Ui::QtToolTestQtModelsMenuDialog *ui;

private slots:
  void on_button_about_clicked();
  void on_button_quit_clicked();
  void on_button_start_clicked();

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

} //~namespace ribi

#endif // QTTOOLTESTQTMODELSMENUDIALOG

 

 

 

 

 

./ToolTestQtModels/qttestqtmodelsmenudialog.cpp

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qttestqtmodelsmenudialog.h"

#include <QDesktopWidget>
#include <QKeyEvent>

#include "qtaboutdialog.h"
#include "qthideandshowdialog.h"
#include "qtstdvectorfunctionmodel.h"
#include "qtstdvectorstringmodel.h"
#include "qttestqtmodelsmaindialog.h"
#include "qttestqtmodelsmenudialog.h"
#include "qtublasvectorintmodel.h"
#include "qtublasmatrixdoublemodel.h"
#include "testtimer.h"
#include "qtublasvectordoublemodel.h"
#include "testqtmodelsmenudialog.h"
#include "trace.h"
#include "ui_qttestqtmodelsmenudialog.h"
#pragma GCC diagnostic pop

ribi::QtToolTestQtModelsMenuDialog::QtToolTestQtModelsMenuDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtToolTestQtModelsMenuDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
}

ribi::QtToolTestQtModelsMenuDialog::~QtToolTestQtModelsMenuDialog() noexcept
{
  delete ui;
}

void ribi::QtToolTestQtModelsMenuDialog::keyPressEvent(QKeyEvent * event)
{
  if (event->key() == Qt::Key_Escape) { close(); return; }
}

void ribi::QtToolTestQtModelsMenuDialog::on_button_about_clicked()
{
  About a = ToolTestQtModelsMenuDialog().GetAbout();
  a.AddLibrary("QtHideAndShowDialog version: " + QtHideAndShowDialog::GetVersion());
  a.AddLibrary("QtStdVectorFunctionModel version: " + QtStdVectorFunctionModel::GetVersion());
  a.AddLibrary("QtStdVectorStringModel version: " + QtStdVectorStringModel::GetVersion());
  a.AddLibrary("QtUblasMatrixDoubleModel version: " + QtUblasMatrixDoubleModel::GetVersion());
  a.AddLibrary("QtUblasVectorDoubleModel version: " + QtUblasVectorDoubleModel::GetVersion());
  a.AddLibrary("QtUblasVectorIntModel version: " + QtUblasVectorIntModel::GetVersion());
  QtAboutDialog d(a);
  d.setWindowIcon(this->windowIcon());
  d.setStyleSheet(this->styleSheet());
  this->ShowChild(&d);
}

void ribi::QtToolTestQtModelsMenuDialog::on_button_quit_clicked()
{
  close();
}

void ribi::QtToolTestQtModelsMenuDialog::on_button_start_clicked()
{
  QtToolTestQtModelsMainDialog d;
  ShowChild(&d);
}

#ifndef NDEBUG
void ribi::QtToolTestQtModelsMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  {
    ToolTestQtModelsMenuDialog();
    QtToolTestQtModelsMainDialog();
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolTestQtModels/testqtmodelsmenudialog.h

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#ifndef TOOLTESTQTMODELSMENUDIALOG_H
#define TOOLTESTQTMODELSMENUDIALOG_H

#include "menudialog.h"

namespace ribi {

struct ToolTestQtModelsMenuDialog final : public MenuDialog
{
  ToolTestQtModelsMenuDialog();
  About GetAbout() const noexcept override;
  Help GetHelp() const noexcept override;
  boost::shared_ptr<const Program> GetProgram() const noexcept override;
  std::string GetVersion() const noexcept override;
  std::vector<std::string> GetVersionHistory() const noexcept override;

  private:
  int ExecuteSpecific(const std::vector<std::string>& argv) noexcept override;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

} //~namespace ribi

#endif // TOOLTESTQTMODELSMENUDIALOG_H

 

 

 

 

 

./ToolTestQtModels/testqtmodelsmenudialog.cpp

 

//---------------------------------------------------------------------------
/*
TestQtModels, tool to test the QtModel classes
Copyright (C) 2013-2015 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/ToolTestQtModels.htm
//---------------------------------------------------------------------------
#include "testqtmodelsmenudialog.h"

#include <cassert>
#include <iostream>

#include "richelbilderbeekprogram.h"
#include "testtimer.h"
#include "trace.h"

ribi::ToolTestQtModelsMenuDialog::ToolTestQtModelsMenuDialog()
{
  #ifndef NDEBUG
  Test();
  #endif
}

int ribi::ToolTestQtModelsMenuDialog::ExecuteSpecific(const std::vector<std::string>& argv) noexcept
{
  const int argc = static_cast<int>(argv.size());
  if (argc == 1)
  {
    std::cout << GetHelp() << '\n';
    return 1;
  }
  assert(!"TODO");
  return 1;
}

ribi::About ribi::ToolTestQtModelsMenuDialog::GetAbout() const noexcept
{
  About a(
    "Richel Bilderbeek",
    "TestQtModels",
    "tool to test the QtModel classes",
    "the 27th of June 2013",
    "2013-2015",
    "http://www.richelbilderbeek.nl/ToolTestQtModels.htm",
    GetVersion(),
    GetVersionHistory());
  a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}

ribi::Help ribi::ToolTestQtModelsMenuDialog::GetHelp() const noexcept
{
  return Help(
    this->GetAbout().GetFileTitle(),
    this->GetAbout().GetFileDescription(),
    {

    },
    {

    }
  );
}

boost::shared_ptr<const ribi::Program> ribi::ToolTestQtModelsMenuDialog::GetProgram() const noexcept
{
  const boost::shared_ptr<const Program> p {
    new ProgramTestQtModels
  };
  assert(p);
  return p;
}

std::string ribi::ToolTestQtModelsMenuDialog::GetVersion() const noexcept
{
  return "1.2";
}

std::vector<std::string> ribi::ToolTestQtModelsMenuDialog::GetVersionHistory() const noexcept
{
  return {
    "2013-05-15: version 1.0: initial version",
    "2013-06-27: version 1.1: added QtUblasVectorIntModel",
    "2013-11-05: version 1.2: conformized for ProjectRichelBilderbeekConsole"
  };
}

#ifndef NDEBUG
void ribi::ToolTestQtModelsMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolTestQtModels/zip.sh

 

#!/bin/sh

echo "Removing user information"
rm *.user

echo "Removing possible temp file"
rm copy.txt
rm tmp.txt


echo "Creating of all main folders"

mkdir temp_zip
mkdir temp_zip/Classes
mkdir temp_zip/Libraries
mkdir temp_zip/Tools

echo "Creating of all subfolders"

mkdir temp_zip/Classes/CppAbout
mkdir temp_zip/Classes/CppMatrix
mkdir temp_zip/Classes/CppQtAboutDialog
mkdir temp_zip/Classes/CppQtHideAndShowDialog
mkdir temp_zip/Classes/CppQtModel
mkdir temp_zip/Classes/CppTrace
mkdir temp_zip/Libraries/fparser4.4.3
mkdir temp_zip/Libraries/fparser4.4.3/extrasrc
mkdir temp_zip/Libraries/fparser4.5.1
mkdir temp_zip/Libraries/fparser4.5.1/extrasrc
mkdir temp_zip/Tools/Classes
mkdir temp_zip/Tools/ToolTestQtModels

echo "Copying files"

cp ../../Classes/CppAbout/Licence.txt temp_zip/Classes/CppAbout/Licence.txt
cp ../../Classes/CppAbout/about.cpp temp_zip/Classes/CppAbout/about.cpp
cp ../../Classes/CppAbout/about.h temp_zip/Classes/CppAbout/about.h
cp ../../Classes/CppMatrix/Licence.txt temp_zip/Classes/CppMatrix/Licence.txt
cp ../../Classes/CppMatrix/matrix.cpp temp_zip/Classes/CppMatrix/matrix.cpp
cp ../../Classes/CppMatrix/matrix.h temp_zip/Classes/CppMatrix/matrix.h
cp ../../Classes/CppQtAboutDialog/Licence.txt temp_zip/Classes/CppQtAboutDialog/Licence.txt
cp ../../Classes/CppQtAboutDialog/qtaboutdialog.cpp temp_zip/Classes/CppQtAboutDialog/qtaboutdialog.cpp
cp ../../Classes/CppQtAboutDialog/qtaboutdialog.h temp_zip/Classes/CppQtAboutDialog/qtaboutdialog.h
cp ../../Classes/CppQtAboutDialog/qtaboutdialog.ui temp_zip/Classes/CppQtAboutDialog/qtaboutdialog.ui
cp ../../Classes/CppQtHideAndShowDialog/Licence.txt temp_zip/Classes/CppQtHideAndShowDialog/Licence.txt
cp ../../Classes/CppQtHideAndShowDialog/qthideandshowdialog.cpp temp_zip/Classes/CppQtHideAndShowDialog/qthideandshowdialog.cpp
cp ../../Classes/CppQtHideAndShowDialog/qthideandshowdialog.h temp_zip/Classes/CppQtHideAndShowDialog/qthideandshowdialog.h
cp ../../Classes/CppQtModel/Licence.txt temp_zip/Classes/CppQtModel/Licence.txt
cp ../../Classes/CppQtModel/qtstdvectorfunctionmodel.cpp temp_zip/Classes/CppQtModel/qtstdvectorfunctionmodel.cpp
cp ../../Classes/CppQtModel/qtstdvectorfunctionmodel.h temp_zip/Classes/CppQtModel/qtstdvectorfunctionmodel.h
cp ../../Classes/CppQtModel/qtstdvectorstringmodel.cpp temp_zip/Classes/CppQtModel/qtstdvectorstringmodel.cpp
cp ../../Classes/CppQtModel/qtstdvectorstringmodel.h temp_zip/Classes/CppQtModel/qtstdvectorstringmodel.h
cp ../../Classes/CppQtModel/qtublasmatrixdoublemodel.cpp temp_zip/Classes/CppQtModel/qtublasmatrixdoublemodel.cpp
cp ../../Classes/CppQtModel/qtublasmatrixdoublemodel.h temp_zip/Classes/CppQtModel/qtublasmatrixdoublemodel.h
cp ../../Classes/CppQtModel/qtublasvectordoublemodel.cpp temp_zip/Classes/CppQtModel/qtublasvectordoublemodel.cpp
cp ../../Classes/CppQtModel/qtublasvectordoublemodel.h temp_zip/Classes/CppQtModel/qtublasvectordoublemodel.h
cp ../../Classes/CppTrace/Licence.txt temp_zip/Classes/CppTrace/Licence.txt
cp ../../Classes/CppTrace/trace.h temp_zip/Classes/CppTrace/trace.h
cp ../../Libraries/fparser4.4.3/extrasrc/fp_identifier_parser.inc temp_zip/Libraries/fparser4.4.3/extrasrc/fp_identifier_parser.inc
cp ../../Libraries/fparser4.4.3/extrasrc/fp_opcode_add.inc temp_zip/Libraries/fparser4.4.3/extrasrc/fp_opcode_add.inc
cp ../../Libraries/fparser4.4.3/extrasrc/fpaux.hh temp_zip/Libraries/fparser4.4.3/extrasrc/fpaux.hh
cp ../../Libraries/fparser4.4.3/extrasrc/fptypes.hh temp_zip/Libraries/fparser4.4.3/extrasrc/fptypes.hh
cp ../../Libraries/fparser4.4.3/fparser.cc temp_zip/Libraries/fparser4.4.3/fparser.cc
cp ../../Libraries/fparser4.4.3/fparser.hh temp_zip/Libraries/fparser4.4.3/fparser.hh
cp ../../Libraries/fparser4.4.3/fpconfig.hh temp_zip/Libraries/fparser4.4.3/fpconfig.hh
cp ../../Libraries/fparser4.5.1/extrasrc/fp_identifier_parser.inc temp_zip/Libraries/fparser4.5.1/extrasrc/fp_identifier_parser.inc
cp ../../Libraries/fparser4.5.1/extrasrc/fp_opcode_add.inc temp_zip/Libraries/fparser4.5.1/extrasrc/fp_opcode_add.inc
cp ../../Libraries/fparser4.5.1/extrasrc/fpaux.hh temp_zip/Libraries/fparser4.5.1/extrasrc/fpaux.hh
cp ../../Libraries/fparser4.5.1/extrasrc/fptypes.hh temp_zip/Libraries/fparser4.5.1/extrasrc/fptypes.hh
cp ../../Libraries/fparser4.5.1/fparser.cc temp_zip/Libraries/fparser4.5.1/fparser.cc
cp ../../Libraries/fparser4.5.1/fparser.hh temp_zip/Libraries/fparser4.5.1/fparser.hh
cp ../../Libraries/fparser4.5.1/fpconfig.hh temp_zip/Libraries/fparser4.5.1/fpconfig.hh
cp ../../Tools/Classes/CppAbout temp_zip/Tools/Classes/CppAbout
cp ../../Tools/Classes/CppMatrix temp_zip/Tools/Classes/CppMatrix
cp ../../Tools/Classes/CppQtAboutDialog temp_zip/Tools/Classes/CppQtAboutDialog
cp ../../Tools/Classes/CppQtHideAndShowDialog temp_zip/Tools/Classes/CppQtHideAndShowDialog
cp ../../Tools/Classes/CppQtModel temp_zip/Tools/Classes/CppQtModel
cp ../../Tools/Classes/CppTrace temp_zip/Tools/Classes/CppTrace
cp ../../Tools/ToolTestQtModels/INCLUDEPATH+= temp_zip/Tools/ToolTestQtModels/INCLUDEPATH+=
cp ../../Tools/ToolTestQtModels/Licence.txt temp_zip/Tools/ToolTestQtModels/Licence.txt
cp ../../Tools/ToolTestQtModels/SOURCES+= temp_zip/Tools/ToolTestQtModels/SOURCES+=
cp ../../Tools/ToolTestQtModels/ToolTestQtModels.pro temp_zip/Tools/ToolTestQtModels/ToolTestQtModels.pro
cp ../../Tools/ToolTestQtModels/qtmain.cpp temp_zip/Tools/ToolTestQtModels/qtmain.cpp
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.cpp temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.cpp
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.h temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.h
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.ui temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmaindialog.ui
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.cpp temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.cpp
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.h temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.h
cp ../../Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.ui temp_zip/Tools/ToolTestQtModels/qttooltestqtmodelsmenudialog.ui
cp ../../Tools/ToolTestQtModels/tooltestqtmodelsmenudialog.cpp temp_zip/Tools/ToolTestQtModels/tooltestqtmodelsmenudialog.cpp
cp ../../Tools/ToolTestQtModels/tooltestqtmodelsmenudialog.h temp_zip/Tools/ToolTestQtModels/tooltestqtmodelsmenudialog.h
cp ../../Tools/ToolTestQtModels/zip.sh temp_zip/Tools/ToolTestQtModels/zip.sh

FILENAME="ToolTestQtModelsSource"
ZIP_FILENAME=$FILENAME".zip"

echo "Compressing files"

cd temp_zip
zip -r $FILENAME Classes
zip -r $FILENAME Libraries
zip -r $FILENAME Tools
cd ..
cp "temp_zip/"$ZIP_FILENAME $ZIP_FILENAME

echo "Cleaning up"

echo "Emptying subfolders"

rm temp_zip/Classes/CppAbout/*.*
rm temp_zip/Classes/CppMatrix/*.*
rm temp_zip/Classes/CppQtAboutDialog/*.*
rm temp_zip/Classes/CppQtHideAndShowDialog/*.*
rm temp_zip/Classes/CppQtModel/*.*
rm temp_zip/Classes/CppTrace/*.*
rm temp_zip/Libraries/fparser4.4.3/*.*
rm temp_zip/Libraries/fparser4.4.3/extrasrc/*.*
rm temp_zip/Libraries/fparser4.5.1/*.*
rm temp_zip/Libraries/fparser4.5.1/extrasrc/*.*
rm temp_zip/Tools/Classes/*.*
rm temp_zip/Tools/ToolTestQtModels/*.*

echo "Removing subfolders"

rmdir temp_zip/Classes/CppAbout
rmdir temp_zip/Classes/CppMatrix
rmdir temp_zip/Classes/CppQtAboutDialog
rmdir temp_zip/Classes/CppQtHideAndShowDialog
rmdir temp_zip/Classes/CppQtModel
rmdir temp_zip/Classes/CppTrace
rmdir temp_zip/Libraries/fparser4.4.3/extrasrc
rmdir temp_zip/Libraries/fparser4.4.3
rmdir temp_zip/Libraries/fparser4.5.1/extrasrc
rmdir temp_zip/Libraries/fparser4.5.1
rmdir temp_zip/Tools/Classes
rmdir temp_zip/Tools/ToolTestQtModels

echo "Removing main folders"

rmdir temp_zip/Classes
rmdir temp_zip/Libraries
rmdir temp_zip/Tools

echo "Removing temporary folder"

rm temp_zip/*.*
rmdir temp_zip

echo "Done"

# CreateQtProjectZipFile, version 1.3
# Copyright (C) 2012 Richel Bilderbeek
# Programmed on the 10th of June 2012
# by Richel Bilderbeek
#
# CreateQtProjectZipFile can be downloaded from http://www.richelbilderbeek.nl/ToolCreateQtProjectZipFile.htm
# Licenced under GPL 3.0

 

 

 

 

 

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