Commit c3a4f234 authored by Pinak Ahuja's avatar Pinak Ahuja
Browse files

Add indexer state as a ListView in the monitor

The current state is highlighted. We probably need icons which visually
represent the state instead of text.
parent a8a47053
/*
* This file is part of the KDE Baloo Project
* Copyright (C) 2015 Pinak Ahuja <pinak.ahuja@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.4
ListModel {
id: stateModel
ListElement {
name: "Idle"
}
ListElement {
name: "Suspended"
}
ListElement {
name: "First Run"
}
ListElement {
name: "New Files"
}
ListElement {
name: "Modified Files"
}
ListElement {
name: "XAttr Files"
}
ListElement {
name: "File Content"
}
}
/*
* This file is part of the KDE Baloo Project
* Copyright (C) 2015 Pinak Ahuja <pinak.ahuja@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQml 2.2
ListView {
property int index: 0
id: stateView
Component {
id: stateViewDelegate
Label {
text: name
font.bold: true
}
}
interactive: false
orientation: Qt.Horizontal
currentIndex: index
model: StateModel {}
delegate: stateViewDelegate
spacing: 20
highlight: Rectangle { color: "lightsteelblue"; radius: 4 }
}
......@@ -36,13 +36,13 @@ ApplicationWindow {
anchors.fill: parent
visible: monitor.balooRunning
Label {
StateView {
id: indexerState
index: monitor.stateInt
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 20
text: "Indexer State: " + monitor.state
}
Label {
......@@ -50,6 +50,7 @@ ApplicationWindow {
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 20
anchors.topMargin: 40
elide: Text.ElideMiddle
......
......@@ -51,6 +51,7 @@ class Monitor : public QObject
Q_PROPERTY(uint filesIndexed MEMBER m_filesIndexed NOTIFY newFileIndexed)
Q_PROPERTY(QString remainingTime READ remainingTime NOTIFY remainingTimeChanged)
Q_PROPERTY(QString state READ state NOTIFY indexerStateChanged)
Q_PROPERTY(int stateInt READ stateInt NOTIFY indexerStateChanged)
public:
Monitor(QObject* parent = 0);
......@@ -59,6 +60,7 @@ public:
QString suspendState() const;
QString remainingTime() const { return m_remainingTime; }
QString state() const { return Baloo::stateString(m_indexerState); }
int stateInt() const { return static_cast<int>(m_indexerState); }
// Invokable methods
Q_INVOKABLE void toggleSuspendState();
......
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>StateModel.qml</file>
<file>StateView.qml</file>
</qresource>
</RCC>
\ No newline at end of file
</RCC>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment