Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KMuddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
Games
KMuddy
Commits
880808f5
Commit
880808f5
authored
Nov 17, 2018
by
Tomas Mecir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
various fixes, mostly with transcript and layouting
parent
42af2e50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
kmuddy/ctranscript.cpp
kmuddy/ctranscript.cpp
+9
-8
kmuddy/dialogs/dlgeditprofile.cpp
kmuddy/dialogs/dlgeditprofile.cpp
+3
-3
libs/cconsole.cpp
libs/cconsole.cpp
+15
-4
libs/ctextchunk.cpp
libs/ctextchunk.cpp
+1
-1
No files found.
kmuddy/ctranscript.cpp
View file @
880808f5
...
...
@@ -112,11 +112,10 @@ void cTranscript::addLineToTranscript (cTextChunk *chunk)
cANSIParser
*
ap
=
dynamic_cast
<
cANSIParser
*>
(
object
(
"ansiparser"
));
QString
s
;
switch
(
type
)
{
case
TRANSCRIPT_PLAIN
:
s
=
chunk
->
toText
();
break
;
case
TRANSCRIPT_ANSI
:
s
=
chunk
->
toAnsi
(
ap
);
break
;
case
TRANSCRIPT_PLAIN
:
s
=
chunk
->
toText
()
+
"
\n
"
;
break
;
case
TRANSCRIPT_ANSI
:
s
=
chunk
->
toAnsi
(
ap
)
+
"
\n
"
;
break
;
case
TRANSCRIPT_HTML
:
s
=
chunk
->
toHTML
();
break
;
};
s
+=
"
\n
"
;
// we use <pre> in HTML, so this applies equally to all three
file
.
write
(
s
.
toLocal8Bit
());
file
.
flush
();
}
...
...
@@ -137,11 +136,10 @@ void cTranscript::addLineToAdvTranscript (cTextChunk *chunk)
cANSIParser
*
ap
=
dynamic_cast
<
cANSIParser
*>
(
object
(
"ansiparser"
));
QString
s
;
switch
(
advtype
)
{
case
TRANSCRIPT_PLAIN
:
s
=
chunk
->
toText
();
break
;
case
TRANSCRIPT_ANSI
:
s
=
chunk
->
toAnsi
(
ap
);
break
;
case
TRANSCRIPT_PLAIN
:
s
=
chunk
->
toText
()
+
"
\n
"
;
break
;
case
TRANSCRIPT_ANSI
:
s
=
chunk
->
toAnsi
(
ap
)
+
"
\n
"
;
break
;
case
TRANSCRIPT_HTML
:
s
=
chunk
->
toHTML
();
break
;
};
s
+=
"
\n
"
;
// we use <pre> in HTML, so this applies equally to all three
advfile
.
write
(
s
.
toLocal8Bit
());
advfile
.
flush
();
...
...
@@ -268,10 +266,13 @@ void cTranscript::startTranscript ()
file
.
write
(
"
\n\n
"
);
if
(
type
==
TRANSCRIPT_HTML
)
{
cProfileSettings
*
sett
=
settings
();
//TODO: what if we're adding to an existing HTML transcript?
file
.
write
(
"<html>
\n
"
);
file
.
write
(
"<html>
<head>
\n
"
);
file
.
write
(
"<meta name=
\"
Generator
\"
content=
\"
KMuddy
\"
>
\n
"
);
file
.
write
(
"<body bgcolor="
);
file
.
write
((
"<meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html; charset="
+
sett
->
getString
(
"encoding"
)
+
"
\"
>"
).
toLatin1
());
file
.
write
(
"<style> p { margin: 0px; padding: 2px; } </style>"
);
file
.
write
(
"</head><body bgcolor="
);
file
.
write
(
output
->
defaultBkColor
().
name
().
toLatin1
());
file
.
write
(
">
\n
"
);
}
...
...
kmuddy/dialogs/dlgeditprofile.cpp
View file @
880808f5
...
...
@@ -44,8 +44,8 @@ dlgEditProfile::dlgEditProfile(QWidget *parent) : QDialog (parent)
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
// create the button that opens the MUD listing
QPushButton
*
btlist
=
new
QPushButton
(
i18n
(
"&Select from MUD list"
),
this
);
connect
(
btlist
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
openMudList
()));
//
QPushButton *btlist = new QPushButton (i18n ("&Select from MUD list"), this);
//
connect (btlist, SIGNAL (clicked()), this, SLOT (openMudList()));
// put some edit boxes there
QLabel
*
l1
=
new
QLabel
(
i18n
(
"Profile &name:"
),
this
);
...
...
@@ -90,7 +90,7 @@ dlgEditProfile::dlgEditProfile(QWidget *parent) : QDialog (parent)
l6
->
setBuddy
(
connstr
);
layout
->
setSpacing
(
10
);
layout
->
addWidget
(
btlist
,
0
,
0
);
//
layout->addWidget (btlist, 0, 0);
layout
->
addWidget
(
l1
,
1
,
0
);
layout
->
addWidget
(
l2
,
2
,
0
);
layout
->
addWidget
(
l3
,
3
,
0
);
...
...
libs/cconsole.cpp
View file @
880808f5
...
...
@@ -29,8 +29,10 @@
#include <QGraphicsTextItem>
#include <QScrollBar>
#include <QTextBlock>
#include <QTextBlockFormat>
#include <QTextCursor>
#include <QTextDocument>
#include <QDebug>
#include <KActionCollection>
...
...
@@ -116,7 +118,7 @@ class cConsole::Private {
QColor
bgcolor
;
QFont
font
;
int
sess
;
int
charWidth
,
charHeight
;
double
charWidth
,
charHeight
;
bool
wantNewLine
;
bool
atBottom
;
...
...
@@ -142,7 +144,7 @@ cConsole::cConsole(QWidget *parent) : QGraphicsView(parent) {
connect
(
verticalScrollBar
(),
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
sliderChanged
(
int
)));
d
->
text
=
new
QTextDocument
;
QString
stylesheet
=
"* { color: "
+
QColor
(
Qt
::
lightGray
).
name
()
+
"; white-space: pre-wrap; } a { color: "
+
QColor
(
Qt
::
blue
).
name
()
+
"
:
} "
;
QString
stylesheet
=
"* { color: "
+
QColor
(
Qt
::
lightGray
).
name
()
+
"; white-space: pre-wrap; } a { color: "
+
QColor
(
Qt
::
blue
).
name
()
+
"
; } p,div { padding: 1px; line-spacing: 1.3
} "
;
d
->
text
->
setDefaultStyleSheet
(
stylesheet
);
QTextOption
opt
;
opt
.
setWrapMode
(
QTextOption
::
WrapAtWordBoundaryOrAnywhere
);
...
...
@@ -232,7 +234,7 @@ void cConsole::setFont (QFont f) {
QFontMetrics
fm
(
f
);
d
->
charWidth
=
fm
.
width
(
"m"
);
d
->
charHeight
=
fm
.
lineSpacing
();
d
->
charHeight
=
fm
.
lineSpacing
()
+
2
;
fixupOutput
();
}
...
...
@@ -311,7 +313,13 @@ void cConsole::forceEmitSize () {
}
void
cConsole
::
dumpBuffer
(
bool
fromcurrent
,
QFile
&
file
,
char
dumpType
)
{
// TODO
QString
contents
;
// TODO: support 'fromcurrent'
if
((
dumpType
==
TRANSCRIPT_PLAIN
)
||
(
dumpType
==
TRANSCRIPT_ANSI
))
contents
=
d
->
text
->
toPlainText
();
else
if
(
dumpType
==
TRANSCRIPT_HTML
)
contents
=
d
->
text
->
toHtml
();
file
.
write
(
contents
.
toLocal8Bit
());
}
void
cConsole
::
setHistorySize
(
int
size
)
{
...
...
@@ -372,6 +380,9 @@ void cConsole::addNewText (cTextChunk *chunk, bool endTheLine)
if
(
d
->
wantNewLine
)
{
cursor
.
insertBlock
();
d
->
wantNewLine
=
false
;
QTextBlockFormat
bformat
=
cursor
.
blockFormat
();
bformat
.
setLineHeight
(
2
,
QTextBlockFormat
::
LineDistanceHeight
);
cursor
.
setBlockFormat
(
bformat
);
}
cursor
.
insertHtml
(
chunk
->
toHTML
());
...
...
libs/ctextchunk.cpp
View file @
880808f5
...
...
@@ -717,7 +717,7 @@ QString cTextChunk::toHTML ()
for
(
it
=
_entries
.
begin
();
it
!=
_entries
.
end
();
++
it
)
s
+=
(
*
it
)
->
toHTML
(
suffix
);
s
+=
suffix
;
return
s
;
return
"<p>"
+
s
+
"</p>"
;
}
cTextChunk
*
cTextChunk
::
makeLine
(
const
QString
&
text
,
QColor
fg
,
QColor
bg
,
cConsole
*
console
)
...
...
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