Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
9d4d1600
Commit
9d4d1600
authored
Jan 10, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4 - Bookmark implementation by Antoine Lejeune - phytos # via
parent
fd4a7f8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
280 additions
and
5 deletions
+280
-5
modules/gui/qt4/Modules.am
modules/gui/qt4/Modules.am
+3
-0
modules/gui/qt4/dialogs/bookmarks.cpp
modules/gui/qt4/dialogs/bookmarks.cpp
+212
-0
modules/gui/qt4/dialogs/bookmarks.hpp
modules/gui/qt4/dialogs/bookmarks.hpp
+60
-0
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+2
-2
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+3
-3
No files found.
modules/gui/qt4/Modules.am
View file @
9d4d1600
...
@@ -19,6 +19,7 @@ nodist_SOURCES_qt4 = \
...
@@ -19,6 +19,7 @@ nodist_SOURCES_qt4 = \
input_manager.moc.cpp \
input_manager.moc.cpp \
playlist_model.moc.cpp \
playlist_model.moc.cpp \
dialogs/playlist.moc.cpp \
dialogs/playlist.moc.cpp \
dialogs/bookmarks.moc.cpp \
dialogs/mediainfo.moc.cpp \
dialogs/mediainfo.moc.cpp \
dialogs/extended.moc.cpp \
dialogs/extended.moc.cpp \
dialogs/messages.moc.cpp \
dialogs/messages.moc.cpp \
...
@@ -87,6 +88,7 @@ SOURCES_qt4 = qt4.cpp \
...
@@ -87,6 +88,7 @@ SOURCES_qt4 = qt4.cpp \
input_manager.cpp \
input_manager.cpp \
playlist_model.cpp \
playlist_model.cpp \
dialogs/playlist.cpp \
dialogs/playlist.cpp \
dialogs/bookmarks.cpp \
dialogs/preferences.cpp \
dialogs/preferences.cpp \
dialogs/mediainfo.cpp \
dialogs/mediainfo.cpp \
dialogs/extended.cpp \
dialogs/extended.cpp \
...
@@ -120,6 +122,7 @@ noinst_HEADERS = \
...
@@ -120,6 +122,7 @@ noinst_HEADERS = \
input_manager.hpp \
input_manager.hpp \
playlist_model.hpp \
playlist_model.hpp \
dialogs/playlist.hpp \
dialogs/playlist.hpp \
dialogs/bookmarks.hpp \
dialogs/mediainfo.hpp \
dialogs/mediainfo.hpp \
dialogs/extended.hpp \
dialogs/extended.hpp \
dialogs/messages.hpp \
dialogs/messages.hpp \
...
...
modules/gui/qt4/dialogs/bookmarks.cpp
0 → 100644
View file @
9d4d1600
/*****************************************************************************
* bookmarks.cpp : Bookmarks
****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Antoine Lejeune <phytos@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "dialogs/bookmarks.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
#include <QGridLayout>
#include <QSpacerItem>
#include <QPushButton>
BookmarksDialog
*
BookmarksDialog
::
instance
=
NULL
;
BookmarksDialog
::
BookmarksDialog
(
intf_thread_t
*
_p_intf
)
:
QVLCFrame
(
_p_intf
)
{
setWindowFlags
(
Qt
::
Tool
);
setWindowOpacity
(
config_GetFloat
(
p_intf
,
"qt-opacity"
)
);
setWindowTitle
(
qtr
(
"Edit bookmark"
)
);
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
QPushButton
*
addButton
=
new
QPushButton
(
qtr
(
"Add"
)
);
QPushButton
*
delButton
=
new
QPushButton
(
qtr
(
"Delete"
)
);
QPushButton
*
clearButton
=
new
QPushButton
(
qtr
(
"Clear"
)
);
QPushButton
*
extractButton
=
new
QPushButton
(
qtr
(
"Extract"
)
);
bookmarksList
=
new
QTreeWidget
(
this
);
bookmarksList
->
setRootIsDecorated
(
false
);
bookmarksList
->
setAlternatingRowColors
(
true
);
bookmarksList
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
bookmarksList
->
setSelectionBehavior
(
QAbstractItemView
::
SelectRows
);
bookmarksList
->
setEditTriggers
(
QAbstractItemView
::
SelectedClicked
);
bookmarksList
->
setColumnCount
(
3
);
QStringList
headerLabels
;
headerLabels
<<
qtr
(
"Description"
);
headerLabels
<<
qtr
(
"Bytes"
);
headerLabels
<<
qtr
(
"Time"
);
bookmarksList
->
setHeaderLabels
(
headerLabels
);
layout
->
addWidget
(
addButton
,
0
,
0
);
layout
->
addWidget
(
delButton
,
1
,
0
);
layout
->
addWidget
(
clearButton
,
2
,
0
);
layout
->
addItem
(
new
QSpacerItem
(
20
,
20
,
QSizePolicy
::
Expanding
),
4
,
0
);
layout
->
addWidget
(
extractButton
,
5
,
0
);
layout
->
addWidget
(
bookmarksList
,
0
,
1
,
6
,
1
);
layout
->
setColumnStretch
(
1
,
1
);
CONNECT
(
bookmarksList
,
activated
(
QModelIndex
),
this
,
activateItem
(
QModelIndex
)
);
CONNECT
(
bookmarksList
,
itemChanged
(
QTreeWidgetItem
*
,
int
),
this
,
edit
(
QTreeWidgetItem
*
,
int
)
);
BUTTONACT
(
addButton
,
add
()
);
BUTTONACT
(
delButton
,
del
()
);
BUTTONACT
(
clearButton
,
clear
()
);
BUTTONACT
(
extractButton
,
extract
()
);
}
BookmarksDialog
::~
BookmarksDialog
()
{
}
void
BookmarksDialog
::
update
()
{
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
seekpoint_t
**
pp_bookmarks
;
int
i_bookmarks
;
if
(
bookmarksList
->
topLevelItemCount
()
>
0
)
{
bookmarksList
->
model
()
->
removeRows
(
0
,
bookmarksList
->
topLevelItemCount
()
);
}
if
(
input_Control
(
p_input
,
INPUT_GET_BOOKMARKS
,
&
pp_bookmarks
,
&
i_bookmarks
)
!=
VLC_SUCCESS
)
return
;
for
(
int
i
=
0
;
i
<
i_bookmarks
;
i
++
)
{
// List with the differents elements of the row
QStringList
row
;
row
<<
QString
(
pp_bookmarks
[
i
]
->
psz_name
);
row
<<
QString
(
"%1"
).
arg
(
pp_bookmarks
[
i
]
->
i_byte_offset
);
row
<<
QString
(
"%1"
).
arg
(
pp_bookmarks
[
i
]
->
i_time_offset
/
1000000
);
QTreeWidgetItem
*
item
=
new
QTreeWidgetItem
(
bookmarksList
,
row
);
item
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEditable
|
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsEnabled
);
bookmarksList
->
insertTopLevelItem
(
i
,
item
);
}
}
void
BookmarksDialog
::
add
()
{
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
seekpoint_t
bookmark
;
vlc_value_t
pos
;
bookmark
.
psz_name
=
NULL
;
bookmark
.
i_byte_offset
=
0
;
bookmark
.
i_time_offset
=
0
;
input_Control
(
p_input
,
INPUT_GET_BYTE_POSITION
,
&
bookmark
.
i_byte_offset
);
var_Get
(
p_input
,
"time"
,
&
pos
);
bookmark
.
i_time_offset
=
pos
.
i_time
;
input_Control
(
p_input
,
INPUT_ADD_BOOKMARK
,
&
bookmark
);
update
();
}
void
BookmarksDialog
::
del
()
{
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
int
i_focused
=
bookmarksList
->
currentIndex
().
row
();
if
(
i_focused
>=
0
)
{
input_Control
(
p_input
,
INPUT_DEL_BOOKMARK
,
i_focused
);
}
update
();
}
void
BookmarksDialog
::
clear
()
{
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
input_Control
(
p_input
,
INPUT_CLEAR_BOOKMARKS
);
update
();
}
void
BookmarksDialog
::
edit
(
QTreeWidgetItem
*
item
,
int
column
)
{
// We can only edit a item if it is the last item selected
if
(
bookmarksList
->
selectedItems
().
isEmpty
()
||
bookmarksList
->
selectedItems
().
last
()
!=
item
)
return
;
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
// We get the row number of the item
int
i_edit
=
bookmarksList
->
indexOfTopLevelItem
(
item
);
// We get the bookmarks list
seekpoint_t
**
pp_bookmarks
;
int
i_bookmarks
;
if
(
input_Control
(
p_input
,
INPUT_GET_BOOKMARKS
,
&
pp_bookmarks
,
&
i_bookmarks
)
!=
VLC_SUCCESS
)
return
;
if
(
i_edit
>=
i_bookmarks
)
return
;
// We modify the seekpoint
seekpoint_t
*
p_seekpoint
=
pp_bookmarks
[
i_edit
];
if
(
column
==
0
)
p_seekpoint
->
psz_name
=
strdup
(
qtu
(
item
->
text
(
column
)
)
);
else
if
(
column
==
1
)
p_seekpoint
->
i_byte_offset
=
atoi
(
qtu
(
item
->
text
(
column
)
)
);
else
if
(
column
==
2
)
p_seekpoint
->
i_time_offset
=
1000000
*
atoll
(
qtu
(
item
->
text
(
column
)
)
);
if
(
input_Control
(
p_input
,
INPUT_CHANGE_BOOKMARK
,
p_seekpoint
,
i_edit
)
!=
VLC_SUCCESS
)
return
;
update
();
}
void
BookmarksDialog
::
extract
()
{
// TODO
}
void
BookmarksDialog
::
activateItem
(
QModelIndex
index
)
{
input_thread_t
*
p_input
=
THEMIM
->
getInput
();
if
(
!
p_input
)
return
;
input_Control
(
p_input
,
INPUT_SET_BOOKMARK
,
index
.
row
()
);
}
modules/gui/qt4/dialogs/bookmarks.hpp
0 → 100644
View file @
9d4d1600
/*****************************************************************************
* bookmarks.hpp : bookmarks
****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: extended.hpp 23338 2007-11-26 08:10:01Z jb $
*
* Authors: Antoine Lejeune <phytos@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _BOOKMARKS_H_
#define _BOOKMARKS_H
#include "util/qvlcframe.hpp"
#include <QStandardItemModel>
#include <QTreeView>
#include <QTreeWidget>
class
BookmarksDialog
:
public
QVLCFrame
{
Q_OBJECT
;
public:
static
BookmarksDialog
*
getInstance
(
intf_thread_t
*
p_intf
)
{
if
(
!
instance
)
instance
=
new
BookmarksDialog
(
p_intf
);
return
instance
;
}
virtual
~
BookmarksDialog
();
static
bool
exists
()
{
return
(
instance
!=
NULL
)
;
}
private:
BookmarksDialog
(
intf_thread_t
*
);
static
BookmarksDialog
*
instance
;
void
update
();
QTreeWidget
*
bookmarksList
;
private
slots
:
void
add
();
void
del
();
void
clear
();
void
edit
(
QTreeWidgetItem
*
item
,
int
column
);
void
extract
();
void
activateItem
(
QModelIndex
index
);
};
#endif
modules/gui/qt4/dialogs_provider.cpp
View file @
9d4d1600
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
/* The dialogs */
/* The dialogs */
#include "dialogs/playlist.hpp"
#include "dialogs/playlist.hpp"
#include "dialogs/bookmarks.hpp"
#include "dialogs/preferences.hpp"
#include "dialogs/preferences.hpp"
#include "dialogs/mediainfo.hpp"
#include "dialogs/mediainfo.hpp"
#include "dialogs/messages.hpp"
#include "dialogs/messages.hpp"
...
@@ -202,8 +203,7 @@ void DialogsProvider::mediaCodecDialog()
...
@@ -202,8 +203,7 @@ void DialogsProvider::mediaCodecDialog()
void
DialogsProvider
::
bookmarksDialog
()
void
DialogsProvider
::
bookmarksDialog
()
{
{
/* TODO - Implement me */
BookmarksDialog
::
getInstance
(
p_intf
)
->
toggleVisible
();
/* BookmarkDialog::getInstance( p_intf )->toggleVisible(); */
}
}
void
DialogsProvider
::
podcastConfigureDialog
()
void
DialogsProvider
::
podcastConfigureDialog
()
...
...
modules/gui/qt4/menus.cpp
View file @
9d4d1600
...
@@ -298,9 +298,9 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
...
@@ -298,9 +298,9 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_CODECINFO
)
,
""
,
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_CODECINFO
)
,
""
,
":/pixmaps/menus_info_16px.png"
,
SLOT
(
mediaCodecDialog
()
),
"Ctrl+J"
);
":/pixmaps/menus_info_16px.png"
,
SLOT
(
mediaCodecDialog
()
),
"Ctrl+J"
);
#if 0 /* Not Implemented yet */
addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","",
"bookmarksDialog()", "Ctrl+B" );
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_BOOKMARK
),
""
,
""
,
#endif
SLOT
(
bookmarksDialog
()
),
"Ctrl+B"
);
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_VLM
),
""
,
""
,
SLOT
(
vlmDialog
()
),
addDPStaticEntry
(
menu
,
qtr
(
I_MENU_VLM
),
""
,
""
,
SLOT
(
vlmDialog
()
),
"Ctrl+V"
);
"Ctrl+V"
);
...
...
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