Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-gpu
Commits
972e5e45
Commit
972e5e45
authored
Sep 16, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: open dialog code simplification
parent
718ee0d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
59 deletions
+60
-59
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.cpp
+59
-56
modules/gui/qt4/dialogs/open.hpp
modules/gui/qt4/dialogs/open.hpp
+1
-3
No files found.
modules/gui/qt4/dialogs/open.cpp
View file @
972e5e45
/*****************************************************************************
* open.cpp : Advanced open dialog
*****************************************************************************
* Copyright © 2006-2009 the VideoLAN team
* $Id$
* Copyright © 2006-2011 the VideoLAN team
*
* Authors: Jean-Baptiste Kempf <jb@videolan.org>
*
...
...
@@ -26,9 +25,7 @@
#endif
#include "dialogs/open.hpp"
#include "dialogs_provider.hpp"
#include "recents.hpp"
#include "util/qt_dirs.hpp"
...
...
@@ -37,7 +34,9 @@
#include <QRegExp>
#include <QMenu>
#define DEBUG_QT 1
#ifndef NDEBUG
# define DEBUG_QT 1
#endif
OpenDialog
*
OpenDialog
::
instance
=
NULL
;
...
...
@@ -157,7 +156,7 @@ OpenDialog::OpenDialog( QWidget *parent,
CONNECT
(
ui
.
slaveCheckbox
,
toggled
(
bool
),
this
,
updateMRL
()
);
CONNECT
(
ui
.
slaveText
,
textChanged
(
const
QString
&
),
this
,
updateMRL
()
);
CONNECT
(
ui
.
cacheSpinBox
,
valueChanged
(
int
),
this
,
updateMRL
()
);
CONNECT
(
ui
.
startTimeTimeEdit
,
timeChanged
(
const
QTime
&
),
this
,
updateMRL
()
);
CONNECT
(
ui
.
startTimeTimeEdit
,
timeChanged
(
const
QTime
&
),
this
,
updateMRL
()
);
BUTTONACT
(
ui
.
advancedCheckBox
,
toggleAdvancedPanel
()
);
BUTTONACT
(
ui
.
slaveBrowseButton
,
browseInputSlave
()
);
...
...
@@ -187,27 +186,6 @@ OpenDialog::OpenDialog( QWidget *parent,
resize
(
getSettings
()
->
value
(
"opendialog-size"
,
QSize
(
500
,
400
)
).
toSize
()
);
}
OpenDialog
::~
OpenDialog
()
{
getSettings
()
->
setValue
(
"opendialog-size"
,
size
()
-
(
ui
.
advancedFrame
->
isEnabled
()
?
QSize
(
0
,
ui
.
advancedFrame
->
height
())
:
QSize
(
0
,
0
)
)
);
getSettings
()
->
setValue
(
"opendialog-advanced"
,
ui
.
advancedFrame
->
isVisible
()
);
}
/* Used by VLM dialog and inputSlave selection */
QString
OpenDialog
::
getMRL
(
bool
b_all
)
{
if
(
itemsMRL
.
count
()
==
0
)
return
""
;
return
b_all
?
itemsMRL
[
0
]
+
ui
.
advancedLineInput
->
text
()
:
itemsMRL
[
0
];
}
QString
OpenDialog
::
getOptions
()
{
return
ui
.
advancedLineInput
->
text
();
}
/* Finish the dialog and decide if you open another one after */
void
OpenDialog
::
setMenuAction
()
{
...
...
@@ -239,29 +217,37 @@ void OpenDialog::setMenuAction()
}
}
void
OpenDialog
::
showTab
(
int
i_tab
)
OpenDialog
::~
OpenDialog
(
)
{
if
(
i_tab
==
OPEN_CAPTURE_TAB
)
captureOpenPanel
->
initialize
();
ui
.
Tab
->
setCurrentIndex
(
i_tab
);
show
();
if
(
ui
.
Tab
->
currentWidget
()
!=
NULL
)
{
OpenPanel
*
panel
=
dynamic_cast
<
OpenPanel
*>
(
ui
.
Tab
->
currentWidget
()
);
assert
(
panel
);
panel
->
onFocus
();
}
getSettings
()
->
setValue
(
"opendialog-size"
,
size
()
-
(
ui
.
advancedFrame
->
isEnabled
()
?
QSize
(
0
,
ui
.
advancedFrame
->
height
())
:
QSize
(
0
,
0
)
)
);
getSettings
()
->
setValue
(
"opendialog-advanced"
,
ui
.
advancedFrame
->
isVisible
()
);
}
/* Function called on signal currentChanged triggered */
void
OpenDialog
::
signalCurrent
(
int
i_tab
)
/* Used by VLM dialog and inputSlave selection */
QString
OpenDialog
::
getMRL
(
bool
b_all
)
{
if
(
itemsMRL
.
count
()
==
0
)
return
""
;
return
b_all
?
itemsMRL
[
0
]
+
ui
.
advancedLineInput
->
text
()
:
itemsMRL
[
0
];
}
QString
OpenDialog
::
getOptions
()
{
return
ui
.
advancedLineInput
->
text
();
}
void
OpenDialog
::
showTab
(
int
i_tab
)
{
if
(
i_tab
==
OPEN_CAPTURE_TAB
)
captureOpenPanel
->
initialize
();
ui
.
Tab
->
setCurrentIndex
(
i_tab
);
show
();
if
(
ui
.
Tab
->
currentWidget
()
!=
NULL
)
{
OpenPanel
*
panel
=
dynamic_cast
<
OpenPanel
*>
(
ui
.
Tab
->
currentWidget
()
);
assert
(
panel
);
panel
->
onFocus
();
panel
->
updateMRL
();
}
}
...
...
@@ -285,6 +271,27 @@ void OpenDialog::toggleAdvancedPanel()
}
}
void
OpenDialog
::
browseInputSlave
()
{
OpenDialog
*
od
=
new
OpenDialog
(
this
,
p_intf
,
true
,
SELECT
);
od
->
exec
();
ui
.
slaveText
->
setText
(
od
->
getMRL
(
false
)
);
delete
od
;
}
/* Function called on signal currentChanged triggered */
void
OpenDialog
::
signalCurrent
(
int
i_tab
)
{
if
(
i_tab
==
OPEN_CAPTURE_TAB
)
captureOpenPanel
->
initialize
();
if
(
ui
.
Tab
->
currentWidget
()
!=
NULL
)
{
OpenPanel
*
panel
=
dynamic_cast
<
OpenPanel
*>
(
ui
.
Tab
->
currentWidget
()
);
assert
(
panel
);
panel
->
onFocus
();
panel
->
updateMRL
();
}
}
/***********
* Actions *
***********/
...
...
@@ -334,18 +341,14 @@ void OpenDialog::selectSlots()
}
}
/* Play Action, called from selectSlots or play Menu */
void
OpenDialog
::
play
()
{
finish
(
false
);
}
void
OpenDialog
::
enqueue
()
{
finish
(
true
);
enqueue
(
false
);
}
void
OpenDialog
::
finish
(
bool
b_enqueue
=
fals
e
)
/* Enqueue Action, called from selectSlots or enqueue Menu */
void
OpenDialog
::
enqueue
(
bool
b_enqueu
e
)
{
toggleVisible
();
...
...
@@ -355,6 +358,9 @@ void OpenDialog::finish( bool b_enqueue = false )
return
;
}
/* for( int i = 0; i < OPEN_TAB_MAX; i++ )
dynamic_cast<OpenPanel*>( ui.Tab->widget( i ) )->onAccept(); */
/* Sort alphabetically */
itemsMRL
.
sort
();
...
...
@@ -417,7 +423,7 @@ void OpenDialog::stream( bool b_transcode_only )
ui
.
advancedLineInput
->
text
().
split
(
" :"
)
);
}
/* Update the MRL */
/* Update the MRL
items from the panels
*/
void
OpenDialog
::
updateMRL
(
const
QStringList
&
item
,
const
QString
&
tempMRL
)
{
optionsMRL
=
tempMRL
;
...
...
@@ -425,6 +431,7 @@ void OpenDialog::updateMRL( const QStringList& item, const QString& tempMRL )
updateMRL
();
}
/* Update the complete MRL */
void
OpenDialog
::
updateMRL
()
{
QString
mrl
=
optionsMRL
;
if
(
ui
.
slaveCheckbox
->
isChecked
()
)
{
...
...
@@ -444,6 +451,7 @@ void OpenDialog::updateMRL() {
ui
.
mrlLine
->
setText
(
itemsMRL
.
join
(
" "
)
);
}
/* Change the caching combobox */
void
OpenDialog
::
newCachingMethod
(
const
QString
&
method
)
{
if
(
method
!=
storedMethod
)
{
...
...
@@ -453,6 +461,8 @@ void OpenDialog::newCachingMethod( const QString& method )
}
}
/* Split the entries
* FIXME! */
QStringList
OpenDialog
::
SeparateEntries
(
const
QString
&
entries
)
{
bool
b_quotes_mode
=
false
;
...
...
@@ -501,10 +511,3 @@ QStringList OpenDialog::SeparateEntries( const QString& entries )
return
entries_array
;
}
void
OpenDialog
::
browseInputSlave
()
{
OpenDialog
*
od
=
new
OpenDialog
(
this
,
p_intf
,
true
,
SELECT
);
od
->
exec
();
ui
.
slaveText
->
setText
(
od
->
getMRL
(
false
)
);
delete
od
;
}
modules/gui/qt4/dialogs/open.hpp
View file @
972e5e45
...
...
@@ -77,7 +77,7 @@ public slots:
void
selectSlots
();
void
play
();
void
stream
(
bool
b_transode_only
=
false
);
void
enqueue
();
void
enqueue
(
bool
b_enqueue
=
true
);
void
transcode
();
private:
...
...
@@ -105,8 +105,6 @@ private:
QPushButton
*
cancelButton
,
*
selectButton
;
QToolButton
*
playButton
;
void
finish
(
bool
);
private
slots
:
void
setMenuAction
();
void
cancel
();
...
...
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