Commit 29988f69 authored by Rémi BERTHO's avatar Rémi BERTHO

Merge all scripts

parent ad1c40ac
......@@ -76,11 +76,9 @@ link_directories(
)
IF(UNIX)
add_custom_target(translation
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/compile_translations ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF() #Unix
add_custom_target(all_updates
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/utility.sh -a ${CMAKE_CURRENT_SOURCE_DIR}
)
add_subdirectory("Externals_libraries/AsynchronousExecution")
......@@ -136,9 +134,7 @@ IF(NOT (LIB MATCHES "FALSE"))
PRIVATE cxx_range_for cxx_generic_lambdas
)
IF(UNIX)
add_dependencies(csuper translation)
ENDIF() #Unix
add_dependencies(csuper all_updates)
install (TARGETS csuper RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
install (FILES ${headers_files_libcsuper} DESTINATION include/libcsuper)
......@@ -202,9 +198,7 @@ IF(NOT (CLI MATCHES "FALSE"))
PRIVATE cxx_range_for cxx_generic_lambdas
)
IF(UNIX)
add_dependencies(csuper translation)
ENDIF() #Unix
add_dependencies(csuper all_updates)
install (TARGETS csuper-cli DESTINATION share/csuper)
install (FILES Locales/fr_FR/LC_MESSAGES/csuper-cli.mo DESTINATION share/csuper/Locales/fr_FR/LC_MESSAGES)
......@@ -275,9 +269,7 @@ IF(NOT (GTK MATCHES "FALSE"))
PRIVATE cxx_range_for cxx_generic_lambdas
)
IF(UNIX)
add_dependencies(csuper translation)
ENDIF() #Unix
add_dependencies(csuper all_updates)
install (TARGETS csuper-gtk DESTINATION share/csuper)
install (FILES Locales/fr_FR/LC_MESSAGES/csuper-gtk.mo DESTINATION share/csuper/Locales/fr_FR/LC_MESSAGES)
......
Libcsuper
=========
#Libcsuper
4.3.2
......@@ -7,6 +6,7 @@ Libcsuper
* Improve XML
* Add export to markdown
* Add logs
* Upgrade slope
4.3.1
......@@ -58,8 +58,7 @@ Libcsuper
* Add the possibility to import and export game configurations
Csuper-cli
==========
#Csuper-cli
4.3.2
......@@ -97,14 +96,16 @@ Csuper-cli
* Add the possibility to import and export game configurations
Csuper-gtk
==========
#Csuper-gtk
4.3.2
* Add save and export file asynchronous
* Add export to markdown
* Add logs
* Merge statistics and charts windows
* Upgrade slope
* Improve HTML version
4.3.0
......
No preview for this file type
No preview for this file type
......@@ -37,8 +37,8 @@
#include <glibmm.h>
/*! \class Cin
* \brief This class is for Cin
*/
* \brief This class is for Cin
*/
class Cin
{
public:
......
......@@ -37,8 +37,8 @@
#include <glibmm.h>
/*! \class CommandLineOption
* \brief This class is used to retrieve the command line option
*/
* \brief This class is used to retrieve the command line option
*/
class CommandLineOption
{
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -60,30 +60,30 @@ void terminateFunction()
#ifdef GLIB_AVAILABLE_IN_2_50
GLogWriterOutput logWriterFunction(GLogLevelFlags log_level, const GLogField* fields, gsize n_fields, gpointer user_data)
#else
void logWriterFunction(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
void logWriterFunction(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data)
#endif
{
map<ustring, ustring> str_fields;
DateTime current_time = DateTime::create_now_local();
ostringstream log_message;
ofstream log_file;
ustring log_filename;
auto print_log_level = static_cast<CommandLineOption::LogLevel>(reinterpret_cast<uintptr_t>(user_data));
DateTime current_time = DateTime::create_now_local();
ostringstream log_message;
ofstream log_file;
ustring log_filename;
auto print_log_level = static_cast<CommandLineOption::LogLevel>(reinterpret_cast<uintptr_t>(user_data));
// Check if log need to be written
if (((print_log_level == CommandLineOption::WARNING) && (log_level > G_LOG_LEVEL_WARNING)) ||
((print_log_level == CommandLineOption::INFO) && (log_level > G_LOG_LEVEL_INFO)))
{
#ifdef GLIB_AVAILABLE_IN_2_50
#ifdef GLIB_AVAILABLE_IN_2_50
return G_LOG_WRITER_HANDLED;
#else
#else
return;
#endif
#endif
}
// Convert to map
// Convert to map
#ifdef GLIB_AVAILABLE_IN_2_50
for (guint i = 0; i < n_fields; i++)
for (guint i = 0; i < n_fields; i++)
str_fields[fields[i].key] = (char*)fields[i].value;
#else
str_fields["MESSAGE"] = message;
......@@ -198,16 +198,22 @@ int main(int argc, char* argv[])
// Set error and log functions
set_terminate(terminateFunction);
#ifdef GLIB_AVAILABLE_IN_2_50
#ifdef GLIB_AVAILABLE_IN_2_50
g_log_set_writer_func(&logWriterFunction, reinterpret_cast<gpointer>(clo.getLogLevel()), NULL);
g_log_structured(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "MESSAGE", "Csuper-cli start");
#else
g_log_set_handler("libcsuper", (GLogLevelFlags) (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION),
&logWriterFunction, reinterpret_cast<gpointer>(clo.getLogLevel()));
g_log_set_handler("csuper-cli", (GLogLevelFlags) (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION),
&logWriterFunction, reinterpret_cast<gpointer>(clo.getLogLevel()));
#else
g_log_set_handler("libcsuper",
(GLogLevelFlags)(G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION),
&logWriterFunction,
reinterpret_cast<gpointer>(clo.getLogLevel()));
g_log_set_handler("csuper-cli",
(GLogLevelFlags)(G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION),
&logWriterFunction,
reinterpret_cast<gpointer>(clo.getLogLevel()));
g_debug("Csuper-cli start");
#endif
#endif
// Initialization of csuper
try
......@@ -430,11 +436,11 @@ int main(int argc, char* argv[])
break;
}
#ifdef GLIB_AVAILABLE_IN_2_50
#ifdef GLIB_AVAILABLE_IN_2_50
g_log_structured(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "MESSAGE", "Csuper-cli end");
#else
#else
g_debug("Csuper-cli end");
#endif
#endif
return EXIT_SUCCESS;
}
......@@ -331,7 +331,7 @@ void Menu::loadGame() const
}
catch (Glib::Exception& e)
{
g_info("%s",e.what().c_str());
g_info("%s", e.what().c_str());
cout << e.what() << endl;
systemPause();
return;
......@@ -366,7 +366,7 @@ void Menu::listFile() const
}
catch (Glib::Error& e)
{
g_warning("%s",e.what().c_str());
g_warning("%s", e.what().c_str());
}
systemPause();
}
......@@ -415,7 +415,7 @@ void Menu::checkForUpdate(const bool auto_check)
}
catch (Glib::Exception& e)
{
g_warning("%s",e.what().c_str());
g_warning("%s", e.what().c_str());
if (!auto_check)
cout << ustring(_("Cannot access to the latest version file on the internet")) << endl << endl;
}
......@@ -448,7 +448,7 @@ void Menu::displayFile() const
}
catch (Glib::Exception& e)
{
g_info("%s",e.what().c_str());
g_info("%s", e.what().c_str());
cout << e.what() << endl;
}
......
......@@ -36,8 +36,8 @@
#include "libcsuper/libcsuper.h"
/*! \class Menu
* \brief This class is used for the main menu
*/
* \brief This class is used for the main menu
*/
class Menu
{
private:
......
......@@ -36,8 +36,8 @@
#include "game_cli.h"
/*! \class PlayGame
* \brief This class is used to play a game
*/
* \brief This class is used to play a game
*/
class PlayGame
{
private:
......@@ -47,8 +47,8 @@ private:
/*!
* Ask and save the new points
*/
* Ask and save the new points
*/
void playersPoints() const;
/*!
......
......@@ -38,8 +38,8 @@
/*! \class TextStyle
* \brief This class is used to set a text style in a terminal
*/
* \brief This class is used to set a text style in a terminal
*/
class TextStyle
{
public:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class About
* \brief This class represent the about dialog
*/
* \brief This class represent the about dialog
*/
class About : public CsuWidget, public Gtk::AboutDialog
{
protected:
......
......@@ -39,8 +39,8 @@
#include "csu_widget.h"
/*! \class ChangeDistributorDialog
* \brief This class represent the change distributor dialog
*/
* \brief This class represent the change distributor dialog
*/
class ChangeDistributorDialog : public CsuWidget, public Gtk::Dialog
{
protected:
......
......@@ -91,7 +91,7 @@ void ChartGrid::freeSlope()
}
if (slope_figure != nullptr)
{
//slope_figure_destroy(slope_figure);
// slope_figure_destroy(slope_figure);
slope_figure = nullptr;
}
if (slope_items != nullptr)
......@@ -101,7 +101,7 @@ void ChartGrid::freeSlope()
}
if (slope_scale != nullptr)
{
//slope_scale_destroy(slope_scale);
// slope_scale_destroy(slope_scale);
slope_figure = nullptr;
}
......@@ -138,15 +138,15 @@ void ChartGrid::update(const bool total_points)
slope_points = new double*[app()->game()->nbPlayer()];
slope_items = (SlopeItem**)malloc(sizeof(SlopeItem*) * app()->game()->nbPlayer());
slope_scale = slope_xyscale_new_axis(_("Turns"),_("Points"),title.c_str());
SlopeItem* axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale),SLOPE_XYSCALE_AXIS_BOTTOM);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis),SLOPE_XYAXIS_DEFAULT_DOWN_GRID);
axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale),SLOPE_XYSCALE_AXIS_LEFT);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis),SLOPE_XYAXIS_DEFAULT_DOWN_GRID);
axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale),SLOPE_XYSCALE_AXIS_TOP);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis),SLOPE_XYAXIS_LINE | SLOPE_XYAXIS_TITLE);
slope_scale = slope_xyscale_new_axis(_("Turns"), _("Points"), title.c_str());
SlopeItem* axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale), SLOPE_XYSCALE_AXIS_BOTTOM);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis), SLOPE_XYAXIS_DEFAULT_DOWN_GRID);
axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale), SLOPE_XYSCALE_AXIS_LEFT);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis), SLOPE_XYAXIS_DEFAULT_DOWN_GRID);
axis = slope_xyscale_get_axis(SLOPE_XYSCALE(slope_scale), SLOPE_XYSCALE_AXIS_TOP);
slope_xyaxis_set_components(SLOPE_XYAXIS(axis), SLOPE_XYAXIS_LINE | SLOPE_XYAXIS_TITLE);
for (i = 0; i <= app()->game()->maxNbTurn(); i++)
for (i = 0; i <= app()->game()->maxNbTurn(); i++)
slope_turn[i] = i;
// Create the slope chart
......@@ -155,16 +155,15 @@ void ChartGrid::update(const bool total_points)
slope_points[i] = new double[app()->game()->nbTurn(i) + 1];
if (!(total_points_))
{
for (j = 0; j <= app()->game()->nbTurn(i); j++)
for (j = 0; j <= app()->game()->nbTurn(i); j++)
slope_points[i][j] = app()->game()->points(i, j);
}
else
{
for (j = 0; j <= app()->game()->nbTurn(i); j++)
for (j = 0; j <= app()->game()->nbTurn(i); j++)
slope_points[i][j] = app()->game()->totalPoints(i, j);
}
slope_items[i] = slope_xyseries_new_filled(
app()->game()->playerName(i).c_str(),
slope_items[i] = slope_xyseries_new_filled(app()->game()->playerName(i).c_str(),
slope_turn,
slope_points[i],
app()->game()->nbTurn(i) + 1,
......@@ -308,9 +307,9 @@ bool ChartGrid::drawChart(const Cairo::RefPtr<Cairo::Context>& cr)
chart_height = chart_->get_allocated_height();
SlopeRect rect;
rect.x = 0.0;
rect.y = 0.0;
rect.width = (double)chart_width;
rect.x = 0.0;
rect.y = 0.0;
rect.width = (double)chart_width;
rect.height = (double)chart_height;
slope_figure_draw(slope_figure, &rect, cr->cobj());
......
......@@ -39,8 +39,8 @@
#include "csu_widget.h"
/*! \class ChartWidget
* \brief This class represent the chart widget
*/
* \brief This class represent the chart widget
*/
class ChartGrid : public CsuWidget, public Gtk::Grid
{
///////////////////////////////////////////////////////////////////////////////////
......@@ -55,10 +55,10 @@ protected:
Gtk::DrawingArea* chart_; /*!< The chart */
Gtk::Grid* players_grid_ = nullptr; /*!< The player grid */
bool total_points_; /*!< True if we draw total points, false otherwise */
SlopeFigure* slope_figure = nullptr; /*!< The slope figure */
double* slope_turn = nullptr; /*!< The turns used by slope */
double** slope_points = nullptr; /*!< The points used by slope */
bool total_points_; /*!< True if we draw total points, false otherwise */
SlopeFigure* slope_figure = nullptr; /*!< The slope figure */
double* slope_turn = nullptr; /*!< The turns used by slope */
double** slope_points = nullptr; /*!< The points used by slope */
SlopeItem** slope_items = nullptr; /*!< The slope items */
SlopeScale* slope_scale = nullptr; /*!< The slope scale */
......
......@@ -39,8 +39,8 @@
/*! \class ChartPointsGrid
* \brief This class represent the chart widget
*/
* \brief This class represent the chart widget
*/
class ChartPointsGrid : public ChartGrid
{
///////////////////////////////////////////////////////////////////////////////////
......@@ -60,7 +60,7 @@ public:
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Function //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
public:
public:
/*!
* \brief Show the widget properties
*/
......
......@@ -39,8 +39,8 @@
/*! \class ChartTotalPointsGrid
* \brief This class represent the chart widget
*/
* \brief This class represent the chart widget
*/
class ChartTotalPointsGrid : public ChartGrid
{
///////////////////////////////////////////////////////////////////////////////////
......@@ -59,7 +59,7 @@ public:
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Function //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
public:
public:
/*!
* \brief Show the widget properties
*/
......
......@@ -302,7 +302,7 @@ void CsuApplication::onQuit()
MESSAGE_QUESTION,
BUTTONS_YES_NO,
true);
result = quitDialog->run();
result = quitDialog->run();
quitDialog->hide();
delete quitDialog;
......
......@@ -66,8 +66,8 @@ class DisplayDialog;
/*! \class CsuApplication
* \brief This class represent the Application
*/
* \brief This class represent the Application
*/
class CsuApplication : public Gtk::Application
{
///////////////////////////////////////////////////////////////////////////////////
......@@ -524,16 +524,16 @@ public:
///////////////////////////////////////////////////////////////////////////////////
public:
/*!
* \brief Set a new Game
* \param game the new Game
*/
* \brief Set a new Game
* \param game the new Game
*/
void setGame(csuper::GamePtr game);
/*!
* \brief Set a new filename
* \param filename the new filename
*/
* \brief Set a new filename
* \param filename the new filename
*/
void setFilename(const Glib::ustring& filename);
};
......
......@@ -37,8 +37,8 @@
class CsuApplication;
/*! \class CsuWidget
* \brief This class is a CsuWidget
*/
* \brief This class is a CsuWidget
*/
class CsuWidget
{
private:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class DeleteTurnDialog
* \brief This class represent the delete turn dialog
*/
* \brief This class represent the delete turn dialog
*/
class DeleteTurnDialog : public CsuWidget, public Gtk::Dialog
{
protected:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class DisplayDialog
* \brief This class represent the display dialog
*/
* \brief This class represent the display dialog
*/
class DisplayDialog : public CsuWidget, public Gtk::Dialog
{
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -41,8 +41,8 @@
/*! \class DisplayPreferences
* \brief This class represent the display preferences scrolled window
*/
* \brief This class represent the display preferences scrolled window
*/
class DisplayPreferences : public CsuWidget, public Gtk::ScrolledWindow
{
protected:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class EditTurnDialog
* \brief This class represent the edit turn dialog
*/
* \brief This class represent the edit turn dialog
*/
class EditTurnDialog : public CsuWidget, public Gtk::Dialog
{
protected:
......
......@@ -39,8 +39,8 @@
#include "csu_widget.h"
/*! \class ExportationPreferences
* \brief This class represent the exportation preferences scrolled window
*/
* \brief This class represent the exportation preferences scrolled window
*/
class ExportationPreferences : public CsuWidget, public Gtk::ScrolledWindow
{
protected:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class FilePropertiesDialog
* \brief This class represent the file properties dialog
*/
* \brief This class represent the file properties dialog
*/
class FilePropertiesDialog : public CsuWidget, public Gtk::Dialog
{
protected:
......
......@@ -40,8 +40,8 @@
#include "csu_widget.h"
/*! \class GameConfigurationWindow
* \brief This class represent the game configuration window
*/
* \brief This class represent the game configuration window
*/
class GameConfigurationWindow : public CsuWidget, public Gtk::ApplicationWindow
{
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class GameInformationView
* \brief This class represent the game information view
*/
* \brief This class represent the game information view
*/
class GameInformationView : public CsuWidget, public Gtk::Box
{
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class GameOverDialog
* \brief This class represent the game over dialog
*/
* \brief This class represent the game over dialog
*/
class GameOverDialog : public CsuWidget, public Gtk::Dialog
{
protected:
......
......@@ -41,8 +41,8 @@
/*! \class HtmlPreferences
* \brief This class represent the html preferences scrolled window
*/
* \brief This class represent the html preferences scrolled window
*/
class HtmlPreferences : public CsuWidget, public Gtk::ScrolledWindow
{
protected:
......
......@@ -40,8 +40,8 @@
#include "csu_widget.h"
/*! \class ImportExportGameConfigurationDialog
* \brief This class represent the game configuration window
*/
* \brief This class represent the game configuration window
*/
class ImportExportGameConfigurationDialog : public CsuWidget, public Gtk::Dialog
{
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -75,10 +75,10 @@ GLogWriterOutput logWriterFunction(GLogLevelFlags log_level, const GLogField* fi
void logWriterFunction(const gchar* log_domain, GLogLevelFlags log_level, const gchar* message, gpointer user_data)
#endif
{
string print_log_level = *static_cast<string*>(user_data);
string print_log_level = *static_cast<string*>(user_data);
map<ustring, ustring> str_fields;
DateTime current_time = DateTime::create_now_local();
ostringstream log_message;
DateTime current_time = DateTime::create_now_local();
ostringstream log_message;
// Log to systemd
#if (defined GLIB_AVAILABLE_IN_2_50) && (!defined PORTABLE)
......@@ -98,10 +98,10 @@ void logWriterFunction(const gchar* log_domain, GLogLevelFlags log_level, const
// Convert to map
#ifdef GLIB_AVAILABLE_IN_2_50
for (guint i = 0; i < n_fields; i++)
for (guint i = 0; i < n_fields; i++)
str_fields[fields[i].key] = (char*)fields[i].value;
#else
str_fields["MESSAGE"] = message;
str_fields["MESSAGE"] = message;
str_fields["GLIB_DOMAIN"] = log_domain;
#endif
......
......@@ -206,7 +206,7 @@ void MainWindow::saveSize()
{
int width;
int height;
bool is_maximize = false;
bool is_maximize;
get_size(width, height);
is_maximize = is_maximized();
......@@ -361,4 +361,4 @@ bool MainWindow::on_delete_event(GdkEventAny* any_event)
app()->onQuit();
return true;
}
\ No newline at end of file
}
......@@ -39,8 +39,8 @@
#include "csu_widget.h"
/*! \class MainWindow
* \brief This class represent the main window
*/
* \brief This class represent the main window
*/
class MainWindow : public CsuWidget, public Gtk::ApplicationWindow
{
protected:
......
......@@ -38,8 +38,8 @@
#include "csu_widget.h"
/*! \class MenuDisplay
* \brief This class represent the menu display
*/
* \brief This class represent the menu display
*/
class MenuDisplay : public CsuWidget, public Gtk::Menu
{
///////////////////////////////////////////////////////////////////////////////////
......@@ -92,8 +92,8 @@ protected:
public:
/*!
* \brief Set all the menu sensitive
*/
* \brief Set all the menu sensitive