Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
vite
Commits
f2956a20
Commit
f2956a20
authored
Apr 21, 2010
by
Mathieu Faverge
Browse files
merge -r 962:1086
svn+ssh://faverge@scm.gforge.inria.fr/svn/vite/branches/config_file
.
parent
d0c10fc2
Changes
132
Expand all
Hide whitespace changes
Inline
Side-by-side
Doxyfile
View file @
f2956a20
...
...
@@ -273,12 +273,12 @@ EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE =
NO
EXTRACT_PRIVATE =
YES
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC =
NO
EXTRACT_STATIC =
YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
...
...
@@ -513,7 +513,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = src/common/ src/core/ src/interface/ src/parser/ src/plugin/ src/render/ src/statistics/ src/trace/ src/trace/values/ src/trace/tree/ src/main.cpp
INPUT = src/common/ src/core/ src/interface/ src/parser/ src/plugin/ src/render/ src/statistics/ src/trace/ src/trace/values/ src/trace/tree/ src/main.cpp
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
...
...
src/CMakeLists.txt
View file @
f2956a20
...
...
@@ -46,10 +46,11 @@ SET(VITE_HDRS
common/Message.hpp
common/Errors.hpp
common/Tools.hpp
common/
i
nfo.hpp
common/
I
nfo.hpp
common/Session.hpp
common/trace.h
common/Memory.hpp
general/qtcolorpicker/src/qtcolorpicker.h
# Data structure headers
trace/values/Color.hpp
trace/values/Date.hpp
...
...
@@ -83,9 +84,11 @@ SET(VITE_HDRS
trace/DrawTree.hpp
trace/Trace.hpp
# Render headers
render/Palette.hpp
render/Render.hpp
render/Geometry.hpp
render/Hook_event.hpp
render/Minimap.hpp
render/Render_opengl.hpp
render/Render_svg.hpp
render/render_stats.hpp
...
...
@@ -95,6 +98,7 @@ SET(VITE_HDRS
# Interface headers
interface/resource.hpp
interface/Interface.hpp
interface/Settings_window.hpp
interface/Interface_graphic.hpp
# Core header
core/Core.hpp
...
...
@@ -118,10 +122,13 @@ SET(VITE_HDRS
statistics/DrawCounter.hpp
# Plugin header
plugin/Command_window.hpp
plugin/Plugin_window.hpp
plugin/Plugin.hpp
)
SET
(
VITE_UIS
interface/info_window.ui
interface/settings.ui
interface/main_window.ui
interface/option_export_window.ui
interface/stats_viewer.ui
...
...
@@ -134,9 +141,10 @@ SET(VITE_SRCS
common/Message.cpp
common/Errors.cpp
common/Tools.cpp
common/
i
nfo.cpp
common/
I
nfo.cpp
common/Session.cpp
common/Memory.cpp
general/qtcolorpicker/src/qtcolorpicker.cpp
# Data structure code files
trace/values/Color.cpp
trace/values/Date.cpp
...
...
@@ -162,9 +170,11 @@ SET(VITE_SRCS
trace/Container.cpp
trace/Trace.cpp
# Render code files
render/Palette.cpp
render/Geometry.cpp
render/Hook_event.cpp
render/Render.hpp
render/Minimap.cpp
render/Render_opengl.cpp
render/Render_svg.cpp
render/render_stats_opengl.cpp
...
...
@@ -185,10 +195,13 @@ SET(VITE_SRCS
statistics/Statistic.cpp
statistics/Stats_window.cpp
# Interface code files
interface/Settings_window.cpp
interface/Interface_graphic.cpp
# Plugin code file
plugin/Command_window.cpp
# Core code files
plugin/Plugin_window.cpp
plugin/Plugin.cpp
# Core code files
core/Core.cpp
# Main
main.cpp
...
...
src/common/
i
nfo.cpp
→
src/common/
I
nfo.cpp
View file @
f2956a20
...
...
@@ -45,7 +45,7 @@
*/
#include "common/common.hpp"
#include "common/
i
nfo.hpp"
#include "common/
I
nfo.hpp"
unsigned
int
Info
::
Screen
::
width
=
800
;
unsigned
int
Info
::
Screen
::
height
=
600
;
...
...
@@ -75,7 +75,6 @@ Element_pos Info::Render::_info_accurate = 0.0;
bool
Info
::
Render
::
_no_arrows
=
false
;
bool
Info
::
Render
::
_no_events
=
false
;
void
Info
::
release_all
(){
Info
::
Container
::
x_min
=
0
;
...
...
src/common/
i
nfo.hpp
→
src/common/
I
nfo.hpp
View file @
f2956a20
...
...
@@ -41,15 +41,12 @@
**
*/
/*!
*\file
i
nfo.hpp
*\file
I
nfo.hpp
*/
#ifndef INFO_HPP
#define INFO_HPP
class
Interface_console
;
//class QLabel;
/*!
* \brief Class used to store informations.
*
...
...
@@ -76,7 +73,7 @@ public:
* \brief Release all Info class attributes.
*/
static
void
release_all
();
/*!
* \brief Sub structure to store screen information.
*/
...
...
src/common/Session.cpp
100755 → 100644
View file @
f2956a20
...
...
@@ -44,10 +44,200 @@
*\file Session.cpp
*/
#include <iostream>
/* -- */
#include <QByteArray>
#include <QStringList>
#include <QSettings>
#include <QColor>
#include <QMap>
#include <QVariant>
#include <QCoreApplication>
#include <QDir>
/* -- */
#include "trace/values/Value.hpp"
#include "trace/values/Color.hpp"
#include "render/Palette.hpp"
#include "common/Session.hpp"
using
namespace
std
;
const
QByteArray
Session
::
Export
::
DEFAULT_STATE
=
QByteArray
::
number
(
-
1
);
QByteArray
Session
::
Export
::
file_dialog_state
=
Session
::
Export
::
DEFAULT_STATE
;
int
Session
::
Minimap
::
x
;
int
Session
::
Minimap
::
y
;
int
Session
::
Minimap
::
width
;
int
Session
::
Minimap
::
height
;
int
Session
::
Minimap
::
pen_size
;
QColor
Session
::
Minimap
::
pen_color
;
QColor
Session
::
Minimap
::
brush_color
;
bool
Session
::
Minimap
::
is_closed
;
Palette
*
Session
::
_palette
=
NULL
;
void
Session
::
save_config_file
(){
}
void
Session
::
load_config_file
(){
QCoreApplication
::
setOrganizationName
(
ORG_NAME
);
QCoreApplication
::
setOrganizationDomain
(
ORG_DOMAIN
);
QCoreApplication
::
setApplicationName
(
APP_NAME
);
}
const
QStringList
Session
::
get_recent_files
()
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
return
settings
.
value
(
RECENT_FILES
).
toStringList
();
}
void
Session
::
add_recent_file
(
const
QString
&
filename
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QStringList
files
=
settings
.
value
(
RECENT_FILES
).
toStringList
();
// We delete if the file was already call in order to be on the top of the list
files
.
removeAll
(
filename
);
files
.
prepend
(
filename
);
while
(
files
.
size
()
>
_MAX_NB_RECENT_FILES
)
files
.
removeLast
();
settings
.
setValue
(
RECENT_FILES
,
files
);
}
void
Session
::
clear_recent_files
()
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
settings
.
remove
(
RECENT_FILES
);
}
/*** Minimap ***/
void
Session
::
save_minimap
(
int
x
,
int
y
,
int
w
,
int
h
,
bool
hide_on_start
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
// Doublon ?
Session
::
Minimap
::
x
=
x
;
Session
::
Minimap
::
y
=
y
;
Session
::
Minimap
::
width
=
w
;
Session
::
Minimap
::
height
=
h
;
Session
::
Minimap
::
is_closed
=
hide_on_start
;
settings
.
setValue
(
"minimap/x"
,
x
);
settings
.
setValue
(
"minimap/y"
,
y
);
settings
.
setValue
(
"minimap/width"
,
w
);
settings
.
setValue
(
"minimap/height"
,
h
);
settings
.
setValue
(
"minimap/is_closed"
,
hide_on_start
);
}
/*** Plugins ***/
void
Session
::
load_plugin_directories
(
QStringList
&
list
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
list
=
settings
.
value
(
PLUGIN_DIR
).
toStringList
();
/* We add the $HOME/.vite if not exists as a default path */
const
QString
home_dir
=
QDir
::
toNativeSeparators
(
QDir
::
homePath
()
+
"/.vite"
);
if
(
!
list
.
contains
(
home_dir
))
{
list
.
append
(
home_dir
);
}
}
void
Session
::
save_plugin_directories
(
const
QStringList
&
list
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
settings
.
setValue
(
PLUGIN_DIR
,
list
);
}
/*** States color ***/
void
Session
::
set_use_palette
(
bool
use
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
settings
.
setValue
(
"palette/is_used"
,
use
);
}
bool
Session
::
get_use_palette
()
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
return
settings
.
value
(
"palette/is_used"
).
toBool
();
}
std
::
string
Session
::
get_current_palette
()
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
std
::
string
tmp
=
settings
.
value
(
CUR_PALETTE
).
toString
().
toStdString
();
if
(
tmp
==
""
)
tmp
=
"default"
;
return
tmp
;
}
void
Session
::
set_current_palette
(
const
std
::
string
&
name
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
settings
.
setValue
(
CUR_PALETTE
,
QString
::
fromStdString
(
name
));
}
void
Session
::
get_palettes_name
(
QStringList
&
list
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
list
=
settings
.
value
(
PALETTE_NAMES
).
toStringList
();
if
(
!
list
.
contains
(
"default"
))
{
list
.
append
(
"default"
);
}
}
Palette
*
Session
::
get_palette
(
const
std
::
string
&
palette_name
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QMap
<
QString
,
QVariant
>
qmap
=
settings
.
value
(
QString
::
fromStdString
(
"palette/"
+
palette_name
+
"/map"
)).
toMap
();
if
(
!
_palette
||
_palette
->
get_name
()
!=
palette_name
)
{
delete
_palette
;
_palette
=
new
Palette
(
palette_name
);
for
(
QMap
<
QString
,
QVariant
>::
const_iterator
it
=
qmap
.
begin
()
;
it
!=
qmap
.
end
()
;
++
it
)
{
const
QColor
qc
=
it
.
value
().
value
<
QColor
>
();
Color
c
=
Color
(
qc
.
red
()
/
255.
,
qc
.
green
()
/
255.
,
qc
.
blue
()
/
255.
);
_palette
->
add_state
(
it
.
key
().
toStdString
(),
c
);
}
}
return
_palette
;
}
void
Session
::
create_palette
(
const
std
::
string
&
name
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QStringList
list
=
settings
.
value
(
PALETTE_NAMES
).
toStringList
();
list
.
append
(
QString
::
fromStdString
(
name
));
settings
.
setValue
(
PALETTE_NAMES
,
list
);
}
void
Session
::
remove_palette
(
const
std
::
string
&
name
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QStringList
list
=
settings
.
value
(
PALETTE_NAMES
).
toStringList
();
list
.
removeOne
(
QString
::
fromStdString
(
name
));
settings
.
setValue
(
PALETTE_NAMES
,
list
);
}
void
Session
::
copy_palette
(
const
std
::
string
&
src
,
const
std
::
string
&
dest
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
// Save the palette
QStringList
list
=
settings
.
value
(
PALETTE_NAMES
).
toStringList
();
list
.
append
(
QString
::
fromStdString
(
dest
));
settings
.
setValue
(
PALETTE_NAMES
,
list
);
// Copy the states
QString
name_src
=
QString
::
fromStdString
(
"palette/"
+
src
+
"/map"
);
QString
name_dest
=
QString
::
fromStdString
(
"palette/"
+
dest
+
"/map"
);
QMap
<
QString
,
QVariant
>
qmap
=
settings
.
value
(
name_src
).
toMap
();
settings
.
setValue
(
name_dest
,
qmap
);
}
void
Session
::
add_state_to_palette
(
const
std
::
string
&
palette_name
,
const
std
::
string
&
state_name
,
const
Color
&
c
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QString
name
=
QString
::
fromStdString
(
"palette/"
+
palette_name
+
"/map"
);
QMap
<
QString
,
QVariant
>
qmap
=
settings
.
value
(
name
).
toMap
();
qmap
[
QString
::
fromStdString
(
state_name
)]
=
QColor
(
c
.
get_red
()
*
255
,
c
.
get_green
()
*
255
,
c
.
get_blue
()
*
255
);
settings
.
setValue
(
name
,
qmap
);
}
void
Session
::
remove_state_to_palette
(
const
std
::
string
&
palette_name
,
const
std
::
string
&
state_name
)
{
QSettings
settings
(
ORG_NAME
,
APP_NAME
);
QString
name
=
QString
::
fromStdString
(
"palette/"
+
palette_name
+
"/map"
);
QMap
<
QString
,
QVariant
>
qmap
=
settings
.
value
(
name
).
toMap
();
qmap
.
remove
(
QString
::
fromStdString
(
state_name
));
settings
.
setValue
(
name
,
qmap
);
}
src/common/Session.hpp
100755 → 100644
View file @
f2956a20
...
...
@@ -47,6 +47,51 @@
#ifndef SESSION_HPP
#define SESSION_HPP
class
Palette
;
class
Color
;
class
QByteArray
;
class
QColor
;
class
QString
;
class
QStringList
;
/*!
* \def ORG_NAME
* \brief The "organization" name
*/
#define ORG_NAME "ViTE"
/*!
* \def ORG_DOMAIN
* \brief The "organization" domain
*/
#define ORG_DOMAIN "vite.gforge.inria.com"
/*!
* \def APP_NAME
* \brief The application name
*/
#define APP_NAME "ViTE"
/*!
* \def RECENT_FILES
* \brief The recent file key for Settings
*/
#define RECENT_FILES "recentFiles"
/*!
* \def PLUGIN_DIR
* \brief The plugin directory key for Settings
*/
#define PLUGIN_DIR "plugin_dir"
/*!
* \def CUR_PALETTE
* \brief The current palette key for Settings
*/
#define CUR_PALETTE "palette/current_name"
/*!
* \def PALETTE_NAMES
* \brief The current palette names key for Settings
*/
#define PALETTE_NAMES "palette/palettes_name"
/*!
* \brief Class used to store information between two software launch.
*
...
...
@@ -55,19 +100,18 @@ class Session{
private:
static
Palette
*
_palette
;
/*!
* \brief The class constructor.
*/
Session
();
public:
/*!
* \brief The class destructor.
*/
virtual
~
Session
();
/*!
* \brief Sub structure to store export information.
...
...
@@ -77,20 +121,146 @@ public:
/*!
* \brief Store the export file dialog state.
*/
static
QByteArray
file_dialog_state
;
static
QByteArray
file_dialog_state
;
/*!
* \brief Default value of the export dialog state.
*/
const
static
QByteArray
DEFAULT_STATE
;
/*!
* \brief Default value of the export dialog state.
*/
const
static
QByteArray
DEFAULT_STATE
;
};
/*!
* \brief Sub structure to store render information.
*/
struct
Render
{
/*!
* \brief Sub structure to store render information.
*/
struct
Render
{
};
/*!
* \brief Sub structure to store the Minimap information.
*/
struct
Minimap
{
static
int
x
,
y
;
static
int
width
,
height
;
static
int
pen_size
;
static
QColor
pen_color
,
brush_color
;
static
bool
is_closed
;
};
static
void
save_minimap
(
int
x
,
int
y
,
int
w
,
int
h
,
bool
hide_on_start
);
/*!
* \brief maximum number of file shown in the recent files menu.
*/
static
const
int
_MAX_NB_RECENT_FILES
=
10
;
static
void
save_config_file
();
static
void
load_config_file
();
/*!
* \fn get_recent_files()
* \brief Get the list of the recent files
*/
static
const
QStringList
get_recent_files
();
/*!
* \fn add_recent_file(const QString &filename)
* \brief Add to the recent files opened the new file.
* \param filename : the name of the file read
*/
static
void
add_recent_file
(
const
QString
&
filename
);
/*!
* \fn clear_recent_files()
* \brief Clear all the recent files opened. Only in the QSettings files, not in the graphical interface.
*/
static
void
clear_recent_files
();
/*!
* \fn load_plugin_directories(QStringList &list)
* \brief Fill the QStringList passed in parameter with the user plugin directories
*/
static
void
load_plugin_directories
(
QStringList
&
list
);
/*!
* \fn save_plugin_directories(const QStringList &list)
* \brief Save the QStringList passed in parameter as the user plugin directories
*/
static
void
save_plugin_directories
(
const
QStringList
&
list
);
/*!
* \fn set_use_palette(bool use)
* \brief Set if we use the current palette when we load a trace.
* \param use : true if we use the current palette.
*/
static
void
set_use_palette
(
bool
use
);
/*!
* \fn get_use_palette()
* \brief Get if we use the current palette when we load a trace.
*/
static
bool
get_use_palette
();
/*!
* \fn get_palettes_name(QStringList &list)
* \brief Fill the list with all the existing palettes name.
* \param list : the list filled
*/
static
void
get_palettes_name
(
QStringList
&
list
);
/*!
* \fn get_palette(const std::string &name)
* \brief Create and return the palette with the name passed in parameter.
* \param name : the name of the required palette
*/
static
Palette
*
get_palette
(
const
std
::
string
&
name
=
"default"
);
/*!
* \fn get_current_palette()
* \brief return the name of the current palette (last used)
*/
static
std
::
string
get_current_palette
();
/*!
* \fn set_current_palette(const std::string &name)
* \brief set the name of the current palette
* \param name : the name of the palette
*/
static
void
set_current_palette
(
const
std
::
string
&
name
);
/*!
* \fn create_palette(const std::string &name)
* \brief Create an empty palette named name.
* \param name : the name of the palette
*/
static
void
create_palette
(
const
std
::
string
&
name
);
/*!
* \fn remove_palette(const std::string &name)
* \brief Remove the palette named name.
* \param name : the name of the palette
*/
static
void
remove_palette
(
const
std
::
string
&
name
);
/*!
* \fn copy_palette(const std::string &src, const std::string &dest)
* \brief Copy the src palette to dest
* \param src : the name of the source palette
* \param dest : the name of the destination palette
*/
static
void
copy_palette
(
const
std
::
string
&
src
,
const
std
::
string
&
dest
);
/*!
* \fn add_state_to_palette(const std::string &palette_name, const std::string &state_name, const Color &c)
* \brief Add the state with its color of the palette.
* \param palette_name : the palette name
* \param state_name : the state name
* \param c : the state color
*/
static
void
add_state_to_palette
(
const
std
::
string
&
palette_name
,
const
std
::
string
&
state_name
,
const
Color
&
c
);
/*!
* \fn remove_state_to_palette(const std::string &palette_name, const std::string &state_name)
* \brief Remove the state of the palette.
* \param palette_name : the palette name
* \param state_name : the state name
*/
static
void
remove_state_to_palette
(
const
std
::
string
&
palette_name
,
const
std
::
string
&
state_name
);
};
#endif
src/common/Tools.cpp
View file @
f2956a20
...
...
@@ -44,6 +44,8 @@
#include <cstdio>
#include <iostream>
/* -- */
#include <QString>
#include <QFileInfo>
#include <QObject> // For translations
/* -- */
#include <locale.h> // For dots or commas separator in double numbers
...
...
@@ -92,6 +94,11 @@ double convert_to_double(const string arg){
}
}
const
QString
stripped_name
(
const
QString
&
fullFileName
)
{
return
QFileInfo
(
fullFileName
).
fileName
();
}
double
clockGet
(
void
)
{
#ifdef _MSC_VER
...
...
src/common/Tools.hpp
View file @
f2956a20
...
...
@@ -48,6 +48,8 @@
#ifndef TOOLS_HPP
#define TOOLS_HPP
#include <QString>
/*!
* \fn convert_to_double(const std::string args)
* \brief Convert the string in double
...
...
@@ -56,15 +58,22 @@
*/
double
convert_to_double
(
const
std
::
string
args
);
#define MIN(x,y) (((x)<(y))?(x):(y))
#define MAX(x,y) (((x)<(y))?(y):(x))
//
#define MIN(x,y) (((x)<(y))?(x):(y))
//
#define MAX(x,y) (((x)<(y))?(y):(x))
/*!
*
\fn clockGet()
*
\brief Timing routine.
*
Uses different timing routines depending on the machine architecture.
*
\return the time ellapsed since
<
clockStart
>
.
\fn clockGet(
void
)
\brief Timing routine.
Uses different timing routines depending on the machine architecture.
\return
Returns
the time ellapsed since
'
clockStart
'
.
*/
double
clockGet
(
void
);
/*!
* \fn stripped_name(const QString &fullFileName)
* \brief return the name of the file without its directory