Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
vite
Commits
7ef73f3d
Commit
7ef73f3d
authored
Feb 06, 2014
by
Mathieu Faverge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code reordering while looking at next step
parent
a4ccee0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
109 deletions
+104
-109
src/interface/Settings_window.cpp
src/interface/Settings_window.cpp
+77
-72
src/interface/Settings_window.hpp
src/interface/Settings_window.hpp
+27
-37
No files found.
src/interface/Settings_window.cpp
View file @
7ef73f3d
...
...
@@ -178,6 +178,67 @@ void Settings_window::plugin_load_dirs_name() {
/****** State tab. ******/
/************************/
void
Settings_window
::
color_changed
(
string
name
,
QTableWidget
*
table
,
const
QColor
&
qc
)
{
_changed
=
true
;
if
(
!
table
||
!
palette_list
)
return
;
Color
color
(
qc
.
red
()
/
255.
,
qc
.
green
()
/
255.
,
qc
.
blue
()
/
255.
);
int
row
=
0
;
while
(
table
->
cellWidget
(
row
,
1
)
&&
table
->
cellWidget
(
row
,
1
)
!=
sender
())
{
// Find the row of the colorPicker
row
++
;
}
if
(
!
table
->
cellWidget
(
row
,
1
))
return
;
// epic fail...
std
::
string
palette_name
=
palette_list
->
currentText
().
toStdString
();
std
::
string
state_name
=
table
->
item
(
row
,
0
)
->
text
().
toStdString
();
Session
&
S
=
Session
::
getSession
();
Palette
*
p
=
S
.
get_palette
(
name
,
palette_name
);
bool
checked
=
qobject_cast
<
QCheckBox
*>
(
table
->
cellWidget
(
row
,
2
))
->
checkState
()
==
Qt
::
Checked
;
S
.
add_state_to_palette
(
name
,
palette_name
,
state_name
,
color
,
checked
);
p
->
add_state
(
state_name
,
color
,
checked
);
return
;
}
void
Settings_window
::
add_table_line
(
QTableWidget
*
table
,
const
char
*
slot
,
int
&
row
,
std
::
string
st_name
,
Color
*
c
,
bool
checked
)
{
/* Name */
QTableWidgetItem
*
name
=
new
QTableWidgetItem
(
st_name
.
c_str
());
name
->
setFlags
(
Qt
::
ItemIsEnabled
);
/* Color */
QtColorPicker
*
color_widget
=
new
QtColorPicker
();
color_widget
->
setStandardColors
();
if
(
c
)
{
color_widget
->
setCurrentColor
(
QColor
(
c
->
get_red
()
*
255
,
c
->
get_green
()
*
255
,
c
->
get_blue
()
*
255
));
}
else
{
// \todo check the default color value -> put this in Palette as static member
color_widget
->
setCurrentColor
(
QColor
(
255
,
255
,
255
));
}
color_widget
->
setColorDialogEnabled
(
false
);
connect
(
color_widget
,
SIGNAL
(
colorChanged
(
const
QColor
&
)),
this
,
slot
);
/* Visible */
QCheckBox
*
cb
=
new
QCheckBox
();
cb
->
setChecked
(
checked
);
table
->
insertRow
(
row
);
table
->
setItem
(
row
,
0
,
name
);
table
->
setCellWidget
(
row
,
1
,
color_widget
);
table
->
setCellWidget
(
row
,
2
,
cb
);
row
++
;
}
void
Settings_window
::
fill_table
(
QTableWidget
*
table
,
const
char
*
slot
,
const
string
pname
,
...
...
@@ -217,6 +278,18 @@ void Settings_window::fill_table( QTableWidget *table,
}
}
void
Settings_window
::
state_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"palette"
,
states_table
,
qc
);
}
void
Settings_window
::
event_types_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"event_types"
,
event_types_table
,
qc
);
}
void
Settings_window
::
link_types_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"link_types"
,
link_types_table
,
qc
);
}
void
Settings_window
::
fill_table_states
(
const
string
&
palette_name
)
{
fill_table
(
states_table
,
SLOT
(
state_color_changed
(
const
QColor
&
)),
...
...
@@ -235,6 +308,10 @@ void Settings_window::fill_table_links( const string &palette_name ) {
"link_types"
,
palette_name
);
}
void
Settings_window
::
on_palette_list_currentIndexChanged
(
const
QString
&
text
)
{
_changed
=
true
;
fill_table_states
(
text
.
toStdString
());
...
...
@@ -394,79 +471,7 @@ void Settings_window::on_rm_state_btn_clicked() {
}
}
void
Settings_window
::
color_changed
(
string
name
,
QTableWidget
*
table
,
const
QColor
&
qc
)
{
_changed
=
true
;
if
(
!
table
||
!
palette_list
)
return
;
Color
color
(
qc
.
red
()
/
255.
,
qc
.
green
()
/
255.
,
qc
.
blue
()
/
255.
);
int
row
=
0
;
while
(
table
->
cellWidget
(
row
,
1
)
&&
table
->
cellWidget
(
row
,
1
)
!=
sender
())
{
// Find the row of the colorPicker
row
++
;
}
if
(
!
table
->
cellWidget
(
row
,
1
))
return
;
// epic fail...
std
::
string
palette_name
=
palette_list
->
currentText
().
toStdString
();
std
::
string
state_name
=
table
->
item
(
row
,
0
)
->
text
().
toStdString
();
Session
&
S
=
Session
::
getSession
();
Palette
*
p
=
S
.
get_palette
(
name
,
palette_name
);
bool
checked
=
qobject_cast
<
QCheckBox
*>
(
table
->
cellWidget
(
row
,
2
))
->
checkState
()
==
Qt
::
Checked
;
S
.
add_state_to_palette
(
name
,
palette_name
,
state_name
,
color
,
checked
);
p
->
add_state
(
state_name
,
color
,
checked
);
return
;
}
void
Settings_window
::
state_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"palette"
,
states_table
,
qc
);
}
void
Settings_window
::
event_types_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"event_types"
,
event_types_table
,
qc
);
}
void
Settings_window
::
link_types_color_changed
(
const
QColor
&
qc
)
{
color_changed
(
"link_types"
,
link_types_table
,
qc
);
}
void
Settings_window
::
add_table_line
(
QTableWidget
*
table
,
const
char
*
slot
,
int
&
row
,
std
::
string
st_name
,
Color
*
c
,
bool
checked
)
{
/* Name */
QTableWidgetItem
*
name
=
new
QTableWidgetItem
(
st_name
.
c_str
());
name
->
setFlags
(
Qt
::
ItemIsEnabled
);
/* Color */
QtColorPicker
*
color_widget
=
new
QtColorPicker
();
color_widget
->
setStandardColors
();
if
(
c
)
{
color_widget
->
setCurrentColor
(
QColor
(
c
->
get_red
()
*
255
,
c
->
get_green
()
*
255
,
c
->
get_blue
()
*
255
));
}
else
{
// \todo check the default color value -> put this in Palette as static member
color_widget
->
setCurrentColor
(
QColor
(
255
,
255
,
255
));
}
color_widget
->
setColorDialogEnabled
(
false
);
connect
(
color_widget
,
SIGNAL
(
colorChanged
(
const
QColor
&
)),
this
,
slot
);
/* Visible */
QCheckBox
*
cb
=
new
QCheckBox
();
cb
->
setChecked
(
checked
);
table
->
insertRow
(
row
);
table
->
setItem
(
row
,
0
,
name
);
table
->
setCellWidget
(
row
,
1
,
color_widget
);
table
->
setCellWidget
(
row
,
2
,
cb
);
row
++
;
}
/*************************/
/****** Types tab. ******/
...
...
src/interface/Settings_window.hpp
View file @
7ef73f3d
...
...
@@ -76,6 +76,12 @@ private:
*/
void
plugin_load_dirs_name
();
/*!
* \brief add an event type to the table
*/
void
add_table_line
(
QTableWidget
*
table
,
const
char
*
slot
,
int
&
,
std
::
string
,
Color
*
,
bool
);
/*!
* \brief Fill the state table with the states and theirs colors depending on the palette set.
*/
...
...
@@ -99,22 +105,6 @@ private:
*/
void
reload_minimap_tab
();
/*!
* \brief Fill the event types table
*/
void
fill_event_types_table
(
const
std
::
string
&
text
);
/*!
* \brief add an event type to the table
*/
void
add_table_line
(
QTableWidget
*
table
,
const
char
*
slot
,
int
&
,
std
::
string
,
Color
*
,
bool
);
/*!
* \brief Fill the link types table
*/
void
fill_link_types_table
(
const
std
::
string
&
text
);
/*!
* \brief add a palette to the list, for a given type
*/
...
...
@@ -158,6 +148,27 @@ public slots:
private
slots
:
/*!
* \fn state_color_changed(const QColor &c)
* \brief (state tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
state_color_changed
(
const
QColor
&
c
);
/*!
* \fn event_types_color_changed(const QColor &c)
* \brief (event_types tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
event_types_color_changed
(
const
QColor
&
c
);
/*!
* \fn link_types_color_changed(const QColor &c)
* \brief (link_types tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
link_types_color_changed
(
const
QColor
&
c
);
/*!
* \fn on_add_state_btn_clicked()
* \brief (state tab) Called when the user click on the add state button.
...
...
@@ -201,13 +212,6 @@ private slots:
*/
void
on_rm_palette_btn_clicked
();
/*!
* \fn state_color_changed(const QColor &c)
* \brief (state tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
state_color_changed
(
const
QColor
&
c
);
/*!
* \fn on_rm_dir_btn_clicked()
* \brief (plugin tab) Called when the user click on the remove directory button.
...
...
@@ -312,20 +316,6 @@ private slots:
*/
void
on_ok_clicked
();
/*!
* \fn event_types_color_changed(const QColor &c)
* \brief (event_types tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
event_types_color_changed
(
const
QColor
&
c
);
/*!
* \fn link_types_color_changed(const QColor &c)
* \brief (link_types tab) Called when the user changes an object in the table.
* \param c : the new color
*/
void
link_types_color_changed
(
const
QColor
&
c
);
/*!
* \fn on_use_palettes_triggered()
* \brief Called when the user changes use palettes setting.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment