Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
eaffc365
Commit
eaffc365
authored
Sep 14, 2009
by
Ludovic Fauvet
Browse files
GUI: Link the dock widgets with their menu action
parent
6566340f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/GUI/DockWidgetManager.cpp
View file @
eaffc365
...
...
@@ -29,10 +29,10 @@ DockWidgetManager *DockWidgetManager::m_instance = 0;
DockWidgetManager
*
DockWidgetManager
::
instance
(
QObject
*
parent
)
{
if
(
m_instance
==
0
)
if
(
!
m_instance
)
m_instance
=
new
DockWidgetManager
(
parent
);
return
(
m_instance
)
;
return
m_instance
;
}
void
DockWidgetManager
::
setMainWindow
(
MainWindow
*
mainWin
)
...
...
@@ -40,14 +40,15 @@ void DockWidgetManager::setMainWindow( MainWindow *mainWin )
m_mainWin
=
mainWin
;
}
void
DockWidgetManager
::
addDockedWidget
(
QWidget
*
widget
,
QDockWidget
*
DockWidgetManager
::
addDockedWidget
(
QWidget
*
widget
,
const
QString
&
qs_name
,
Qt
::
DockWidgetAreas
areas
,
QDockWidget
::
DockWidgetFeature
features
,
Qt
::
DockWidgetArea
startArea
)
Qt
::
DockWidgetArea
startArea
,
QAction
*
action
)
{
if
(
m_dockWidgets
.
contains
(
qs_name
)
)
return
;
return
NULL
;
QDockWidget
*
dock
=
new
QDockWidget
(
tr
(
qs_name
.
toStdString
().
c_str
()
),
m_mainWin
);
...
...
@@ -58,6 +59,17 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
m_mainWin
->
addDockWidget
(
startArea
,
dock
);
m_mainWin
->
registerWidgetInViewMenu
(
dock
);
widget
->
show
();
if
(
action
)
{
// Link the dock visibility with the menu
connect
(
action
,
SIGNAL
(
toggled
(
bool
)
),
dock
,
SLOT
(
setVisible
(
bool
)
)
);
connect
(
dock
,
SIGNAL
(
visibilityChanged
(
bool
)
),
action
,
SLOT
(
setChecked
(
bool
)
)
);
}
return
dock
;
}
...
...
src/GUI/DockWidgetManager.h
View file @
eaffc365
...
...
@@ -39,11 +39,12 @@ class DockWidgetManager : public QObject
public:
static
DockWidgetManager
*
instance
(
QObject
*
parent
=
0
);
void
setMainWindow
(
MainWindow
*
mainWin
);
void
addDockedWidget
(
QWidget
*
widget
,
QDockWidget
*
addDockedWidget
(
QWidget
*
widget
,
const
QString
&
qs_name
,
Qt
::
DockWidgetAreas
areas
,
QDockWidget
::
DockWidgetFeature
features
,
Qt
::
DockWidgetArea
startArea
);
Qt
::
DockWidgetArea
startArea
,
QAction
*
action
=
0
);
protected:
//virtual void changeEvent( QEvent *e );
...
...
src/GUI/MainWindow.cpp
View file @
eaffc365
...
...
@@ -111,7 +111,8 @@ void MainWindow::setupLibrary()
tr
(
"Media Library"
),
Qt
::
AllDockWidgetAreas
,
QDockWidget
::
AllDockWidgetFeatures
,
Qt
::
LeftDockWidgetArea
);
Qt
::
LeftDockWidgetArea
,
m_ui
.
actionMedia_library
);
//Connecting GUI and Frontend :
connect
(
libraryWidget
,
...
...
@@ -236,31 +237,36 @@ void MainWindow::initializeDockWidgets( void )
setCentralWidget
(
m_timeline
);
DockWidgetManager
*
dockManager
=
DockWidgetManager
::
instance
();
dockManager
->
addDockedWidget
(
new
FileBrowser
(
this
),
tr
(
"FileBrowser"
),
Qt
::
AllDockWidgetAreas
,
QDockWidget
::
AllDockWidgetFeatures
,
Qt
::
TopDockWidgetArea
);
Qt
::
TopDockWidgetArea
,
m_ui
.
actionFile_browser
);
m_clipPreview
=
new
PreviewWidget
(
new
ClipRenderer
,
this
);
dockManager
->
addDockedWidget
(
m_clipPreview
,
tr
(
"Clip Preview"
),
Qt
::
AllDockWidgetAreas
,
QDockWidget
::
AllDockWidgetFeatures
,
Qt
::
TopDockWidgetArea
);
Qt
::
TopDockWidgetArea
,
m_ui
.
actionClip_preview
);
m_projectPreview
=
new
PreviewWidget
(
new
WorkflowRenderer
(),
this
);
dockManager
->
addDockedWidget
(
m_projectPreview
,
tr
(
"Project Preview"
),
Qt
::
AllDockWidgetAreas
,
QDockWidget
::
AllDockWidgetFeatures
,
Qt
::
TopDockWidgetArea
);
Qt
::
TopDockWidgetArea
,
m_ui
.
actionProject_preview
);
dockManager
->
addDockedWidget
(
UndoStack
::
getInstance
(
this
),
tr
(
"History"
),
Qt
::
AllDockWidgetAreas
,
QDockWidget
::
AllDockWidgetFeatures
,
Qt
::
LeftDockWidgetArea
);
Qt
::
LeftDockWidgetArea
,
m_ui
.
actionUndoRedo
);
setupLibrary
();
m_metaDataManager
=
MetaDataManager
::
getInstance
();
}
...
...
src/GUI/ui/MainWindow.ui
View file @
eaffc365
...
...
@@ -27,7 +27,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
800
</width>
<height>
2
1
</height>
<height>
2
4
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuFile"
>
...
...
@@ -67,8 +67,11 @@
<property
name=
"title"
>
<string>
Window
</string>
</property>
<addaction
name=
"actionMedia_Library"
/>
<addaction
name=
"actionPreview"
/>
<addaction
name=
"actionFile_browser"
/>
<addaction
name=
"actionMedia_library"
/>
<addaction
name=
"actionProject_preview"
/>
<addaction
name=
"actionClip_preview"
/>
<addaction
name=
"actionUndoRedo"
/>
</widget>
<widget
class=
"QMenu"
name=
"menuHelp"
>
<property
name=
"title"
>
...
...
@@ -110,15 +113,15 @@
<string>
Preferences
</string>
</property>
</action>
<action
name=
"actionMedia_
L
ibrary"
>
<action
name=
"actionMedia_
l
ibrary"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Media
L
ibrary
</string>
<string>
Media
l
ibrary
</string>
</property>
</action>
<action
name=
"actionPreview"
>
<action
name=
"actionPr
oject_pr
eview"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
...
...
@@ -126,7 +129,7 @@
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
Preview
</string>
<string>
Pr
oject pr
eview
</string>
</property>
</action>
<action
name=
"actionTranscode_File"
>
...
...
@@ -176,6 +179,30 @@
<string>
Save
</string>
</property>
</action>
<action
name=
"actionFile_browser"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
File browser
</string>
</property>
</action>
<action
name=
"actionClip_preview"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Clip preview
</string>
</property>
</action>
<action
name=
"actionUndoRedo"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Undo/Redo
</string>
</property>
</action>
</widget>
<resources>
<include
location=
"../../../ressources.qrc"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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