Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fingerterm
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
fingerterm
Commits
f8573e52
Commit
f8573e52
authored
Aug 06, 2013
by
faenil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[port] WIP more work on QtQuick2 port + disables clipboard support
parent
24efd650
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
80 deletions
+117
-80
main.cpp
main.cpp
+0
-2
mainwindow.cpp
mainwindow.cpp
+0
-1
qml/Main.qml
qml/Main.qml
+37
-33
rpm/fingerterm.spec
rpm/fingerterm.spec
+1
-0
terminal.cpp
terminal.cpp
+56
-40
util.cpp
util.cpp
+23
-4
No files found.
main.cpp
View file @
f8573e52
...
...
@@ -159,8 +159,6 @@ int main(int argc, char *argv[])
view
.
showFullScreen
();
#else
QSize
screenSize
=
QGuiApplication
::
primaryScreen
()
->
size
();
view
.
rootObject
()
->
setWidth
(
screenSize
.
width
());
view
.
rootObject
()
->
setHeight
(
screenSize
.
height
());
if
((
screenSize
.
width
()
<
1024
||
screenSize
.
height
()
<
768
||
app
.
arguments
().
contains
(
"-fs"
))
&&
!
app
.
arguments
().
contains
(
"-nofs"
))
{
...
...
mainwindow.cpp
View file @
f8573e52
...
...
@@ -32,7 +32,6 @@
MainWindow
::
MainWindow
()
{
// setResizeMode(SizeRootObjectToView);
}
MainWindow
::~
MainWindow
()
...
...
qml/Main.qml
View file @
f8573e52
...
...
@@ -19,6 +19,7 @@
import
QtQuick
2.0
import
TextRender
1.0
import
QtQuick
.
Window
2.0
Rectangle
{
property
string
fgcolor
:
"
black
"
...
...
@@ -30,6 +31,9 @@ Rectangle {
property
string
windowTitle
:
util
.
currentWindowTitle
();
width
:
Screen
.
width
height
:
Screen
.
height
id
:
window
objectName
:
"
window
"
color
:
bgcolor
...
...
@@ -77,39 +81,6 @@ Rectangle {
z
:
1000
}
TextRender
{
id
:
textrender
objectName
:
"
textrender
"
x
:
0
y
:
0
height
:
parent
.
height
width
:
parent
.
width
myWidth
:
width
myHeight
:
height
opacity
:
1.0
property
int
duration
:
0
;
property
int
cutAfter
:
height
Behavior
on
opacity
{
NumberAnimation
{
duration
:
textrender
.
duration
;
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
y
{
NumberAnimation
{
duration
:
textrender
.
duration
;
easing.type
:
Easing
.
InOutQuad
}
}
onFontSizeChanged
:
{
lineView
.
fontPointSize
=
textrender
.
fontPointSize
;
}
onCutAfterChanged
:
{
// this property is used in the paint function, so make sure that the element gets
// painted with the updated value (might not otherwise happen because of caching)
textrender
.
redraw
();
}
z
:
10
}
Lineview
{
id
:
lineView
...
...
@@ -189,6 +160,39 @@ Rectangle {
vkbKeypress
(
event
.
key
,
event
.
modifiers
);
}
TextRender
{
id
:
textrender
objectName
:
"
textrender
"
x
:
0
y
:
0
height
:
parent
.
height
width
:
parent
.
width
myWidth
:
width
myHeight
:
height
opacity
:
1.0
property
int
duration
:
0
;
property
int
cutAfter
:
height
Behavior
on
opacity
{
NumberAnimation
{
duration
:
textrender
.
duration
;
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
y
{
NumberAnimation
{
duration
:
textrender
.
duration
;
easing.type
:
Easing
.
InOutQuad
}
}
onFontSizeChanged
:
{
lineView
.
fontPointSize
=
textrender
.
fontPointSize
;
}
onCutAfterChanged
:
{
// this property is used in the paint function, so make sure that the element gets
// painted with the updated value (might not otherwise happen because of caching)
textrender
.
redraw
();
}
z
:
10
}
Timer
{
id
:
fadeTimer
running
:
false
...
...
rpm/fingerterm.spec
View file @
f8573e52
...
...
@@ -12,6 +12,7 @@ BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
Requires: qt5-qtdeclarative-import-xmllistmodel
Requires: qt5-qtdeclarative-import-window2
Obsoletes: meego-terminal <= 0.2.2
Provides: meego-terminal > 0.2.2
...
...
terminal.cpp
View file @
f8573e52
...
...
@@ -19,6 +19,7 @@
#include <QGuiApplication>
#include <QClipboard>
#include <QDebug>
#include "terminal.h"
#include "ptyiface.h"
...
...
@@ -1143,10 +1144,18 @@ void Terminal::resetTabs()
void
Terminal
::
pasteFromClipboard
()
{
QClipboard
*
cb
=
QGuiApplication
::
clipboard
();
if
(
cb
->
mimeData
()
->
hasText
()
&&
!
cb
->
mimeData
()
->
text
().
isEmpty
())
{
if
(
iPtyIFace
)
{
resetBackBufferScrollPos
();
iPtyIFace
->
writeTerm
(
cb
->
mimeData
()
->
text
());
//mimeData() could be null when the clipboard QPA plugin of the platform doesn't support QClipboard::Clipboard, or
//the plugin is bugged.
//In those cases, disable clipboard features.
if
(
!
cb
->
mimeData
())
qDebug
()
<<
"FIXME: QClipboard::mimeData() returned NULL, the clipboard functionality will not be used"
;
else
{
if
(
cb
->
mimeData
()
->
hasText
()
&&
!
cb
->
mimeData
()
->
text
().
isEmpty
())
{
if
(
iPtyIFace
)
{
resetBackBufferScrollPos
();
iPtyIFace
->
writeTerm
(
cb
->
mimeData
()
->
text
());
}
}
}
}
...
...
@@ -1275,58 +1284,65 @@ void Terminal::copySelectionToClipboard()
if
(
selection
().
isNull
())
return
;
//mimeData() could be null when the clipboard QPA plugin of the platform doesn't support QClipboard::Clipboard, or
//the plugin is bugged.
//In those cases, disable clipboard features.
QClipboard
*
cb
=
QGuiApplication
::
clipboard
();
cb
->
clear
();
QString
text
;
QString
line
;
// backbuffer
if
(
iBackBufferScrollPos
>
0
&&
!
iUseAltScreenBuffer
)
{
int
lineFrom
=
iBackBuffer
.
size
()
-
iBackBufferScrollPos
+
selection
().
top
()
-
1
;
int
lineTo
=
iBackBuffer
.
size
()
-
iBackBufferScrollPos
+
selection
().
bottom
()
-
1
;
if
(
!
cb
->
mimeData
())
qDebug
()
<<
"FIXME: QClipboard::mimeData() returned NULL, the clipboard functionality will not be used"
;
else
{
cb
->
clear
();
QString
text
;
QString
line
;
// backbuffer
if
(
iBackBufferScrollPos
>
0
&&
!
iUseAltScreenBuffer
)
{
int
lineFrom
=
iBackBuffer
.
size
()
-
iBackBufferScrollPos
+
selection
().
top
()
-
1
;
int
lineTo
=
iBackBuffer
.
size
()
-
iBackBufferScrollPos
+
selection
().
bottom
()
-
1
;
for
(
int
i
=
lineFrom
;
i
<=
lineTo
;
i
++
)
{
if
(
i
>=
0
&&
i
<
iBackBuffer
.
size
())
{
line
.
clear
();
int
start
=
0
;
int
end
=
iBackBuffer
[
i
].
size
()
-
1
;
if
(
i
==
lineFrom
)
start
=
selection
().
left
()
-
1
;
if
(
i
==
lineTo
)
end
=
selection
().
right
()
-
1
;
for
(
int
j
=
start
;
j
<=
end
;
j
++
)
{
if
(
j
>=
0
&&
j
<
iBackBuffer
[
i
].
size
()
&&
iBackBuffer
[
i
][
j
].
c
.
isPrint
())
line
+=
iBackBuffer
[
i
][
j
].
c
;
}
text
+=
line
.
trimmed
()
+
"
\n
"
;
}
}
}
// main buffer
int
lineFrom
=
selection
().
top
()
-
1
-
iBackBufferScrollPos
;
int
lineTo
=
selection
().
bottom
()
-
1
-
iBackBufferScrollPos
;
for
(
int
i
=
lineFrom
;
i
<=
lineTo
;
i
++
)
{
if
(
i
>=
0
&&
i
<
iBackBuffer
.
size
())
{
if
(
i
>=
0
&&
i
<
buffer
()
.
size
())
{
line
.
clear
();
int
start
=
0
;
int
end
=
iBackBuffer
[
i
].
size
()
-
1
;
int
end
=
buffer
()
[
i
].
size
()
-
1
;
if
(
i
==
lineFrom
)
start
=
selection
().
left
()
-
1
;
if
(
i
==
lineTo
)
end
=
selection
().
right
()
-
1
;
for
(
int
j
=
start
;
j
<=
end
;
j
++
)
{
if
(
j
>=
0
&&
j
<
iBackBuffer
[
i
].
size
()
&&
iBackBuffer
[
i
][
j
].
c
.
isPrint
())
line
+=
iBackBuffer
[
i
][
j
].
c
;
if
(
j
>=
0
&&
j
<
buffer
()[
i
].
size
()
&&
buffer
()
[
i
][
j
].
c
.
isPrint
())
line
+=
buffer
()
[
i
][
j
].
c
;
}
text
+=
line
.
trimmed
()
+
"
\n
"
;
}
}
}
// main buffer
int
lineFrom
=
selection
().
top
()
-
1
-
iBackBufferScrollPos
;
int
lineTo
=
selection
().
bottom
()
-
1
-
iBackBufferScrollPos
;
for
(
int
i
=
lineFrom
;
i
<=
lineTo
;
i
++
)
{
if
(
i
>=
0
&&
i
<
buffer
().
size
())
{
line
.
clear
();
int
start
=
0
;
int
end
=
buffer
()[
i
].
size
()
-
1
;
if
(
i
==
lineFrom
)
start
=
selection
().
left
()
-
1
;
if
(
i
==
lineTo
)
end
=
selection
().
right
()
-
1
;
for
(
int
j
=
start
;
j
<=
end
;
j
++
)
{
if
(
j
>=
0
&&
j
<
buffer
()[
i
].
size
()
&&
buffer
()[
i
][
j
].
c
.
isPrint
())
line
+=
buffer
()[
i
][
j
].
c
;
}
text
+=
line
.
trimmed
()
+
"
\n
"
;
}
}
//qDebug() << text.trimmed();
//qDebug() << text.trimmed();
cb
->
setText
(
text
.
trimmed
());
cb
->
setText
(
text
.
trimmed
());
}
}
void
Terminal
::
adjustSelectionPosition
(
int
lines
)
...
...
util.cpp
View file @
f8573e52
...
...
@@ -24,6 +24,7 @@
#include <QDBusInterface>
#include <QGuiApplication>
#include <QQuickView>
#include <QDebug>
#include "mainwindow.h"
#include "terminal.h"
...
...
@@ -373,8 +374,15 @@ void Util::notifyText(QString text)
void
Util
::
copyTextToClipboard
(
QString
str
)
{
QClipboard
*
cb
=
QGuiApplication
::
clipboard
();
cb
->
clear
();
cb
->
setText
(
str
);
//mimeData() could be null when the clipboard QPA plugin of the platform doesn't support QClipboard::Clipboard, or
//the plugin is bugged.
//In those cases, disable clipboard features.
if
(
!
cb
->
mimeData
())
qDebug
()
<<
"FIXME: QClipboard::mimeData() returned NULL, the clipboard functionality will not be used"
;
else
{
cb
->
clear
();
cb
->
setText
(
str
);
}
}
bool
Util
::
terminalHasSelection
()
...
...
@@ -384,9 +392,20 @@ bool Util::terminalHasSelection()
bool
Util
::
canPaste
()
{
QClipboard
*
cb
=
QGuiApplication
::
clipboard
();
if
(
cb
->
mimeData
()
->
hasText
()
&&
!
cb
->
mimeData
()
->
text
().
isEmpty
())
return
true
;
//mimeData() could be null when the clipboard QPA plugin of the platform doesn't support QClipboard::Clipboard, or
//the plugin is bugged.
//In those cases, disable clipboard features.
if
(
!
cb
->
mimeData
())
{
qDebug
()
<<
"FIXME: QClipboard::mimeData() returned NULL, the clipboard functionality will not be used"
;
return
false
;
}
else
{
if
(
cb
->
mimeData
()
->
hasText
()
&&
!
cb
->
mimeData
()
->
text
().
isEmpty
())
return
true
;
}
return
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