Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
TestTimedServerPusher is a
web application
to test the WtTimedServerPusher and WtTimedServerPusherClient
in the form of an edit widget, that can be viewed and edited by multiple visitors at the same time.
Downloads
Technical facts
Operating system(s) or programming environment(s)
IDE(s):
Project type:
C++ standard:
Compiler(s):
Libraries used:
STL: GNU ISO C++ Library, version 4.9.2
Qt project file: ./ToolTestTimedServerPusher/ToolTestTimedServerPusherConsole.pro
Qt project file: ./ToolTestTimedServerPusher/ToolTestTimedServerPusherDesktop.pro
Qt project file: ./ToolTestTimedServerPusher/ToolTestTimedServerPusherWebsite.pro
./ToolTestTimedServerPusher/ToolTestTimedServerPusherConsole.pri
./ToolTestTimedServerPusher/ToolTestTimedServerPusherDesktop.pri
./ToolTestTimedServerPusher/ToolTestTimedServerPusherWebsite.pri
./ToolTestTimedServerPusher/testtimedserverpusherdata.h
./ToolTestTimedServerPusher/testtimedserverpusherdata.cpp
//---------------------------------------------------------------------------
/*
TestTimedServerPusher, tool to test WtTimedServerPusher
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/ToolTestTimedServerPusher.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <boost/lexical_cast.hpp>
#include "testtimedserverpusherdata.h"
#pragma GCC diagnostic pop
ribi::ToolTestTimedServerPusher::Data * ribi::ToolTestTimedServerPusher::Data::m_instance = 0;
std::mutex ribi::ToolTestTimedServerPusher::Data::m_mutex;
ribi::ToolTestTimedServerPusher::Data::Data()
: m_time_start(std::time(0)),
//m_s(std::chrono::system_clock::now()),
m_requested(0)
{
}
ribi::ToolTestTimedServerPusher::Data::~Data()
{
}
ribi::ToolTestTimedServerPusher::Data * ribi::ToolTestTimedServerPusher::Data::GetInstance()
{
if (!m_instance)
{
//Double-lock idiom
std::lock_guard<std::mutex> lock(m_mutex);
if (!m_instance)
{
m_instance = new Data;
}
}
return m_instance;
}
std::string ribi::ToolTestTimedServerPusher::Data::GetData() const
{
std::lock_guard<std::mutex> lock(m_mutex);
//std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
//std::chrono::duration<int,1> d = now - m_s;
//const std::string s = std::lexical_cast<std::string>(d);
++m_requested;
const std::string s = boost::lexical_cast<std::string>(
std::difftime(std::time(0),m_time_start))
+ std::string(" seconds, ")
+ boost::lexical_cast<std::string>(m_requested)
+ std::string(" requests ");
return s;
}
|
./ToolTestTimedServerPusher/testtimedserverpushermenudialog.h
./ToolTestTimedServerPusher/testtimedserverpushermenudialog.cpp
//---------------------------------------------------------------------------
/*
TestTimedServerPusher, tool to test WtTimedServerPusher
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/ToolTestTimedServerPusher.htm
//---------------------------------------------------------------------------
#include "testtimedserverpushermenudialog.h"
#include "about.h"
const ribi::About ribi::ToolTestTimedServerPusher::MenuDialog::GetAbout()
{
About a(
"Richel Bilderbeek",
"TestTimedServerPusher",
"tool to test WtTimedServerPusher",
"the 5th of August 2011",
"2011-2015",
"http://www.richelbilderbeek.nl/ToolTestTimedServerPusher.htm",
GetVersion(),
GetVersionHistory());
return a;
}
std::string ribi::ToolTestTimedServerPusher::MenuDialog::GetVersion()
{
return "1.0";
}
std::vector<std::string> ribi::ToolTestTimedServerPusher::MenuDialog::GetVersionHistory()
{
return {
"2011-08-05: Version 1.0: initial version, derived from TestBroadcastServer"
};
}
|
./ToolTestTimedServerPusher/wtmain.cpp
./ToolTestTimedServerPusher/wttesttimedserverpushermaindialog.h
./ToolTestTimedServerPusher/wttesttimedserverpushermaindialog.cpp
./ToolTestTimedServerPusher/wttesttimedserverpushermenudialog.h
./ToolTestTimedServerPusher/wttesttimedserverpushermenudialog.cpp
//---------------------------------------------------------------------------
/*
TestTimedServerPusher, tool to test WtTimedServerPusher
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/ToolTestTimedServerPusher.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLabel>
#include <Wt/WStackedWidget>
#include <Wt/WMenu>
#include <Wt/WMenuItem>
#include "testtimedserverpushermenudialog.h"
#include "wtaboutdialog.h"
#include "wtautoconfig.h"
#include "wttesttimedserverpushermaindialog.h"
#include "wttesttimedserverpushermenudialog.h"
#include "wttimedserverpusher.h"
#include "wttimedserverpusherclient.h"
#pragma GCC diagnostic pop
ribi::ToolTestTimedServerPusher::WtMenuDialog::WtMenuDialog()
{
this->setContentAlignment(Wt::AlignCenter);
{
Wt::WLabel * const title = new Wt::WLabel("TestTimedServerPusher");
title->setStyleClass("title");
this->addWidget(title);
}
//Menu
{
Wt::WStackedWidget * const contents = new Wt::WStackedWidget;
Wt::WMenu * const menu = new Wt::WMenu(contents,Wt::Horizontal);
//Using CSS styleclass is the best (only?) way to display the menu well
menu->setStyleClass("menu");
{
Wt::WMenuItem * const item = new Wt::WMenuItem(
"Welcome",
CreateNewWelcomeDialog());
menu->addItem(item);
}
{
Wt::WMenuItem * const item = new Wt::WMenuItem(
"Start",
CreateNewMainDialog());
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);
}
}
Wt::WWidget * ribi::ToolTestTimedServerPusher::WtMenuDialog::CreateNewAboutDialog()
{
About a = ToolTestTimedServerPusher::MenuDialog::GetAbout();
a.AddLibrary("WtAutoConfig version: " + WtAutoConfig::GetVersion());
a.AddLibrary("WtTimedServerPusher version: " + WtTimedServerPusher::GetVersion());
a.AddLibrary("WtTimedServerPusherClient version: " + WtTimedServerPusherClient::GetVersion());
WtAboutDialog * const d = new WtAboutDialog(a,false);
assert(d);
return d;
}
Wt::WWidget * ribi::ToolTestTimedServerPusher::WtMenuDialog::CreateNewMainDialog() const
{
WtMainDialog * const d = new WtMainDialog;
assert(d);
return d;
}
Wt::WWidget * ribi::ToolTestTimedServerPusher::WtMenuDialog::CreateNewWelcomeDialog() const
{
Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
dialog->setContentAlignment(Wt::AlignCenter);
dialog->addWidget(new Wt::WBreak);
new Wt::WLabel("Welcome to TestTimedServerPusher",dialog);
new Wt::WBreak(dialog);
new Wt::WBreak(dialog);
new Wt::WLabel("TestTimedServerPusher demonstrates how to view the same changing info",dialog);
new Wt::WBreak(dialog);
new Wt::WLabel("from different browsers and/or computers",dialog);
new Wt::WBreak(dialog);
new Wt::WLabel("using the WtTimedServerPusher and WtTimedServerPusherClient classes",dialog);
return dialog;
}
|
./ToolTestTimedServerPusher/helgrind.sh
#!/bin/sh
valgrind --tool=helgrind --log-file=helgrind.txt ../ToolTestTimedServerPusher-build-desktop/./ToolTestTimedServerPusher
|
./ToolTestTimedServerPusher/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
# * CppWtAboutDialog
# * CppWtAutoConfig
# * CppWtTimedServerPusher
# * Tools
# * ToolTestTimedServerPusher
echo "Removing old user information"
rm copy.txt
rm tmp.txt
rm ToolTestTimedServerPusher.pro.user
echo "Mimicking file structure"
mkdir temp_zip
mkdir temp_zip/Classes
mkdir temp_zip/Classes/CppAbout
mkdir temp_zip/Classes/CppWtAboutDialog
mkdir temp_zip/Classes/CppWtAutoConfig
mkdir temp_zip/Classes/CppWtTimedServerPusher
mkdir temp_zip/Tools
mkdir temp_zip/Tools/ToolTestTimedServerPusher
echo "Copying files"
cp ../../Classes/CppAbout/*.* temp_zip/Classes/CppAbout
cp ../../Classes/CppWtAboutDialog/*.* temp_zip/Classes/CppWtAboutDialog
cp ../../Classes/CppWtAutoConfig/*.* temp_zip/Classes/CppWtAutoConfig
cp ../../Classes/CppWtTimedServerPusher/*.* temp_zip/Classes/CppWtTimedServerPusher
cp ../../Tools/ToolTestTimedServerPusher/*.* temp_zip/Tools/ToolTestTimedServerPusher
FILENAME=ToolTestTimedServerPusherSource_1_0
ZIP_FILENAME=$FILENAME".zip"
echo "Remove previous zip"
rm $ZIP_FILENAME
#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/CppWtAboutDialog/*.*
rm temp_zip/Classes/CppWtAutoConfig/*.*
rm temp_zip/Classes/CppWtTimedServerPusher/*.*
rmdir temp_zip/Classes/CppAbout
rmdir temp_zip/Classes/CppWtAboutDialog
rmdir temp_zip/Classes/CppWtAutoConfig
rmdir temp_zip/Classes/CppWtTimedServerPusher
rmdir temp_zip/Classes
#Tools
rm temp_zip/Tools/ToolTestTimedServerPusher/*.*
rmdir temp_zip/Tools/ToolTestTimedServerPusher
rmdir temp_zip/Tools
rm temp_zip/*.*
rmdir temp_zip
echo "Done"
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml