summaryrefslogtreecommitdiff
path: root/client/viewer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/viewer.cc')
-rw-r--r--client/viewer.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/client/viewer.cc b/client/viewer.cc
index eabcf16..4a194b4 100644
--- a/client/viewer.cc
+++ b/client/viewer.cc
@@ -112,7 +112,7 @@ Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
}
#endif
- journal = new QTextEdit();
+ journal = new QPlainTextEdit();
journal->setReadOnly(true);
journal->setFont(*fixedfont);
l->addWidget(journal);
@@ -199,7 +199,6 @@ void Viewer::update()
}
QString filename = journalpath + "/" + cpr.mid(2,2) + "/" + crypt + "/JOURNAL.TXT";
- // filename = "/home/senator/JOURNAL.TXT";
QTextCodec *cp850 = QTextCodec::codecForName("cp850");
if(!cp850) {
@@ -213,12 +212,17 @@ void Viewer::update()
QString jstrip;
for(int i = 0; i < j.length(); i++) {
- if(j[i] != '·') jstrip += j[i]; // Remove end of line symbols.
+ if(j[i] != '·' && j[i] != '')
+ jstrip += j[i]; // Remove end of line and file symbols.
}
- if(journal->toPlainText() != jstrip) {
+ if(jlast != jstrip) {
+ int max = journal->verticalScrollBar()->maximum();
int pos = journal->verticalScrollBar()->value();
journal->setPlainText(jstrip);
+ // Scroll to bottom if we were there already or on first update.
+ if(pos == max || jlast == "") pos = journal->verticalScrollBar()->maximum();
journal->verticalScrollBar()->setValue(pos);
+ jlast = jstrip;
}
}