Backup backup
This commit is contained in:
parent
7561c4ccc9
commit
cd74595290
3 changed files with 32 additions and 1 deletions
|
@ -21,6 +21,10 @@ function Buffer(pointer, number, name, title) {
|
|||
this.number = number;
|
||||
this.name = name;
|
||||
this.title = title;
|
||||
this.visible = false;
|
||||
|
||||
// Amount of unread lines in this buffer
|
||||
this.unreadCount = 0;
|
||||
|
||||
// A listmodel where we put the messages of this buffer
|
||||
this.textList = Qt.createQmlObject('import QtQuick 2.0; ListModel {}',
|
||||
|
@ -33,8 +37,23 @@ function Buffer(pointer, number, name, title) {
|
|||
prefix: prefix,
|
||||
str: str
|
||||
});
|
||||
|
||||
if (!this.active) {
|
||||
++this.unreadCount;
|
||||
}
|
||||
};
|
||||
|
||||
// This buffer has become visible to the user
|
||||
this.activate = function() {
|
||||
this.active = true;
|
||||
this.unreadCount = 0;
|
||||
}
|
||||
|
||||
// This buffer will be hidden from the user
|
||||
this.deactivate = function() {
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
// Send input into this buffer
|
||||
this.input = function(str) {
|
||||
EQ.command('input 0x' + this.pointer + ' ' + str);
|
||||
|
|
|
@ -30,7 +30,8 @@ Page {
|
|||
bufferListModel.append({
|
||||
pointer: buffers[i].pointer,
|
||||
number: buffers[i].number,
|
||||
name: buffers[i].name
|
||||
name: buffers[i].name,
|
||||
unreadCount: buffers[i].unreadCount
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +78,12 @@ Page {
|
|||
color: listItem.highlighted ? Theme.highlightColor
|
||||
: Theme.primaryColor;
|
||||
}
|
||||
|
||||
Label {
|
||||
text: unreadCount
|
||||
color: listItem.highlighted ? Theme.highlightColor
|
||||
: Theme.primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
|
|
|
@ -27,11 +27,16 @@ Page {
|
|||
}
|
||||
|
||||
function changeBuffer(newBuffer) {
|
||||
if (buffer !== null) {
|
||||
buffer.deactivate();
|
||||
}
|
||||
|
||||
// Replace current list model with new list
|
||||
D.c('Changing buffer to ' + newBuffer.name);
|
||||
buffer = newBuffer;
|
||||
topic.title = newBuffer.title;
|
||||
textList.model = newBuffer.textList;
|
||||
buffer.activate();
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
|
|
Loading…
Reference in a new issue