Skip to content

Commit

Permalink
Use Bionic and C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Aug 8, 2019
1 parent 282ac5a commit 9616cf5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 91 deletions.
76 changes: 25 additions & 51 deletions CppWtAboutDialog/wtaboutdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
//---------------------------------------------------------------------------
/*
WtAboutDialog, Wt dialog for displaying the About class
Copyright (C) 2010-2016 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/CppWtAboutDialog.htm
//---------------------------------------------------------------------------
#include "wtaboutdialog.h"

#include <string>






#include <Wt/WBreak>
#include <Wt/WBreak.h>
#ifndef _WIN32
#include <Wt/WConfig.h>
#endif
#include <Wt/WLabel>
#include <Wt/WTextArea>

#include <Wt/WLabel.h>
#include <Wt/WTextArea.h>

ribi::WtAboutDialog::WtAboutDialog(
const About& about_original,
Expand All @@ -45,74 +19,74 @@ ribi::WtAboutDialog::WtAboutDialog(
about.AddLibrary("Wt version: " + GetWtVersion());
about.AddLibrary("WtAboutDialog version: " + GetVersion());

this->setContentAlignment(Wt::AlignCenter);
this->setContentAlignment(Wt::AlignmentFlag::Center);
const int min_width = 800;
//Display the general about text
{
const std::vector<std::string> v = about.CreateAboutText();
for(const auto s: v)
for(const auto& s: v)
{
new Wt::WLabel(s.c_str(),this);
this->addWidget(new Wt::WBreak);
this->addWidget(std::make_unique<Wt::WLabel>(s.c_str()));
}
}
this->addWidget(new Wt::WBreak);
this->addWidget(std::make_unique<Wt::WBreak>());
//Display the libraries used text
{
Wt::WTextArea * text = new Wt::WTextArea;
auto text = std::make_unique<Wt::WTextArea>();
{
const std::vector<std::string> v = about.CreateLibrariesUsedText();
std::string s;
for(const auto t: v) { s+=t; s+="\n"; }
for(const auto& t: v) { s+=t; s+="\n"; }
text->setText(s);
}
text->setMinimumSize(min_width,100);
text->setReadOnly(true);
this->addWidget(text);
this->addWidget(std::move(text));
}
this->addWidget(new Wt::WBreak);
this->addWidget(std::make_unique<Wt::WBreak>());
//Display the version history
{
Wt::WTextArea * text = new Wt::WTextArea;
auto text = std::make_unique<Wt::WTextArea>();
{
const std::vector<std::string> v = about.CreateVersionHistory();
std::string s;
for(const auto t: v) { s+=t; s+="\n"; }
for(const auto& t: v) { s+=t; s+="\n"; }
text->setText(s);
}
text->setMinimumSize(min_width,100);
text->setReadOnly(true);
this->addWidget(text);
this->addWidget(std::move(text));
}
this->addWidget(new Wt::WBreak);
this->addWidget(std::make_unique<Wt::WBreak>());
//Display the licence text
{
Wt::WTextArea * text = new Wt::WTextArea;
auto text = std::make_unique<Wt::WTextArea>();
{
const std::vector<std::string> v = about.CreateLicenceText();
std::string s;
for(const auto t: v) { s+=t; s+="\n"; }
for(const auto& t: v) { s+=t; s+="\n"; }
text->setText(s);
}
text->setMinimumSize(min_width,100);
text->setReadOnly(true);
this->addWidget(text);
this->addWidget(std::move(text));
}
addWidget(new Wt::WBreak);
this->addWidget(std::make_unique<Wt::WBreak>());
{
const std::string s
= std::string("Source code built at ")
+ std::string(__DATE__)
+ std::string(" ")
+ std::string(__TIME__);
new Wt::WLabel(s.c_str(),this);
this->addWidget(new Wt::WBreak);
+ std::string(__TIME__)
;
this->addWidget(std::make_unique<Wt::WLabel>(s.c_str()));
this->addWidget(std::make_unique<Wt::WBreak>());
}

if (display_close_button)
{
this->addWidget(new Wt::WBreak);
this->addWidget(m_button_close);
this->addWidget(std::make_unique<Wt::WBreak>());
m_button_close = addWidget(std::make_unique<Wt::WPushButton>());
m_button_close->setText("Close");
m_button_close->clicked().connect(
this,&ribi::WtAboutDialog::OnClose);
Expand Down
10 changes: 3 additions & 7 deletions CppWtAboutDialog/wtaboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string>
#include <vector>





#include <boost/signals2.hpp>

#include <Wt/WContainerWidget>
#include <Wt/WPushButton>
#include <Wt/WContainerWidget.h>
#include <Wt/WPushButton.h>

#include "about.h"

Expand All @@ -56,7 +52,7 @@ struct WtAboutDialog : public Wt::WContainerWidget
///From http://www.richelbilderbeek.nl/CppGetWtVersion.htm
static std::string GetWtVersion();
private:
Wt::WPushButton * const m_button_close;
Wt::WPushButton * m_button_close;
void OnClose();
};

Expand Down
8 changes: 2 additions & 6 deletions CppWtAutoConfig/wtautoconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <fstream>
#include <iostream>





#include <boost/program_options.hpp>

#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WApplication.h>
#include <Wt/WEnvironment.h>

#include "wtautoconfig.h"

Expand Down
29 changes: 2 additions & 27 deletions CppWtAutoConfig/wtautoconfig.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
//---------------------------------------------------------------------------
/*
WtAutoConfig, configures a Wt server in a default way
Copyright (C) 2011-2016 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/CppWtAutoConfig.htm
//---------------------------------------------------------------------------
#ifndef WTAUTOCONFIG_H
#define WTAUTOCONFIG_H

#include <string>
#include <vector>






#include <memory>

namespace Wt
{
Expand All @@ -42,7 +17,7 @@ namespace ribi {
///server in a default configuration.
struct WtAutoConfig
{
typedef Wt::WApplication * (*FunctionType)(const Wt::WEnvironment&);
typedef std::unique_ptr<Wt::WApplication> (*FunctionType)(const Wt::WEnvironment&);

WtAutoConfig(const int argc, char ** const argv, const FunctionType function);
int Run();
Expand Down

0 comments on commit 9616cf5

Please sign in to comment.