Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) CreateGlossary

 

CreateGlossary is a tool to generate the glossaries of this website.

 

 

 

 

 

Downloads

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolCreateGlossary/ToolCreateGlossaryConsole.pro

 

include(../../ConsoleApplication.pri)

include(../../Libraries/Boost.pri)
include(../../Libraries/GeneralConsole.pri)

include(../../Tools/ToolCreateGlossary/ToolCreateGlossaryConsole.pri)

include(../../Classes/CppHtmlPage/CppHtmlPage.pri)


SOURCES += main.cpp

 

 

 

 

 

Qt project file: ./ToolCreateGlossary/ToolCreateGlossaryDesktop.pro

 

include(../../DesktopApplication.pri)

include(../../Libraries/Boost.pri)
include(../../Libraries/GeneralConsole.pri)
include(../../Libraries/GeneralDesktop.pri)

include(../../Classes/CppHtmlPage/CppHtmlPage.pri)
include(../../Tools/ToolCreateGlossary/ToolCreateGlossaryDesktop.pri)

SOURCES += qtmain.cpp

 

 

 

 

 

./ToolCreateGlossary/ToolCreateGlossaryConsole.pri

 

INCLUDEPATH += \
    ../../Tools/ToolCreateGlossary

SOURCES += \
    ../../Tools/ToolCreateGlossary/createglossarymaindialog.cpp \
    ../../Tools/ToolCreateGlossary/createglossarymenudialog.cpp \
    ../../Tools/ToolCreateGlossary/glossarytype.cpp \
    ../../Tools/ToolCreateGlossary/glossarytypes.cpp

HEADERS += \
    ../../Tools/ToolCreateGlossary/createglossarymaindialog.h \
    ../../Tools/ToolCreateGlossary/createglossarymenudialog.h \
    ../../Tools/ToolCreateGlossary/glossarytype.h \
    ../../Tools/ToolCreateGlossary/glossarytypes.h

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

 

 

 

 

 

./ToolCreateGlossary/ToolCreateGlossaryDesktop.pri

 

include(../../Tools/ToolCreateGlossary/ToolCreateGlossaryConsole.pri)

RESOURCES += \
    ../../Tools/ToolCreateGlossary/ToolCreateGlossary.qrc

FORMS += \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.ui \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.ui

SOURCES += \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.cpp \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.cpp

HEADERS += \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.h \
    ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.h

 

 

 

 

 

./ToolCreateGlossary/createglossarymaindialog.h

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#ifndef CREATEGLOSSARYMAINDIALOG_H
#define CREATEGLOSSARYMAINDIALOG_H

#include <string>
#include <vector>

namespace ribi {

struct CreateGlossaryMainDialog
{
  ///Create all glossaries
  CreateGlossaryMainDialog();

  ///Create all glossaries
  void CreateAllGlossaries() const noexcept;

  private:
  ///Create a glossary
  static void CreatePage(
    const std::string& page_name,
    const std::string& page_url,
    const std::string& regex);


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

} //~namespace ribi

#endif // CREATEGLOSSARYMAINDIALOG_H

 

 

 

 

 

./ToolCreateGlossary/createglossarymaindialog.cpp

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "createglossarymaindialog.h"

#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>


#include "fileio.h"
#include "glossarytypes.h"
#include "testtimer.h"
#include "htmlpage.h"
#include "trace.h"

#pragma GCC diagnostic pop

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

void ribi::CreateGlossaryMainDialog::CreateAllGlossaries() const noexcept
{
  for (const auto t: GlossaryTypes().GetAll())
  {
    const auto name = GlossaryTypes().GetPageName(t);
    const auto regex = GlossaryTypes().GetPageRegex(t);
    const auto url = GlossaryTypes().GetPageUrl(t);
    CreatePage(name,url,regex);
  }
}

void ribi::CreateGlossaryMainDialog::CreatePage(
  const std::string& page_name,
  const std::string& page_url,
  const std::string& regex)
{
  const std::string website_folder {
  #ifndef _WIN32
    "/home/richel/GitHubs/RichelbilderbeekNl",
  #else
    "D:\\Projects\\Projects\\RichelbilderbeekNl",
  #endif
  };
  #ifndef NDEBUG
  if (!ribi::fileio::FileIo().IsFolder(website_folder))
  {
    TRACE("ERROR");
    TRACE(website_folder);
  }
  #endif
  assert(ribi::fileio::FileIo().IsFolder(website_folder));

  const std::vector<std::string> pagenames {
    ribi::fileio::FileIo().GetFilesInFolderByRegex(
      website_folder,
      regex)
  };

  std::vector<boost::shared_ptr<const HtmlPage> > pages;
  for (const std::string& s: pagenames)
  {
    const std::string full_path
      = website_folder
      + fileio::FileIo().GetPathSeperator()
      + s;
    #ifndef NDEBUG
    if (!ribi::fileio::FileIo().IsRegularFile(full_path))
    {
      TRACE("ERROR");
      TRACE(full_path);
    }
    #endif
    assert(ribi::fileio::FileIo().IsRegularFile(full_path));
    boost::shared_ptr<const HtmlPage> page {
      new HtmlPage(full_path)
    };
    pages.push_back(page);
  }

  std::sort(pages.begin(),pages.end(),
    [](const boost::shared_ptr<const HtmlPage> lhs,const boost::shared_ptr<const HtmlPage> rhs)
    {
     return *lhs < *rhs;
    }
  );

  std::ofstream f(page_url.c_str());

  f
    << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
    << "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
    << "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n"
    << "<head>\n"
    << "  <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n"
    << "  <title>" << page_name << "</title>\n"
    << "  <meta name=\"description\" content=\"" << page_name << "\"/>\n"
    << "  <meta name=\"keywords\" content=\"" << page_name << " table of content index overview\"/>\n"
    << "  <link rel=\"stylesheet\" href=\"Richelbilderbeek.css\" type=\"text/css\"/>\n"
    << "</head>\n"
    << "<!-- End of head, start of body -->\n"
    << "<body>\n"
    << "<p><a href=\"index.htm\">Go back to Richel Bilderbeek's homepage</a>.</p>\n"
//    << "<p><a href=\"Cpp.htm\">Go back to Richel Bilderbeek's C++ page</a>.</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<!-- Page header -->\n"
    << "<h1><a href=\"" << page_url << "\">" << page_name << "</a></h1>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>This page is generated by the\n"
    << "<a href=\"CppTools.htm\">tool</a> <a href=\"ToolCreateGlossary.htm\">CreateGlossary</a>.</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<ul>\n";

  for(const boost::shared_ptr<const HtmlPage> page: pages)
  {
    if (page->GetTitle() == "Redirection page"
      || page->GetTitle().empty()
      || page->GetFilename().find("_old.htm") != std::string::npos)
    {
      //continue;
    }
    else
    {
      std::string s
        = "  <li><a href=\""
        + ribi::fileio::FileIo().RemovePath(page->GetFilename())
        + "\">"
        + page->GetTitle()
        + "</a></li>";

      s = HtmlPage::ReplaceAll(s,"&","&");
      s = HtmlPage::ReplaceAll(s,"&","&amp;");

      f << s << '\n';
    }
  }

  //TRACE(pagenames.size());

  f
    << "</ul>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>Number of pages: " << pagenames.size() << "</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p>&nbsp;</p>\n"
//    << "<p><a href=\"Cpp.htm\">Go back to Richel Bilderbeek's C++ page</a>.</p>\n"
    << "<p><a href=\"index.htm\">Go back to Richel Bilderbeek's homepage</a>.</p>\n"
    << "<p>&nbsp;</p>\n"
    << "<p><a href=\"http://validator.w3.org/check?uri=referer\"><img src=\"valid-xhtml10.png\" alt=\"Valid XHTML 1.0 Strict\" height=\"31\" width=\"88\" /></a></p>\n"
    << "</body>\n"
    << "</html>\n";
}

#ifndef NDEBUG
void ribi::CreateGlossaryMainDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  {
    fileio::FileIo();
    GlossaryTypes();
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
  //assert(!"Refactor");
}
#endif

 

 

 

 

 

./ToolCreateGlossary/createglossarymenudialog.h

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#ifndef CREATEGLOSSARYMENUDIALOG_H
#define CREATEGLOSSARYMENUDIALOG_H

#include <string>
#include <vector>

#include "about.h"
#include "menudialog.h"

namespace ribi {

///GUI independent CreateGlossary menu dialog
struct CreateGlossaryMenuDialog final : public MenuDialog
{
  CreateGlossaryMenuDialog();

  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 // CREATEGLOSSARYMENUDIALOG_H

 

 

 

 

 

./ToolCreateGlossary/createglossarymenudialog.cpp

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#include "createglossarymenudialog.h"

#include <cassert>
#include <iostream>

#include "fileio.h"
#include "glossarytypes.h"
#include "createglossarymaindialog.h"
#include "htmlpage.h"
#include "testtimer.h"
#include "richelbilderbeekprogram.h"
#include "trace.h"

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

int ribi::CreateGlossaryMenuDialog::ExecuteSpecific(const std::vector<std::string>&) noexcept
{
  //Just create the glossaries, whatever the input was
  CreateGlossaryMainDialog().CreateAllGlossaries();
  for (const auto t: GlossaryTypes().GetAll())
  {
    std::cout
      << GlossaryTypes().GetPageUrl(t) << ": "
      << (fileio::FileIo().IsRegularFile(GlossaryTypes().GetPageUrl(t)) ? "OK" : "FAIL")
      << std::endl
    ;
  }
  return 0;
}

ribi::About ribi::CreateGlossaryMenuDialog::GetAbout() const noexcept
{
  About a(
    "Richel Bilderbeek",
    "CreateGlossary",
    "tool for creating my site's glossaries",
    "the 11th of August 2012",
    "2012-2015",
    "http://www.richelbilderbeek.nl/ToolCreateGlossary.htm",
    GetVersion(),
    GetVersionHistory()
  );

  a.AddLibrary("HtmlPage version: " + HtmlPage::GetVersion());
  a.AddLibrary("TestTimer version: " + TestTimer::GetVersion());
  a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}

ribi::Help ribi::CreateGlossaryMenuDialog::GetHelp() const noexcept
{
  return ribi::Help(
    GetAbout().GetFileTitle(),
    GetAbout().GetFileDescription(),
    {
      //Options
    },
    {
      //Example uses
    }
  );
}

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

std::string ribi::CreateGlossaryMenuDialog::GetVersion() const noexcept
{
  return "1.3";
}

std::vector<std::string> ribi::CreateGlossaryMenuDialog::GetVersionHistory() const noexcept
{
  return {
    "2011-xx-xx: version 1.0: initial version",
    "2012-08-06: version 1.1: added the creation of more type of glossaries",
    "2012-08-11: version 1.2: add desktop version",
    "2014-08-25: version 1.3: removed create glossaries in tests"
  };
}

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

 

 

 

 

 

./ToolCreateGlossary/glossarytype.h

 

#ifndef GLOSSARYTYPE_H
#define GLOSSARYTYPE_H

namespace ribi {

enum class GlossaryType
{
  command_line,
  cpp,
  game,
  levend_cluedo,
  tool,
  music,
  sitemap,
  n_types //Used for debugging
};

} //~namespace ribi


#endif // GLOSSARYTYPE_H

 

 

 

 

 

./ToolCreateGlossary/glossarytype.cpp

 

#include "glossarytype.h"

 

 

 

 

 

./ToolCreateGlossary/glossarytypes.h

 

#ifndef GLOSSARYTYPES_H
#define GLOSSARYTYPES_H

#include <string>
#include <vector>
#include "glossarytype.h"

namespace ribi {

struct GlossaryTypes
{
  GlossaryTypes();

  std::vector<GlossaryType> GetAll() const noexcept;

  std::string GetPageName(const GlossaryType t) const noexcept;
  std::string GetPageUrl(const GlossaryType t) const noexcept;
  std::string GetPageRegex(const GlossaryType t) const noexcept;

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

} //~namespace ribi

#endif // GLOSSARYTYPES_H

 

 

 

 

 

./ToolCreateGlossary/glossarytypes.cpp

 

#include "glossarytypes.h"

#include <cassert>

#include "testtimer.h"
#include "glossarytypes.h"

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

std::vector<ribi::GlossaryType> ribi::GlossaryTypes::GetAll() const noexcept
{
  const std::vector<GlossaryType> v {
    GlossaryType::command_line,
    GlossaryType::cpp,
    GlossaryType::game,
    GlossaryType::levend_cluedo,
    GlossaryType::tool,
    GlossaryType::music,
    GlossaryType::sitemap
  };
  return v;
}

std::string ribi::GlossaryTypes::GetPageName(const GlossaryType t) const noexcept
{
  switch (t)
  {
    case GlossaryType::command_line: return "Command-line glossary";
    case GlossaryType::cpp: return "C++ glossary";
    case GlossaryType::game: return "Game glossary";
    case GlossaryType::levend_cluedo: return "Levend Cluedo glossary";
    case GlossaryType::tool: return "Tool glossary";
    case GlossaryType::music: return "Music glossary";
    case GlossaryType::sitemap: return "Sitemap";
    case GlossaryType::n_types:
      assert(!"Never use the value GlossaryType::n_types, except for debugging");
      break;
  }
  assert(!"Should not get here");
  return "";
}

std::string ribi::GlossaryTypes::GetPageRegex(const GlossaryType t) const noexcept
{
  switch (t)
  {
    case GlossaryType::command_line: return "Cl.*\\.htm\\>";
    case GlossaryType::cpp: return "Cpp.*\\.htm\\>";
    case GlossaryType::game: return "Game.*\\.htm\\>";
    case GlossaryType::levend_cluedo: return "LevendCluedo.*\\.htm\\>";
    case GlossaryType::tool: return "Tool.*\\.htm\\>";
    case GlossaryType::music: return "(Music|Song|Cd).*\\.htm\\>";
    case GlossaryType::sitemap: return ".*\\.htm\\>";
    case GlossaryType::n_types:
      assert(!"Never use the value GlossaryType::n_types, except for debugging");
      break;
  }
  assert(!"Should not get here");
  return "";
}

std::string ribi::GlossaryTypes::GetPageUrl(const GlossaryType t) const noexcept
{
  switch (t)
  {
    case GlossaryType::command_line: return "ClGlossary.htm";
    case GlossaryType::cpp: return "CppGlossary.htm";
    case GlossaryType::game: return "GameGlossary.htm";
    case GlossaryType::levend_cluedo: return "LevendCluedoGlossary.htm";
    case GlossaryType::tool: return "ToolGlossary.htm";
    case GlossaryType::music: return "MusicGlossary.htm";
    case GlossaryType::sitemap: return "Sitemap.htm";
    case GlossaryType::n_types:
      assert(!"Never use the value GlossaryType::n_types, except for debugging");
      break;
  }
  assert(!"Should not get here");
  return "";
}

#ifndef NDEBUG
void ribi::GlossaryTypes::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
  assert(static_cast<int>(GlossaryTypes().GetAll().size()) == static_cast<int>(GlossaryType::n_types));
  for (const auto t: GlossaryTypes().GetAll()) { assert(!GlossaryTypes().GetPageName(t).empty()); }
  for (const auto t: GlossaryTypes().GetAll()) { assert(!GlossaryTypes().GetPageRegex(t).empty()); }
  for (const auto t: GlossaryTypes().GetAll()) { assert(!GlossaryTypes().GetPageUrl(t).empty()); }
  //assert(!"Refactor");
}
#endif

 

 

 

 

 

./ToolCreateGlossary/main.cpp

 

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <iostream>
#include "createglossarymenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char * argv[])
{
  const std::vector<std::string> args { ribi::MenuDialog::ConvertArguments(argc,argv) };
  return ribi::CreateGlossaryMenuDialog().Execute(args);
}

 

 

 

 

 

./ToolCreateGlossary/qtcreateglossarymaindialog.h

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#ifndef QTCREATEGLOSSARYMAINDIALOG_H
#define QTCREATEGLOSSARYMAINDIALOG_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qthideandshowdialog.h"
#pragma GCC diagnostic pop

namespace Ui {
class QtCreateGlossaryMainDialog;
}

namespace ribi {

class QtCreateGlossaryMainDialog : public QtHideAndShowDialog
{
  Q_OBJECT
    
public:
  explicit QtCreateGlossaryMainDialog(QWidget *parent = 0);
  QtCreateGlossaryMainDialog(const QtCreateGlossaryMainDialog&) = delete;
  QtCreateGlossaryMainDialog& operator=(const QtCreateGlossaryMainDialog&) = delete;
  ~QtCreateGlossaryMainDialog() noexcept;

private:
  Ui::QtCreateGlossaryMainDialog *ui;

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

} //~namespace ribi

#endif // QTCREATEGLOSSARYMAINDIALOG_H

 

 

 

 

 

./ToolCreateGlossary/qtcreateglossarymaindialog.cpp

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qtcreateglossarymaindialog.h"

#include <QTimer>
#include "createglossarymaindialog.h"
#include "ui_qtcreateglossarymaindialog.h"
#include "testtimer.h"
#include "trace.h"
#pragma GCC diagnostic pop

ribi::QtCreateGlossaryMainDialog::QtCreateGlossaryMainDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtCreateGlossaryMainDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
  CreateGlossaryMainDialog().CreateAllGlossaries();
  ui->label->setText("Done!");
}

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

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

 

 

 

 

 

./ToolCreateGlossary/qtcreateglossarymenudialog.h

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#ifndef QTCREATEGLOSSARYMENUDIALOG_H
#define QTCREATEGLOSSARYMENUDIALOG_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qthideandshowdialog.h"
#pragma GCC diagnostic pop

namespace Ui {
  class QtCreateGlossaryMenuDialog;
}

namespace ribi {

class QtCreateGlossaryMenuDialog : public QtHideAndShowDialog
{
  Q_OBJECT

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

private:
  Ui::QtCreateGlossaryMenuDialog *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 // QTCREATEGLOSSARYMENUDIALOG_H

 

 

 

 

 

./ToolCreateGlossary/qtcreateglossarymenudialog.cpp

 

//---------------------------------------------------------------------------
/*
CreateGlossary, tool to create my glossaries
Copyright (C) 2011-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/ToolCreateGlossary.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qtcreateglossarymenudialog.h"

#include "createglossarymenudialog.h"
#include "qtaboutdialog.h"
#include "qtcreateglossarymaindialog.h"
#include "testtimer.h"
#include "ui_qtcreateglossarymenudialog.h"
#include "createglossarymaindialog.h"
#include "trace.h"
#pragma GCC diagnostic pop

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

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

void ribi::QtCreateGlossaryMenuDialog::on_button_about_clicked()
{
  QtAboutDialog d(CreateGlossaryMenuDialog().GetAbout());
  d.setWindowIcon(this->windowIcon());
  d.setStyleSheet(this->styleSheet());
  this->ShowChild(&d);
}

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

void ribi::QtCreateGlossaryMenuDialog::on_button_start_clicked()
{
  QtCreateGlossaryMainDialog d;
  //d.setStyleSheet(this->styleSheet());
  this->ShowChild(&d);
}

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

 

 

 

 

 

./ToolCreateGlossary/qtmain.cpp

 

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QApplication>
#include "qtcreateglossarymenudialog.h"
#include "trace.h"
#pragma GCC diagnostic pop

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

 

 

 

 

 

./ToolCreateGlossary/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/Tools

echo "Creating of all subfolders"

mkdir temp_zip/Classes/CppAbout
mkdir temp_zip/Classes/CppHtmlPage
mkdir temp_zip/Classes/CppQtAboutDialog
mkdir temp_zip/Classes/CppTrace
mkdir temp_zip/Tools/ToolCreateGlossary

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/CppHtmlPage/htmlpage.cpp temp_zip/Classes/CppHtmlPage/htmlpage.cpp
cp ../../Classes/CppHtmlPage/htmlpage.h temp_zip/Classes/CppHtmlPage/htmlpage.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/CppTrace/Licence.txt temp_zip/Classes/CppTrace/Licence.txt
cp ../../Classes/CppTrace/trace.h temp_zip/Classes/CppTrace/trace.h
cp ../../Tools/ToolCreateGlossary/Licence.txt temp_zip/Tools/ToolCreateGlossary/Licence.txt
cp ../../Tools/ToolCreateGlossary/R.png temp_zip/Tools/ToolCreateGlossary/R.png
cp ../../Tools/ToolCreateGlossary/ToolCreateGlossary.qrc temp_zip/Tools/ToolCreateGlossary/ToolCreateGlossary.qrc
cp ../../Tools/ToolCreateGlossary/ToolCreateGlossaryConsole.pro temp_zip/Tools/ToolCreateGlossary/ToolCreateGlossaryConsole.pro
cp ../../Tools/ToolCreateGlossary/ToolCreateGlossaryDesktop.pro temp_zip/Tools/ToolCreateGlossary/ToolCreateGlossaryDesktop.pro
cp ../../Tools/ToolCreateGlossary/createglossarymaindialog.cpp temp_zip/Tools/ToolCreateGlossary/createglossarymaindialog.cpp
cp ../../Tools/ToolCreateGlossary/createglossarymaindialog.h temp_zip/Tools/ToolCreateGlossary/createglossarymaindialog.h
cp ../../Tools/ToolCreateGlossary/createglossarymenudialog.cpp temp_zip/Tools/ToolCreateGlossary/createglossarymenudialog.cpp
cp ../../Tools/ToolCreateGlossary/createglossarymenudialog.h temp_zip/Tools/ToolCreateGlossary/createglossarymenudialog.h
cp ../../Tools/ToolCreateGlossary/main.cpp temp_zip/Tools/ToolCreateGlossary/main.cpp
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.cpp temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymaindialog.cpp
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.h temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymaindialog.h
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymaindialog.ui temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymaindialog.ui
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.cpp temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymenudialog.cpp
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.h temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymenudialog.h
cp ../../Tools/ToolCreateGlossary/qtcreateglossarymenudialog.ui temp_zip/Tools/ToolCreateGlossary/qtcreateglossarymenudialog.ui
cp ../../Tools/ToolCreateGlossary/qtmain.cpp temp_zip/Tools/ToolCreateGlossary/qtmain.cpp
cp ../../Tools/ToolCreateGlossary/zip.sh temp_zip/Tools/ToolCreateGlossary/zip.sh

FILENAME="ToolCreateGlossarySource"
ZIP_FILENAME=$FILENAME".zip"

echo "Compressing files"

cd temp_zip
zip -r $FILENAME Classes
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/CppHtmlPage/*.*
rm temp_zip/Classes/CppQtAboutDialog/*.*
rm temp_zip/Classes/CppTrace/*.*
rm temp_zip/Tools/ToolCreateGlossary/*.*

echo "Removing subfolders"

rmdir temp_zip/Classes/CppAbout
rmdir temp_zip/Classes/CppHtmlPage
rmdir temp_zip/Classes/CppQtAboutDialog
rmdir temp_zip/Classes/CppTrace
rmdir temp_zip/Tools/ToolCreateGlossary

echo "Removing main folders"

rmdir temp_zip/Classes
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