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
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
04b11612
Commit
04b11612
authored
May 26, 2017
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to be courseless
parent
e26322e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
26 deletions
+52
-26
src/plugins/coregui/defaultstartpage.cpp
src/plugins/coregui/defaultstartpage.cpp
+51
-26
src/plugins/coregui/defaultstartpage.h
src/plugins/coregui/defaultstartpage.h
+1
-0
No files found.
src/plugins/coregui/defaultstartpage.cpp
View file @
04b11612
...
...
@@ -2,6 +2,8 @@
#include "plugin.h"
#include "mainwindow.h"
#include "ui_defaultstartpage.h"
#include <kumir2-libs/extensionsystem/pluginmanager.h>
#include <kumir2/coursesinterface.h>
#include <QtCore>
#if QT_VERSION >= 0x050000
...
...
@@ -20,6 +22,12 @@ CoreGUI::DefaultStartPage::DefaultStartPage(Plugin* plugin, MainWindow* mw, QWid
this
->
setObjectName
(
"startPageRoot"
);
ui
->
setupUi
(
this
);
CoursesInterface
*
cs
=
ExtensionSystem
::
PluginManager
::
instance
()
->
findPlugin
<
CoursesInterface
>
();
_coursesAvailable
=
0
!=
cs
;
ui
->
coursesBox
->
setVisible
(
_coursesAvailable
);
relayoutBlocks
(
this
->
width
());
ui
->
headerText
->
setText
(
_mainWindow
->
applicationTitle
()
+
" "
+
_plugin
->
applicationVersionString
());
...
...
@@ -76,32 +84,45 @@ void CoreGUI::DefaultStartPage::relayoutBlocks(const int width)
static
const
int
OneCol
=
400
;
static
const
int
TwoCol
=
780
;
int
columns
=
3
;
if
(
width
<
OneCol
)
columns
=
1
;
else
if
(
width
<
TwoCol
)
columns
=
2
;
int
columns
;
int
programsRow
,
programsColumn
,
coursesRow
,
coursesColumn
,
helpRow
,
helpColumn
;
if
(
3
==
columns
)
{
programsRow
=
coursesRow
=
helpRow
=
0
;
programsColumn
=
0
;
coursesColumn
=
1
;
helpColumn
=
2
;
}
else
if
(
2
==
columns
)
{
programsRow
=
coursesRow
=
0
;
helpRow
=
1
;
programsColumn
=
0
;
coursesColumn
=
1
;
helpColumn
=
0
;
if
(
_coursesAvailable
)
{
columns
=
3
;
if
(
width
<
OneCol
)
columns
=
1
;
else
if
(
width
<
TwoCol
)
columns
=
2
;
if
(
3
==
columns
)
{
programsRow
=
coursesRow
=
helpRow
=
0
;
programsColumn
=
0
;
coursesColumn
=
1
;
helpColumn
=
2
;
}
else
if
(
2
==
columns
)
{
programsRow
=
coursesRow
=
0
;
helpRow
=
1
;
programsColumn
=
0
;
coursesColumn
=
1
;
helpColumn
=
0
;
}
else
if
(
1
==
columns
)
{
programsColumn
=
coursesColumn
=
helpColumn
=
0
;
programsRow
=
0
;
coursesRow
=
1
;
helpRow
=
2
;
}
}
else
if
(
1
==
columns
)
{
programsColumn
=
coursesColumn
=
helpColumn
=
0
;
programsRow
=
0
;
coursesRow
=
1
;
helpRow
=
2
;
else
{
columns
=
width
<
OneCol
?
1
:
2
;
if
(
2
==
columns
)
{
programsRow
=
helpRow
=
0
;
programsColumn
=
0
;
helpColumn
=
1
;
}
else
{
programsRow
=
0
;
helpRow
=
1
;
programsColumn
=
helpColumn
=
0
;
}
}
ui
->
centralViewLayout
->
removeWidget
(
ui
->
programsBox
);
...
...
@@ -109,7 +130,9 @@ void CoreGUI::DefaultStartPage::relayoutBlocks(const int width)
ui
->
centralViewLayout
->
removeWidget
(
ui
->
headerBox
);
ui
->
centralViewLayout
->
addWidget
(
ui
->
programsBox
,
programsRow
,
programsColumn
,
1
,
1
);
ui
->
centralViewLayout
->
addWidget
(
ui
->
coursesBox
,
coursesRow
,
coursesColumn
,
1
,
1
);
if
(
_coursesAvailable
)
{
ui
->
centralViewLayout
->
addWidget
(
ui
->
coursesBox
,
coursesRow
,
coursesColumn
,
1
,
1
);
}
ui
->
centralViewLayout
->
addWidget
(
ui
->
helpBox
,
helpRow
,
helpColumn
,
1
,
1
);
updateContents
();
...
...
@@ -117,8 +140,10 @@ void CoreGUI::DefaultStartPage::relayoutBlocks(const int width)
void
CoreGUI
::
DefaultStartPage
::
updateContents
()
{
updateRecentFiles
();
updateRecentCourses
();
updateRecentFiles
();
if
(
_coursesAvailable
)
{
updateRecentCourses
();
}
updateHelp
();
}
...
...
src/plugins/coregui/defaultstartpage.h
View file @
04b11612
...
...
@@ -54,6 +54,7 @@ protected Q_SLOTS:
protected
/*fields*/
:
Plugin
*
_plugin
;
MainWindow
*
_mainWindow
;
bool
_coursesAvailable
;
Ui
::
DefaultStartPage
*
ui
;
...
...
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