Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b505449c
Commit
b505449c
authored
Feb 08, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: messages cleanup and work around #2432 to solve the speed issues.
Patches partly by random.
parent
58902dc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
58 deletions
+47
-58
modules/gui/qt4/dialogs/messages.cpp
modules/gui/qt4/dialogs/messages.cpp
+46
-57
modules/gui/qt4/dialogs/messages.hpp
modules/gui/qt4/dialogs/messages.hpp
+1
-1
No files found.
modules/gui/qt4/dialogs/messages.cpp
View file @
b505449c
...
...
@@ -88,6 +88,7 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
messages
->
setReadOnly
(
true
);
messages
->
setGeometry
(
0
,
0
,
440
,
600
);
messages
->
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
messages
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
);
msgLayout
->
addWidget
(
messages
,
0
,
0
,
1
,
0
);
mainTab
->
addTab
(
msgWidget
,
qtr
(
"Messages"
)
);
...
...
@@ -171,19 +172,21 @@ void MessagesDialog::updateTab( int index )
}
}
void
MessagesDialog
::
sinkMessage
(
msg_item_t
*
item
,
unsigned
)
void
MessagesDialog
::
sinkMessage
(
msg_item_t
*
item
)
{
if
((
item
->
i_type
==
VLC_MSG_WARN
&&
verbosityBox
->
value
()
<
1
)
||
(
item
->
i_type
==
VLC_MSG_DBG
&&
verbosityBox
->
value
()
<
2
))
return
;
// Saving cursor selection
int
startPos
=
messages
->
textCursor
().
selectionStart
();
int
endPos
=
messages
->
textCursor
().
selectionEnd
();
/* Copy selected text to the clipboard */
if
(
messages
->
textCursor
().
hasSelection
()
)
messages
->
copy
();
/* Fix selected text bug */
if
(
!
messages
->
textCursor
().
atEnd
()
||
messages
->
textCursor
().
anchor
()
!=
messages
->
textCursor
().
position
()
)
messages
->
moveCursor
(
QTextCursor
::
End
);
messages
->
moveCursor
(
QTextCursor
::
End
);
if
(
startPos
==
endPos
&&
messages
->
textCursor
().
selectionEnd
()
==
endPos
)
endPos
=
0
;
messages
->
setFontItalic
(
true
);
messages
->
setTextColor
(
"darkBlue"
);
messages
->
insertPlainText
(
qfu
(
item
->
psz_module
)
);
...
...
@@ -214,54 +217,14 @@ void MessagesDialog::sinkMessage (msg_item_t *item, unsigned)
messages
->
setTextColor
(
"black"
);
messages
->
insertPlainText
(
qfu
(
item
->
psz_msg
)
);
messages
->
insertPlainText
(
"
\n
"
);
messages
->
ensureCursorVisible
();
// Restoring saved cursor selection
// If the cursor was at this end, put it at the end,
// so we don't need to scroll down.
if
(
endPos
==
0
)
messages
->
moveCursor
(
QTextCursor
::
End
);
else
{
QTextCursor
cur
=
messages
->
textCursor
();
cur
.
movePosition
(
QTextCursor
::
Start
);
cur
.
movePosition
(
QTextCursor
::
NextCharacter
,
QTextCursor
::
MoveAnchor
,
startPos
);
cur
.
movePosition
(
QTextCursor
::
NextCharacter
,
QTextCursor
::
KeepAnchor
,
endPos
-
startPos
);
messages
->
setTextCursor
(
cur
);
}
}
void
MessagesDialog
::
customEvent
(
QEvent
*
event
)
{
MsgEvent
*
msg
=
dynamic_cast
<
MsgEvent
*>
(
event
);
MsgEvent
*
msg
e
=
static_cast
<
MsgEvent
*>
(
event
);
assert
(
msg
);
sinkMessage
(
msg
->
msg
,
0
);
}
void
MessagesDialog
::
buildTree
(
QTreeWidgetItem
*
parentItem
,
vlc_object_t
*
p_obj
)
{
QTreeWidgetItem
*
item
;
if
(
parentItem
)
item
=
new
QTreeWidgetItem
(
parentItem
);
else
item
=
new
QTreeWidgetItem
(
modulesTree
);
if
(
p_obj
->
psz_object_name
)
item
->
setText
(
0
,
qfu
(
p_obj
->
psz_object_type
)
+
"
\"
"
+
qfu
(
p_obj
->
psz_object_name
)
+
"
\"
("
+
QString
::
number
((
uintptr_t
)
p_obj
)
+
")"
);
else
item
->
setText
(
0
,
qfu
(
p_obj
->
psz_object_type
)
+
" ("
+
QString
::
number
((
uintptr_t
)
p_obj
)
+
")"
);
item
->
setExpanded
(
true
);
vlc_list_t
*
l
=
vlc_list_children
(
p_obj
);
for
(
int
i
=
0
;
i
<
l
->
i_count
;
i
++
)
buildTree
(
item
,
l
->
p_values
[
i
].
p_object
);
vlc_list_release
(
l
);
assert
(
msge
);
sinkMessage
(
msge
->
msg
);
}
void
MessagesDialog
::
clearOrUpdate
()
...
...
@@ -272,12 +235,6 @@ void MessagesDialog::clearOrUpdate()
clear
();
}
void
MessagesDialog
::
updateTree
()
{
modulesTree
->
clear
();
buildTree
(
NULL
,
VLC_OBJECT
(
p_intf
->
p_libvlc
)
);
}
void
MessagesDialog
::
clear
()
{
messages
->
clear
();
...
...
@@ -309,6 +266,38 @@ bool MessagesDialog::save()
return
false
;
}
void
MessagesDialog
::
buildTree
(
QTreeWidgetItem
*
parentItem
,
vlc_object_t
*
p_obj
)
{
QTreeWidgetItem
*
item
;
if
(
parentItem
)
item
=
new
QTreeWidgetItem
(
parentItem
);
else
item
=
new
QTreeWidgetItem
(
modulesTree
);
if
(
p_obj
->
psz_object_name
)
item
->
setText
(
0
,
qfu
(
p_obj
->
psz_object_type
)
+
"
\"
"
+
qfu
(
p_obj
->
psz_object_name
)
+
"
\"
("
+
QString
::
number
((
uintptr_t
)
p_obj
)
+
")"
);
else
item
->
setText
(
0
,
qfu
(
p_obj
->
psz_object_type
)
+
" ("
+
QString
::
number
((
uintptr_t
)
p_obj
)
+
")"
);
item
->
setExpanded
(
true
);
vlc_list_t
*
l
=
vlc_list_children
(
p_obj
);
for
(
int
i
=
0
;
i
<
l
->
i_count
;
i
++
)
buildTree
(
item
,
l
->
p_values
[
i
].
p_object
);
vlc_list_release
(
l
);
}
void
MessagesDialog
::
updateTree
()
{
modulesTree
->
clear
();
buildTree
(
NULL
,
VLC_OBJECT
(
p_intf
->
p_libvlc
)
);
}
static
void
MsgCallback
(
msg_cb_data_t
*
data
,
msg_item_t
*
item
,
unsigned
)
{
int
canc
=
vlc_savecancel
();
...
...
modules/gui/qt4/dialogs/messages.hpp
View file @
b505449c
...
...
@@ -67,7 +67,7 @@ private:
msg_cb_data_t
*
cbData
;
static
void
sinkMessage
(
msg_cb_data_t
*
,
msg_item_t
*
,
unsigned
);
void
customEvent
(
QEvent
*
);
void
sinkMessage
(
msg_item_t
*
item
,
unsigned
);
void
sinkMessage
(
msg_item_t
*
item
);
private
slots
:
void
updateTab
(
int
);
...
...
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