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
93352a0a
Commit
93352a0a
authored
Apr 23, 2015
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented initial windows size
parent
ae8ecaf7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
40 deletions
+148
-40
src/plugins/coregui/mainwindow.cpp
src/plugins/coregui/mainwindow.cpp
+125
-40
src/plugins/coregui/mainwindow.h
src/plugins/coregui/mainwindow.h
+7
-0
src/shared/docbookviewer/docbookview.cpp
src/shared/docbookviewer/docbookview.cpp
+5
-0
src/shared/docbookviewer/docbookview.h
src/shared/docbookviewer/docbookview.h
+1
-0
src/shared/docbookviewer/docbookview_impl.cpp
src/shared/docbookviewer/docbookview_impl.cpp
+9
-0
src/shared/docbookviewer/docbookview_impl.h
src/shared/docbookviewer/docbookview_impl.h
+1
-0
No files found.
src/plugins/coregui/mainwindow.cpp
View file @
93352a0a
...
...
@@ -27,7 +27,9 @@ MainWindow::MainWindow(Plugin * p) :
statusBar_
(
new
StatusBar
),
tabWidget_
(
0
),
prevBottomSize_
(
DefaultConsoleHeight
),
menubarContextMenu_
(
0
)
menubarContextMenu_
(
0
),
afterShowTimerId2_
(
0
),
afterShowTimerId3_
(
0
)
{
debuggerWindow_
=
0
;
...
...
@@ -759,8 +761,18 @@ void MainWindow::setFocusOnCentralWidget()
void
MainWindow
::
timerEvent
(
QTimerEvent
*
e
)
{
checkCounterValue
();
e
->
accept
();
if
(
afterShowTimerId2_
==
e
->
timerId
())
{
killTimer
(
afterShowTimerId2_
);
afterShowTimerId2_
=
0
;
setFirstTimeWindowLayout_stage2
();
}
if
(
afterShowTimerId3_
==
e
->
timerId
())
{
killTimer
(
afterShowTimerId3_
);
afterShowTimerId3_
=
0
;
setFirstTimeWindowLayout_stage3
();
}
checkCounterValue
();
}
...
...
@@ -1535,7 +1547,6 @@ void MainWindow::disableTabs()
void
MainWindow
::
updateSettings
(
SettingsPtr
settings
,
const
QStringList
&
keys
)
{
// if (settings_) saveSettings();
settings_
=
settings
;
loadSettings
(
keys
);
for
(
int
i
=
0
;
i
<
tabWidget_
->
count
();
i
++
)
{
...
...
@@ -1565,51 +1576,125 @@ void MainWindow::loadSettings(const QStringList & keys)
}
}
QRect
r
=
settings_
->
value
(
Plugin
::
MainWindowGeometryKey
,
QRect
(
QPoint
(
-
1
,
-
1
),
QSize
(
940
,
540
))).
toRect
();
if
(
r
.
width
()
>
0
&&
(
keys
.
contains
(
Plugin
::
MainWindowGeometryKey
)
||
keys
.
isEmpty
())
)
{
resize
(
r
.
size
());
QPoint
ps
;
if
(
r
.
topLeft
()
!=
QPoint
(
-
1
,
-
1
))
{
ps
=
r
.
topLeft
();
}
else
{
const
QSize
screenSize
=
QApplication
::
desktop
()
->
availableGeometry
().
size
();
int
x
=
screenSize
.
width
()
-
r
.
width
();
int
y
=
screenSize
.
height
()
-
r
.
height
();
x
/=
2
;
y
/=
2
;
ps
=
QPoint
(
x
,
y
);
}
move
(
ps
);
}
if
(
keys
.
size
()
==
1
&&
"MainWindowLayout"
==
keys
[
0
])
{
// do nothing on hot layout change
QRect
(
QPoint
(
-
1
,
-
1
),
QSize
(
0
,
0
))).
toRect
();
if
(
r
.
width
()
*
r
.
height
()
==
0
)
{
setFirstTimeWindowLayout
();
}
else
{
centralSide_
->
updateSettings
(
settings_
,
keys
);
centralSide_
->
setVisible
(
true
);
// always visible even has null default settings
secondarySide_
->
updateSettings
(
settings_
,
keys
);
}
if
(
keys
.
contains
(
Plugin
::
MainWindowSplitterStateKey
+
"0"
)
||
keys
.
isEmpty
())
{
QList
<
int
>
sizes
;
sizes
<<
0
<<
0
;
sizes
[
0
]
=
settings_
->
value
(
Plugin
::
MainWindowSplitterStateKey
+
"0"
,
0
).
toInt
();
sizes
[
1
]
=
settings_
->
value
(
Plugin
::
MainWindowSplitterStateKey
+
"1"
,
0
).
toInt
();
prevBottomSize_
=
settings_
->
value
(
"SavedBottomSize"
,
DefaultConsoleHeight
).
toInt
();
if
(
sizes
[
0
]
+
sizes
[
1
]
>
0
)
{
// Restore saved layout
if
(
r
.
width
()
>
0
&&
(
keys
.
contains
(
Plugin
::
MainWindowGeometryKey
)
||
keys
.
isEmpty
())
)
{
resize
(
r
.
size
());
QPoint
ps
;
if
(
r
.
topLeft
()
!=
QPoint
(
-
1
,
-
1
))
{
ps
=
r
.
topLeft
();
}
else
{
const
QSize
screenSize
=
QApplication
::
desktop
()
->
availableGeometry
().
size
();
int
x
=
screenSize
.
width
()
-
r
.
width
();
int
y
=
screenSize
.
height
()
-
r
.
height
();
x
/=
2
;
y
/=
2
;
ps
=
QPoint
(
x
,
y
);
}
move
(
ps
);
}
if
(
keys
.
size
()
==
1
&&
"MainWindowLayout"
==
keys
[
0
])
{
// do nothing on hot layout change
}
else
{
sizes
[
1
]
=
prevBottomSize_
;
sizes
[
0
]
=
height
()
-
sizes
[
1
];
centralSide_
->
updateSettings
(
settings_
,
keys
);
centralSide_
->
setVisible
(
true
);
// always visible even has null default settings
secondarySide_
->
updateSettings
(
settings_
,
keys
);
}
if
(
keys
.
contains
(
Plugin
::
MainWindowSplitterStateKey
+
"0"
)
||
keys
.
isEmpty
())
{
QList
<
int
>
sizes
;
sizes
<<
0
<<
0
;
sizes
[
0
]
=
settings_
->
value
(
Plugin
::
MainWindowSplitterStateKey
+
"0"
,
0
).
toInt
();
sizes
[
1
]
=
settings_
->
value
(
Plugin
::
MainWindowSplitterStateKey
+
"1"
,
0
).
toInt
();
prevBottomSize_
=
settings_
->
value
(
"SavedBottomSize"
,
DefaultConsoleHeight
).
toInt
();
if
(
sizes
[
0
]
+
sizes
[
1
]
>
0
)
{
}
else
{
sizes
[
1
]
=
prevBottomSize_
;
sizes
[
0
]
=
height
()
-
sizes
[
1
];
}
ui
->
splitter
->
setSizes
(
sizes
);
ui
->
actionShow_Console_Pane
->
setChecked
(
sizes
[
1
]
>
0
);
}
ui
->
splitter
->
setSizes
(
sizes
);
ui
->
actionShow_Console_Pane
->
setChecked
(
sizes
[
1
]
>
0
);
}
}
menubarContextMenu_
->
loadSettings
();
}
void
MainWindow
::
setFirstTimeWindowLayout
()
{
const
QRect
workspaceSize
=
QApplication
::
desktop
()
->
availableGeometry
();
bool
maximizeWindow
=
workspaceSize
.
width
()
<=
1280
||
workspaceSize
.
height
()
<=
700
;
if
(
maximizeWindow
)
{
showMaximized
();
}
else
{
resize
(
1280
,
700
);
const
int
x
=
(
workspaceSize
.
width
()
-
1280
)
/
2
;
const
int
y
=
(
workspaceSize
.
height
()
-
700
)
/
2
;
move
(
x
,
y
);
}
afterShowTimerId2_
=
startTimer
(
200
);
// Then process setFirstTimeWindowLayout_stage2()
}
void
MainWindow
::
setFirstTimeWindowLayout_stage2
()
{
// switchToRowFirstLayout();
afterShowTimerId3_
=
startTimer
(
300
);
// Then process setFirstTimeWindowLayout_stage3()
}
void
MainWindow
::
setFirstTimeWindowLayout_stage3
()
{
setConsoleVisible
(
true
);
m_plugin
->
showActorWindow
(
"Robot"
);
showHelp
();
const
int
AreaWidth
=
width
()
-
layout
()
->
contentsMargins
().
left
()
-
layout
()
->
contentsMargins
().
right
()
;
const
int
AreaHeight
=
height
()
-
layout
()
->
contentsMargins
().
top
()
-
layout
()
->
contentsMargins
().
bottom
()
-
menuBar
()
->
height
()
-
statusBar
()
->
height
()
;
static
const
int
InitialBottomHeight
=
120
;
const
int
InitialTopHeight
=
AreaHeight
-
InitialBottomHeight
-
ui
->
splitter
->
handleWidth
();
QList
<
int
>
terminalSplitterSizes
;
terminalSplitterSizes
.
append
(
InitialTopHeight
);
terminalSplitterSizes
.
append
(
InitialBottomHeight
);
centralSide_
->
setSizes
(
terminalSplitterSizes
);
const
int
editorWidth
=
(
AreaWidth
-
ui
->
splitter
->
handleWidth
())
/
2
;
const
int
rightWidth
=
AreaWidth
-
editorWidth
;
QList
<
int
>
horizontalSplitterSizes
;
horizontalSplitterSizes
.
append
(
editorWidth
);
horizontalSplitterSizes
.
append
(
rightWidth
);
ui
->
splitter
->
setSizes
(
horizontalSplitterSizes
);
static
const
int
InitialRobotHeight
=
220
;
const
int
helpHeight
=
secondarySide_
->
height
()
-
secondarySide_
->
handleWidth
()
-
InitialRobotHeight
;
QList
<
int
>
sidePanelSplitterSizes
;
sidePanelSplitterSizes
.
append
(
helpHeight
);
sidePanelSplitterSizes
.
append
(
InitialRobotHeight
);
secondarySide_
->
setSizes
(
sidePanelSplitterSizes
);
m_plugin
->
helpViewer_
->
setInitialView
();
}
void
MainWindow
::
saveSettings
()
{
if
(
!
settings_
)
...
...
src/plugins/coregui/mainwindow.h
View file @
93352a0a
...
...
@@ -117,6 +117,9 @@ public slots:
void
saveNativeExecutable
();
private
slots
:
void
setFirstTimeWindowLayout
();
void
setFirstTimeWindowLayout_stage2
();
void
setFirstTimeWindowLayout_stage3
();
void
loadRecentFile
();
void
prepareRecentFilesMenu
();
void
prepareRunMenu
();
...
...
@@ -205,8 +208,12 @@ private:
Widgets
::
SecondaryWindow
*
debuggerWindow_
;
// changes place on layout change
class
ToolbarContextMenu
*
menubarContextMenu_
;
QList
<
QMenu
*>
topLevelMenus_
;
int
afterShowTimerId2_
;
int
afterShowTimerId3_
;
};
}
// namespace CoreGUI
#endif // COREGUI_MAINWINDOW_H
src/shared/docbookviewer/docbookview.cpp
View file @
93352a0a
...
...
@@ -104,6 +104,11 @@ void DocBookView::clearNavigationFilters()
pImpl_
->
clearNavigationFilters
();
}
void
DocBookView
::
setInitialView
()
{
pImpl_
->
setInitialView
();
}
QStringList
DocBookView
::
booksList
()
const
{
return
pImpl_
->
booksList
();
...
...
src/shared/docbookviewer/docbookview.h
View file @
93352a0a
...
...
@@ -43,6 +43,7 @@ public:
bool
hasAlgorithm
(
const
QString
&
name
)
const
;
void
navigateToApiFunction
(
const
QString
&
package
,
const
QString
&
function
);
void
clearNavigationFilters
();
void
setInitialView
();
void
setRole
(
ModelType
category
,
const
QString
&
value
);
QString
role
(
ModelType
category
)
const
;
...
...
src/shared/docbookviewer/docbookview_impl.cpp
View file @
93352a0a
...
...
@@ -175,6 +175,15 @@ void DocBookViewImpl::showSidePanel()
enoughtSizeContainer_
->
layout
()
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
void
DocBookViewImpl
::
setInitialView
()
{
showSidePanel
();
QList
<
int
>
sizes
;
sizes
.
append
(
240
);
sizes
.
append
(
splitter_
->
width
()
-
splitter_
->
handleWidth
()
-
240
);
splitter_
->
setSizes
(
sizes
);
}
QSize
DocBookViewImpl
::
minimumSizeHint
()
const
{
// int minW = qMax(sidePanel_->minimumSizeHint().width(),
...
...
src/shared/docbookviewer/docbookview_impl.h
View file @
93352a0a
...
...
@@ -59,6 +59,7 @@ public slots:
void
showPrintDialog
();
void
hideSidePanel
();
void
showSidePanel
();
void
setInitialView
();
void
setSize
(
const
QSize
&
size
);
void
switchToCompactMode
(
bool
force
=
false
);
...
...
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