Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
user-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
00ea82be
authored
7 years ago
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed template handling
parent
a7659a8f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
20 deletions
+22
-20
controller.cpp
+6
-4
controller.h
+2
-2
libocci
+1
-1
mainwindow.cpp
+3
-3
mainwindow.h
+1
-1
mainwindow.ui
+4
-4
vmchooserdialog.cpp
+2
-2
vmchooserdialog.h
+3
-3
No files found.
controller.cpp
View file @
00ea82be
...
...
@@ -24,6 +24,7 @@ bool Controller::login(std::string username, std::string password){
refresh
();
//initialize data
return
true
;
}
OcciClient
::
Template
::
getTemplates
(
session
);
return
false
;
}
...
...
@@ -34,8 +35,9 @@ void Controller::refresh(){
allCompute
.
clear
();
for
(
auto
c
:
OcciClient
::
Compute
::
getComputeInstances
(
session
))
allCompute
.
push_back
(
c
);
OcciClient
::
Template
::
getTemplates
(
session
);
//test
allTemplate
.
clear
();
for
(
auto
t
:
OcciClient
::
getTemplates
(
session
))
for
(
auto
t
:
OcciClient
::
Template
::
getTemplates
(
session
))
allTemplate
.
push_back
(
t
);
}
...
...
@@ -62,7 +64,7 @@ std::vector<std::string> Controller::getVMs(){
std
::
vector
<
std
::
string
>
Controller
::
getTemplates
(){
std
::
vector
<
std
::
string
>
templates
;
for
(
auto
t
:
allTemplate
){
templates
.
push_back
(
t
);
templates
.
push_back
(
t
->
getTitle
().
c_str
()
);
}
return
templates
;
}
...
...
@@ -157,7 +159,7 @@ void Controller::sleepByID(std::string id){
* \brief Creates a new Compute by the Template
* \param id
*/
void
Controller
::
newCompute
(
Template
t
){
OcciClient
::
Compute
::
createComputeInstance
(
session
,
t
);
void
Controller
::
newCompute
(
std
::
shared_ptr
<
OcciClient
::
Template
>
t
){
OcciClient
::
Compute
::
createComputeInstance
(
session
,
t
.
get
()
);
refresh
();
}
This diff is collapsed.
Click to expand it.
controller.h
View file @
00ea82be
...
...
@@ -12,7 +12,7 @@ class Controller
public
:
OcciClient
::
OcciSession
*
session
;
std
::
vector
<
std
::
shared_ptr
<
OcciClient
::
Compute
>
>
allCompute
;
std
::
vector
<
Template
>
allTemplate
;
std
::
vector
<
std
::
shared_ptr
<
OcciClient
::
Template
>
>
allTemplate
;
bool
connect
(
std
::
string
url
);
...
...
@@ -30,7 +30,7 @@ public:
void
sleepByID
(
std
::
string
id
);
void
newCompute
(
Template
);
void
newCompute
(
std
::
shared_ptr
<
OcciClient
::
Template
>
);
ComputeData
getDataByID
(
std
::
string
id
);
...
...
This diff is collapsed.
Click to expand it.
libocci
@
f6d8d3ae
Subproject commit
30b4a5c111538425007e4721c91c66ed0e73424d
Subproject commit
f6d8d3aefac88d17c95d4aecbbfb76d7f71c8612
This diff is collapsed.
Click to expand it.
mainwindow.cpp
View file @
00ea82be
...
...
@@ -229,8 +229,8 @@ void MainWindow::on_bNewVM_clicked()
{
VMChooserDialog
*
v
=
new
VMChooserDialog
(
this
);
v
->
setWindowTitle
(
"New Virtual Machine"
);
v
->
set_templates
(
getTemplates
(
myController
.
session
));
connect
(
v
,
SIGNAL
(
send_chosen_template
(
Template
)),
this
,
SLOT
(
receive_chosen_template
(
Template
)));
v
->
set_templates
(
OcciClient
::
Template
::
getTemplates
(
myController
.
session
));
connect
(
v
,
SIGNAL
(
send_chosen_template
(
OcciClient
::
Template
)),
this
,
SLOT
(
receive_chosen_template
(
OcciClient
::
Template
)));
v
->
exec
();
}
...
...
@@ -238,7 +238,7 @@ void MainWindow::on_bNewVM_clicked()
* \brief Slot for dialog, creates new VM by the chosen template
* \param t
*/
void
MainWindow
::
receive_chosen_template
(
Template
t
){
void
MainWindow
::
receive_chosen_template
(
std
::
shared_ptr
<
OcciClient
::
Template
>
t
){
myController
.
newCompute
(
t
);
loadAllData
();
}
...
...
This diff is collapsed.
Click to expand it.
mainwindow.h
View file @
00ea82be
...
...
@@ -40,7 +40,7 @@ private slots:
void
startshutdownClicked
(
std
::
string
);
void
wakeupsleepClicked
(
std
::
string
);
void
receive_chosen_template
(
Template
);
void
receive_chosen_template
(
std
::
shared_ptr
<
OcciClient
::
Template
>
);
void
on_listWidget_clicked
(
const
QModelIndex
&
index
);
...
...
This diff is collapsed.
Click to expand it.
mainwindow.ui
View file @
00ea82be
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
691
</width>
<height>
471
</height>
<width>
1064
</width>
<height>
514
</height>
</rect>
</property>
<property
name=
"palette"
>
...
...
@@ -95,7 +95,7 @@
<enum>
QTabWidget::Rounded
</enum>
</property>
<property
name=
"currentIndex"
>
<number>
0
</number>
<number>
2
</number>
</property>
<property
name=
"iconSize"
>
<size>
...
...
@@ -857,7 +857,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
691
</width>
<width>
1064
</width>
<height>
19
</height>
</rect>
</property>
...
...
This diff is collapsed.
Click to expand it.
vmchooserdialog.cpp
View file @
00ea82be
...
...
@@ -21,10 +21,10 @@ void VMChooserDialog::on_buttonBox_rejected()
this
->
done
(
-
1
);
}
void
VMChooserDialog
::
set_templates
(
std
::
vector
<
Template
>
_templates
){
void
VMChooserDialog
::
set_templates
(
std
::
vector
<
std
::
shared_ptr
<
OcciClient
::
Template
>
>
_templates
){
templates
=
_templates
;
for
(
auto
t
:
templates
){
ui
->
lwTemplates
->
addItem
(
QString
::
fromUtf8
(
t
.
c_str
()));
ui
->
lwTemplates
->
addItem
(
QString
::
fromUtf8
(
t
->
getTitle
()
.
c_str
()));
}
}
...
...
This diff is collapsed.
Click to expand it.
vmchooserdialog.h
View file @
00ea82be
...
...
@@ -12,11 +12,11 @@ class VMChooserDialog : public QDialog
Q_OBJECT
public
:
explicit
VMChooserDialog
(
QWidget
*
parent
=
0
);
void
set_templates
(
std
::
vector
<
Template
>
templates
);
void
set_templates
(
std
::
vector
<
std
::
shared_ptr
<
OcciClient
::
Template
>
>
templates
);
~
VMChooserDialog
();
signals
:
void
send_chosen_template
(
Template
);
void
send_chosen_template
(
std
::
shared_ptr
<
OcciClient
::
Template
>
);
private
slots
:
...
...
@@ -26,7 +26,7 @@ private slots:
private
:
Ui
::
VMChooserDialog
*
ui
;
std
::
vector
<
Template
>
templates
;
std
::
vector
<
std
::
shared_ptr
<
OcciClient
::
Template
>
>
templates
;
};
#endif // VMCHOOSERDIALOG_H
This diff is collapsed.
Click to expand it.
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