forked from openkylin/quarkai
Add processes, resources and file system manager
This commit is contained in:
parent
1704f40b1e
commit
1f2a5b8428
|
@ -12,5 +12,6 @@ kylin-assistant (1.0.0-0ubuntu1) bionic; urgency=low
|
|||
* Add Network.
|
||||
* Add memory rate.
|
||||
* Add cpu rate and idle rate.
|
||||
* Add processes, resources and file system manager.
|
||||
|
||||
-- lixiang <lixiang@kylinos.cn> Thu, 21 Dec 2017 14:52:56 +0800
|
||||
-- lixiang <lixiang@kylinos.cn> Mon, 29 Jan 2018 17:54:44 +0800
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskitem.h"
|
||||
#include "../widgets/mytristatebutton.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QStyle>
|
||||
|
||||
DiskItem::DiskItem(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
,m_isHead(false)
|
||||
,m_isTail(false)
|
||||
,m_nameLabel(new QLabel)
|
||||
,m_mountLabel(new QLabel)
|
||||
,m_typeLabel(new QLabel)
|
||||
,m_totoalLabel(new QLabel)
|
||||
,m_availLabel(new QLabel)
|
||||
,m_usedLabel(new QLabel)
|
||||
,m_percentageLabel(new QLabel)
|
||||
,m_detailBtn(new MyTristateButton)
|
||||
{
|
||||
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
this->setFixedHeight(36);
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setMargin(0);
|
||||
|
||||
mainLayout->setContentsMargins(20, 0, 10, 0);
|
||||
mainLayout->addWidget(m_nameLabel);
|
||||
mainLayout->addWidget(m_mountLabel);
|
||||
mainLayout->addWidget(m_typeLabel);
|
||||
mainLayout->addWidget(m_totoalLabel);
|
||||
mainLayout->addWidget(m_availLabel);
|
||||
mainLayout->addWidget(m_usedLabel);
|
||||
mainLayout->addWidget(m_percentageLabel);
|
||||
mainLayout->addSpacing(8);
|
||||
// mainLayout->addStretch();
|
||||
mainLayout->addWidget(m_detailBtn);
|
||||
setLayout(mainLayout);
|
||||
|
||||
m_detailBtn->setObjectName("DiskDetailButton");
|
||||
connect(m_detailBtn, &MyTristateButton::clicked, this, [=] {
|
||||
//TODO: show detail dialog
|
||||
});
|
||||
}
|
||||
|
||||
DiskItem::~DiskItem()
|
||||
{
|
||||
delete m_nameLabel;
|
||||
delete m_mountLabel;
|
||||
delete m_typeLabel;
|
||||
delete m_totoalLabel;
|
||||
delete m_availLabel;
|
||||
delete m_usedLabel;
|
||||
delete m_percentageLabel;
|
||||
delete m_detailBtn;
|
||||
}
|
||||
|
||||
void DiskItem::setIsHead(bool head)
|
||||
{
|
||||
if (head == m_isHead) return;
|
||||
m_isHead = head;
|
||||
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
}
|
||||
|
||||
void DiskItem::setIsTail(bool tail)
|
||||
{
|
||||
if (tail == m_isTail) return;
|
||||
m_isTail = tail;
|
||||
|
||||
style()->unpolish(this);
|
||||
style()->polish(this);
|
||||
}
|
||||
|
||||
void DiskItem::setDevName(const QString &name)
|
||||
{
|
||||
m_nameLabel->setText(name);
|
||||
|
||||
setAccessibleName(name);
|
||||
}
|
||||
|
||||
void DiskItem::setMountDir(const QString &mountdir)
|
||||
{
|
||||
m_mountLabel->setText(mountdir);
|
||||
}
|
||||
|
||||
void DiskItem::setDiskType(const QString &disktype)
|
||||
{
|
||||
m_typeLabel->setText(disktype);
|
||||
}
|
||||
|
||||
void DiskItem::setTotalCapacity(const QString &totalcapacity)
|
||||
{
|
||||
m_totoalLabel->setText(totalcapacity);
|
||||
}
|
||||
|
||||
void DiskItem::setAvailCapacity(const QString &availcapacity)
|
||||
{
|
||||
m_availLabel->setText(availcapacity);
|
||||
}
|
||||
|
||||
void DiskItem::setUsedCapactiy(const QString &usedcapactiy)
|
||||
{
|
||||
m_usedLabel->setText(usedcapactiy);
|
||||
}
|
||||
|
||||
void DiskItem::setPercentage(const QString &percentage)
|
||||
{
|
||||
m_percentageLabel->setText(percentage);
|
||||
}
|
||||
|
||||
void DiskItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
e->accept();
|
||||
|
||||
emit selected();
|
||||
emit clicked();
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DISKITEM_H
|
||||
#define DISKITEM_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QMap>
|
||||
#include <QMapNode>
|
||||
#include <QLabel>
|
||||
|
||||
class MyTristateButton;
|
||||
|
||||
class DiskItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskItem(QWidget *parent = 0);
|
||||
~DiskItem();
|
||||
|
||||
inline QString devName() const { return m_nameLabel->text(); }
|
||||
void setDevName(const QString &name);
|
||||
void setMountDir(const QString &mountdir);
|
||||
void setDiskType(const QString &disktype);
|
||||
void setTotalCapacity(const QString &totalcapacity);
|
||||
void setAvailCapacity(const QString &availcapacity);
|
||||
void setUsedCapactiy(const QString &usedcapactiy);
|
||||
void setPercentage(const QString &percentage);
|
||||
void setIsHead(bool head = true);
|
||||
void setIsTail(bool tail = true);
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
|
||||
signals:
|
||||
void clicked() const;
|
||||
void selected() const;
|
||||
void acceptNextPage() const;
|
||||
|
||||
private:
|
||||
QLabel *m_nameLabel;
|
||||
QLabel *m_mountLabel;
|
||||
QLabel *m_typeLabel;
|
||||
QLabel *m_totoalLabel;
|
||||
QLabel *m_availLabel;
|
||||
QLabel *m_usedLabel;
|
||||
QLabel *m_percentageLabel;
|
||||
MyTristateButton *m_detailBtn;
|
||||
bool m_isHead;
|
||||
bool m_isTail;
|
||||
};
|
||||
|
||||
#endif // DISKITEM_H
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskitemlist.h"
|
||||
#include "diskitem.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QDebug>
|
||||
|
||||
DiskItemList::DiskItemList(QFrame *parent) :
|
||||
QWidget(parent),
|
||||
m_layout(new QVBoxLayout),
|
||||
m_updateHTimer(new QTimer(this)),
|
||||
m_updateHeadTimer(new QTimer(this))
|
||||
{
|
||||
m_layout->setMargin(0);
|
||||
m_layout->setSpacing(1);
|
||||
|
||||
m_updateHTimer->setSingleShot(true);
|
||||
m_updateHTimer->setInterval(10);
|
||||
|
||||
m_updateHeadTimer->setSingleShot(true);
|
||||
m_updateHeadTimer->setInterval(10);
|
||||
|
||||
connect(m_updateHTimer, &QTimer::timeout, this, &DiskItemList::updateHeight, Qt::QueuedConnection);
|
||||
connect(m_updateHeadTimer, &QTimer::timeout, this, &DiskItemList::updateHeadTail, Qt::QueuedConnection);
|
||||
|
||||
setLayout(m_layout);
|
||||
}
|
||||
|
||||
DiskItemList::~DiskItemList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiskItemList::appendItem(DiskItem *item)
|
||||
{
|
||||
m_layout->insertWidget(m_layout->count(), item);
|
||||
item->installEventFilter(this);
|
||||
|
||||
m_updateHeadTimer->start();
|
||||
m_updateHTimer->start();
|
||||
}
|
||||
|
||||
void DiskItemList::removeItem(DiskItem *item)
|
||||
{
|
||||
m_layout->removeWidget(item);
|
||||
item->removeEventFilter(this);
|
||||
|
||||
m_updateHeadTimer->start();
|
||||
m_updateHTimer->start();
|
||||
}
|
||||
|
||||
void DiskItemList::moveItem(DiskItem *item, const int index)
|
||||
{
|
||||
const int oldIndex = m_layout->indexOf(item);
|
||||
if (oldIndex == index)
|
||||
return;
|
||||
|
||||
m_layout->removeWidget(item);
|
||||
m_layout->insertWidget(index, item);
|
||||
|
||||
const int max = m_layout->count() - 1;
|
||||
if (index == 0 || index == max ||
|
||||
oldIndex == 0 || oldIndex == max)
|
||||
m_updateHeadTimer->start();
|
||||
}
|
||||
|
||||
void DiskItemList::setSpacing(const int spaceing)
|
||||
{
|
||||
m_layout->setSpacing(spaceing);
|
||||
|
||||
m_updateHTimer->start();
|
||||
}
|
||||
|
||||
int DiskItemList::itemCount() const
|
||||
{
|
||||
return m_layout->count();
|
||||
}
|
||||
|
||||
void DiskItemList::clear()
|
||||
{
|
||||
const int index = 0;
|
||||
const int count = m_layout->count();
|
||||
|
||||
for (int i(index); i != count; ++i)
|
||||
{
|
||||
QLayoutItem *item = m_layout->takeAt(index);
|
||||
QWidget *w = item->widget();
|
||||
w->removeEventFilter(this);
|
||||
w->setParent(nullptr);
|
||||
delete item;
|
||||
}
|
||||
|
||||
m_updateHeadTimer->start();
|
||||
m_updateHTimer->start();
|
||||
}
|
||||
|
||||
DiskItem *DiskItemList::getItem(int index)
|
||||
{
|
||||
if(index < 0)
|
||||
return NULL;
|
||||
|
||||
if(index < itemCount())
|
||||
{
|
||||
return qobject_cast<DiskItem *>(m_layout->itemAt(index)->widget());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool DiskItemList::eventFilter(QObject *, QEvent *event)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Show:
|
||||
case QEvent::Hide: m_updateHeadTimer->start();
|
||||
case QEvent::Resize: m_updateHTimer->start(); break;
|
||||
default:;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DiskItemList::updateHeadTail()
|
||||
{
|
||||
DiskItem *head = nullptr;
|
||||
DiskItem *tail = nullptr;
|
||||
|
||||
const int count = m_layout->count();
|
||||
for (int i(0); i != count; ++i)
|
||||
{
|
||||
DiskItem *item = qobject_cast<DiskItem *>(m_layout->itemAt(i)->widget());
|
||||
Q_ASSERT(item);
|
||||
|
||||
if (!item->isVisible())
|
||||
continue;
|
||||
|
||||
item->setIsHead(false);
|
||||
item->setIsTail(false);
|
||||
|
||||
if (!head)
|
||||
head = item;
|
||||
tail = item;
|
||||
}
|
||||
|
||||
if (head)
|
||||
head->setIsHead();
|
||||
if (tail)
|
||||
tail->setIsTail();
|
||||
}
|
||||
|
||||
void DiskItemList::updateHeight()
|
||||
{
|
||||
Q_ASSERT(sender() == m_updateHTimer);
|
||||
|
||||
setFixedHeight(m_layout->sizeHint().height());
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DISKITEMLIST_H
|
||||
#define DISKITEMLIST_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
class QVBoxLayout;
|
||||
|
||||
class DiskItem;
|
||||
|
||||
class DiskItemList : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskItemList(QFrame *parent = 0);
|
||||
explicit DiskItemList(const QString &title, QFrame *parent = 0);
|
||||
~DiskItemList();
|
||||
|
||||
DiskItem* getItem(int index);
|
||||
void appendItem(DiskItem * item);
|
||||
void removeItem(DiskItem * item);
|
||||
void moveItem(DiskItem *item, const int index);
|
||||
void setSpacing(const int spaceing);
|
||||
|
||||
int itemCount() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *, QEvent *event);
|
||||
void updateHeadTail();
|
||||
|
||||
private slots:
|
||||
void updateHeight();
|
||||
|
||||
private:
|
||||
QVBoxLayout *m_layout;
|
||||
QTimer *m_updateHTimer;
|
||||
QTimer *m_updateHeadTimer;
|
||||
};
|
||||
|
||||
#endif // DISKITEMLIST_H
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskmodel.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
DiskModel::DiskModel(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DiskModel::~DiskModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DiskInfo *DiskModel::getDiskInfo(const QString &devname)
|
||||
{
|
||||
return m_diskInfoList.value(devname, nullptr);
|
||||
}
|
||||
|
||||
QList<DiskInfo *> DiskModel::diskInfoList() const
|
||||
{
|
||||
return m_diskInfoList.values();
|
||||
}
|
||||
|
||||
void DiskModel::addDiskInfo(const QString &devname, DiskInfo *info)
|
||||
{
|
||||
if (!m_diskInfoList.contains(devname)) {
|
||||
m_diskInfoList[devname] = info;
|
||||
emit oneDiskInfoAdded(info);
|
||||
}
|
||||
}
|
||||
|
||||
void DiskModel::removeDiskInfo(const QString &devname)
|
||||
{
|
||||
DiskInfo *info = getDiskInfo(devname);
|
||||
m_diskInfoList.remove(devname);
|
||||
|
||||
if (info)
|
||||
emit oneDiskInfoRemoved(info);
|
||||
}
|
||||
|
||||
bool DiskModel::contains(const QString &devname)
|
||||
{
|
||||
return m_diskInfoList.contains(devname);
|
||||
}
|
|
@ -17,56 +17,61 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "diskinfo.h"
|
||||
#include "filesystemdata.h"
|
||||
#include <QDebug>
|
||||
|
||||
DiskInfo::DiskInfo(QObject *parent)
|
||||
FileSystemData::FileSystemData(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
const QString DiskInfo::devname() const
|
||||
const QString FileSystemData::deviceName() const
|
||||
{
|
||||
return m_devName;
|
||||
}
|
||||
|
||||
void DiskInfo::setDevName(const QString &name)
|
||||
void FileSystemData::setDevName(const QString &name)
|
||||
{
|
||||
if (name != m_devName)
|
||||
m_devName = name;
|
||||
}
|
||||
|
||||
const QString DiskInfo::mountdir() const
|
||||
const QString FileSystemData::mountDir() const
|
||||
{
|
||||
return m_mountDir;
|
||||
}
|
||||
|
||||
const QString DiskInfo::disktype() const
|
||||
const QString FileSystemData::diskType() const
|
||||
{
|
||||
return m_diskType;
|
||||
}
|
||||
|
||||
const QString DiskInfo::totalcapacity() const
|
||||
const QString FileSystemData::totalCapacity() const
|
||||
{
|
||||
return m_totalCapacity;
|
||||
}
|
||||
|
||||
const QString DiskInfo::availcapacity() const
|
||||
const QString FileSystemData::freeCapacity() const
|
||||
{
|
||||
return m_freeCapacity;
|
||||
}
|
||||
|
||||
const QString FileSystemData::availCapacity() const
|
||||
{
|
||||
return m_availCapacity;
|
||||
}
|
||||
|
||||
const QString DiskInfo::usedcapactiy() const
|
||||
const QString FileSystemData::usedCapactiy() const
|
||||
{
|
||||
return m_usedCapactiy;
|
||||
}
|
||||
|
||||
const QString DiskInfo::percentage() const
|
||||
const int FileSystemData::usedPercentage()
|
||||
{
|
||||
return m_percentage;
|
||||
}
|
||||
|
||||
void DiskInfo::setOtherDiskInfo(QString mountDir, QString diskType, QString totalCapacity, QString availCapacity, QString usedCapactiy, QString percentage)
|
||||
void FileSystemData::updateDiskInfo(QString mountDir, QString diskType, QString totalCapacity, QString freeCapacity, QString availCapacity, QString usedCapactiy, int percentage)
|
||||
{
|
||||
if (mountDir != m_mountDir)
|
||||
m_mountDir = mountDir;
|
||||
|
@ -74,6 +79,8 @@ void DiskInfo::setOtherDiskInfo(QString mountDir, QString diskType, QString tota
|
|||
m_diskType = diskType;
|
||||
if (totalCapacity != m_totalCapacity)
|
||||
m_totalCapacity = totalCapacity;
|
||||
if (freeCapacity != m_freeCapacity)
|
||||
m_freeCapacity = freeCapacity;
|
||||
if (availCapacity != m_availCapacity)
|
||||
m_availCapacity = availCapacity;
|
||||
if (usedCapactiy != m_usedCapactiy)
|
|
@ -24,32 +24,35 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class DiskInfo : public QObject
|
||||
class FileSystemData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskInfo(QObject *parent = 0);
|
||||
explicit FileSystemData(QObject *parent = 0);
|
||||
|
||||
const QString devname() const;
|
||||
const QString deviceName() const;
|
||||
void setDevName(const QString &name);
|
||||
|
||||
const QString mountdir() const;
|
||||
const QString disktype() const;
|
||||
const QString totalcapacity() const;
|
||||
const QString availcapacity() const;
|
||||
const QString usedcapactiy() const;
|
||||
const QString percentage() const;
|
||||
void setOtherDiskInfo(QString mountDir, QString diskType, QString totalCapacity, QString availCapacity, QString usedCapactiy, QString percentage);
|
||||
const QString mountDir() const;
|
||||
const QString diskType() const;
|
||||
const QString totalCapacity() const;
|
||||
const QString freeCapacity() const;
|
||||
const QString availCapacity() const;
|
||||
const QString usedCapactiy() const;
|
||||
const int usedPercentage();
|
||||
|
||||
void updateDiskInfo(QString mountDir, QString diskType, QString totalCapacity, QString freeCapacity, QString availCapacity, QString usedCapactiy, int percentage);
|
||||
|
||||
private:
|
||||
QString m_devName;
|
||||
QString m_mountDir;
|
||||
QString m_diskType;
|
||||
QString m_totalCapacity;
|
||||
QString m_freeCapacity;
|
||||
QString m_availCapacity;
|
||||
QString m_usedCapactiy;
|
||||
QString m_percentage;
|
||||
int m_percentage;
|
||||
};
|
||||
|
||||
|
|
@ -24,16 +24,13 @@
|
|||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "diskitemlist.h"
|
||||
#include "diskitem.h"
|
||||
#include "diskmodel.h"
|
||||
#include "diskinfo.h"
|
||||
#include "filesystemdata.h"
|
||||
#include "filesystemworker.h"
|
||||
|
||||
FileSystemDialog::FileSystemDialog(QWidget *parent)
|
||||
FileSystemDialog::FileSystemDialog(QList<bool> toBeDisplayedColumns, QSettings *settings, QWidget *parent)
|
||||
:QWidget(parent)
|
||||
,m_diskItemList(new DiskItemList)
|
||||
,m_monitorFile("/home/lixiang/testwatcher/1.c")
|
||||
,proSettings(settings)
|
||||
// ,m_monitorFile("/home/lixiang/testwatcher/1.c")
|
||||
// ,m_monitorFile("/etc/mtab")
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
@ -43,42 +40,62 @@ FileSystemDialog::FileSystemDialog(QWidget *parent)
|
|||
|
||||
this->setObjectName("FileSystemDialog");
|
||||
|
||||
m_centralLayout = new QVBoxLayout;
|
||||
m_centralLayout->addWidget(m_diskItemList);
|
||||
m_centralLayout->setSpacing(10);
|
||||
m_centralLayout->setMargin(0);
|
||||
m_layout = new QVBoxLayout(this);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_layout->setSpacing(0);
|
||||
|
||||
setLayout(m_centralLayout);
|
||||
m_fileSysListWidget = new FileSystemListWidget(toBeDisplayedColumns);
|
||||
connect(m_fileSysListWidget, &FileSystemListWidget::rightMouseClickedItem, this, &FileSystemDialog::popupMenu, Qt::QueuedConnection);
|
||||
connect(m_fileSysListWidget, SIGNAL(changeColumnVisible(int,bool,QList<bool>)), this, SIGNAL(changeColumnVisible(int,bool,QList<bool>)));
|
||||
m_layout->addWidget(m_fileSysListWidget);
|
||||
|
||||
|
||||
m_diskModelList = new DiskModel;
|
||||
connect(m_diskModelList, SIGNAL(oneDiskInfoAdded(DiskInfo*)), this, SLOT(addDiskInfoItem(DiskInfo*)));
|
||||
connect(m_diskModelList, SIGNAL(oneDiskInfoRemoved(DiskInfo*)), this, SLOT(removeDiskInfoItemByDevName(DiskInfo*)));
|
||||
|
||||
m_fileSystemWorker = new FileSystemWorker(m_diskModelList);
|
||||
m_fileSystemWorker = new FileSystemWorker;
|
||||
m_fileSystemWorker->moveToThread(qApp->thread());
|
||||
m_diskModelList->moveToThread(qApp->thread());
|
||||
|
||||
this->initFileSystemMonitor();
|
||||
// this->initFileSystemMonitor();
|
||||
|
||||
m_menu = new QMenu();
|
||||
m_refreshAction = new QAction(tr("Refresh"), this);
|
||||
connect(m_refreshAction, &QAction::triggered, this, &FileSystemDialog::refreshFileSysList);
|
||||
m_menu->addAction(m_refreshAction);
|
||||
|
||||
this->refreshFileSysList();
|
||||
}
|
||||
|
||||
FileSystemDialog::~FileSystemDialog()
|
||||
{
|
||||
m_fileSystemMonitor->removePath(m_monitorFile);
|
||||
delete m_fileSystemMonitor;
|
||||
// m_fileSystemMonitor->removePath(m_monitorFile);
|
||||
// delete m_fileSystemMonitor;
|
||||
|
||||
m_diskModelList->deleteLater();
|
||||
m_fileSystemWorker->deleteLater();
|
||||
delete m_fileSysListWidget;
|
||||
delete m_refreshAction;
|
||||
delete m_menu;
|
||||
delete m_layout;
|
||||
}
|
||||
|
||||
QList<DiskItem *> items = findChildren<DiskItem*>();
|
||||
for (DiskItem *item : items) {
|
||||
m_diskItemList->removeItem(item);
|
||||
item->deleteLater();
|
||||
}
|
||||
if (m_diskItemList) {
|
||||
delete m_diskItemList;
|
||||
m_diskItemList = 0;
|
||||
void FileSystemDialog::refreshFileSysList()
|
||||
{
|
||||
|
||||
m_fileSystemWorker->onFileSystemListChanged();
|
||||
|
||||
|
||||
QList<FileSystemListItem*> items;
|
||||
for (FileSystemData *info : m_fileSystemWorker->diskInfoList()) {
|
||||
FileSystemListItem *item = new FileSystemListItem(info);
|
||||
items << item;
|
||||
}
|
||||
m_fileSysListWidget->refreshFileSystemItems(items);
|
||||
}
|
||||
|
||||
void FileSystemDialog::popupMenu(QPoint pos)
|
||||
{
|
||||
m_menu->exec(pos);
|
||||
}
|
||||
|
||||
FileSystemListWidget* FileSystemDialog::getFileSysView()
|
||||
{
|
||||
return m_fileSysListWidget;
|
||||
}
|
||||
|
||||
void FileSystemDialog::initFileSystemMonitor() {
|
||||
|
@ -87,7 +104,7 @@ void FileSystemDialog::initFileSystemMonitor() {
|
|||
// int ret = inotify_rm_watch (fd, wd);*/
|
||||
|
||||
|
||||
m_fileSystemMonitor = new QFileSystemWatcher(this);
|
||||
/*m_fileSystemMonitor = new QFileSystemWatcher(this);
|
||||
// m_fileSystemMonitor->addPath(m_monitorFile);
|
||||
QFileInfo info(m_monitorFile);
|
||||
m_fileSystemMonitor->addPath(info.absoluteFilePath());
|
||||
|
@ -95,7 +112,7 @@ void FileSystemDialog::initFileSystemMonitor() {
|
|||
connect(m_fileSystemMonitor, SIGNAL(directoryChanged(QString)), this, SLOT(onDirectoryChanged(QString)));
|
||||
connect(m_fileSystemMonitor, &QFileSystemWatcher::fileChanged, [=] (const QString &path) {
|
||||
qDebug()<< "file path===================="<<path;
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
void FileSystemDialog::onDirectoryChanged(QString path)
|
||||
|
@ -103,35 +120,10 @@ void FileSystemDialog::onDirectoryChanged(QString path)
|
|||
qDebug()<< "dir path===================="<<path;
|
||||
}
|
||||
|
||||
void FileSystemDialog::addDiskInfoItem(DiskInfo *info)
|
||||
{
|
||||
DiskItem *w = new DiskItem;
|
||||
m_diskItemList->appendItem(w);
|
||||
w->setDevName(info->devname());
|
||||
w->setMountDir(info->mountdir());
|
||||
w->setDiskType(info->disktype());
|
||||
w->setTotalCapacity(info->totalcapacity());
|
||||
w->setAvailCapacity(info->availcapacity());
|
||||
w->setUsedCapactiy(info->usedcapactiy());
|
||||
w->setPercentage(info->percentage());
|
||||
}
|
||||
//bool FileSystemDialog::event(QEvent *event)
|
||||
//{
|
||||
// if (event->type() == QEvent::LayoutRequest)
|
||||
// setFixedHeight(m_centralLayout->sizeHint().height());
|
||||
|
||||
void FileSystemDialog::removeDiskInfoItemByDevName(DiskInfo *info)
|
||||
{
|
||||
QList<DiskItem *> items = findChildren<DiskItem*>();
|
||||
for (DiskItem *item : items) {
|
||||
if (item->devName() == info->devname()) {
|
||||
m_diskItemList->removeItem(item);
|
||||
item->deleteLater();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileSystemDialog::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LayoutRequest)
|
||||
setFixedHeight(m_centralLayout->sizeHint().height());
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
// return QWidget::event(event);
|
||||
//}
|
||||
|
|
|
@ -18,37 +18,50 @@
|
|||
*/
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSettings>
|
||||
#include <QMenu>
|
||||
#include <QFileSystemWatcher>
|
||||
#include "filesystemlistwidget.h"
|
||||
|
||||
class DiskItemList;
|
||||
class DiskModel;
|
||||
class DiskInfo;
|
||||
//class DiskItemList;
|
||||
//class DiskModel;
|
||||
class FileSystemData;
|
||||
class FileSystemWorker;
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
|
||||
class FileSystemDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileSystemDialog(QWidget* parent = 0);
|
||||
explicit FileSystemDialog(QList<bool> toBeDisplayedColumns, QSettings *settings, QWidget* parent = 0);
|
||||
~FileSystemDialog();
|
||||
|
||||
FileSystemListWidget* getFileSysView();
|
||||
void initFileSystemMonitor();
|
||||
|
||||
public slots:
|
||||
void addDiskInfoItem(DiskInfo *info);
|
||||
void removeDiskInfoItemByDevName(DiskInfo *info);
|
||||
void refreshFileSysList();
|
||||
void onDirectoryChanged(QString path);
|
||||
void popupMenu(QPoint pos);
|
||||
|
||||
signals:
|
||||
void changeColumnVisible(int index, bool visible, QList<bool> columnVisible);
|
||||
|
||||
//private:
|
||||
// bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
QVBoxLayout *m_centralLayout = nullptr;
|
||||
DiskItemList *m_diskItemList;
|
||||
DiskModel *m_diskModelList;
|
||||
// QVBoxLayout *m_centralLayout = nullptr;
|
||||
// DiskItemList *m_diskItemList;
|
||||
// DiskModel *m_diskModelList;
|
||||
FileSystemWorker *m_fileSystemWorker = nullptr;
|
||||
QFileSystemWatcher *m_fileSystemMonitor = nullptr;
|
||||
QString m_monitorFile;
|
||||
// QFileSystemWatcher *m_fileSystemMonitor = nullptr;
|
||||
// QString m_monitorFile;
|
||||
QSettings *proSettings = nullptr;
|
||||
FileSystemListWidget *m_fileSysListWidget = nullptr;
|
||||
QAction *m_refreshAction = nullptr;
|
||||
QMenu *m_menu = nullptr;
|
||||
QVBoxLayout *m_layout = nullptr;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "filesystemlistitem.h"
|
||||
#include <QCollator>
|
||||
#include <QDebug>
|
||||
#include <QLocale>
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#include <QStyleOptionProgressBar>
|
||||
#include <QProgressBar>
|
||||
#include <QApplication>
|
||||
|
||||
FileSystemListItem::FileSystemListItem(FileSystemData *info)
|
||||
{
|
||||
m_data = info;
|
||||
iconSize = 16;
|
||||
padding = 14;
|
||||
textPadding = 5;
|
||||
}
|
||||
|
||||
bool FileSystemListItem::isSameItem(FileSystemListItem *item)
|
||||
{
|
||||
return m_data->deviceName() == ((static_cast<FileSystemListItem*>(item)))->m_data->deviceName();
|
||||
}
|
||||
|
||||
void FileSystemListItem::drawBackground(QRect rect, QPainter *painter, int index, bool isSelect)
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addRect(QRectF(rect));
|
||||
|
||||
if (isSelect) {
|
||||
painter->setOpacity(0.1);
|
||||
painter->fillPath(path, QColor("#2bb6ea"));
|
||||
}
|
||||
else {
|
||||
painter->setOpacity(1);
|
||||
painter->fillPath(path, QColor("#ffffff"));
|
||||
// if (index % 2 == 0) {
|
||||
// painter->fillPath(path, QColor("#ffffff"));
|
||||
// } else {
|
||||
// painter->fillPath(path, QColor("#e9eef0"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListItem::drawForeground(QRect rect, QPainter *painter, int column, int, bool isSelect, bool isSeparator)
|
||||
{
|
||||
setFontSize(*painter, 12);
|
||||
painter->setOpacity(1);
|
||||
painter->setPen(QPen(QColor("#000000")));
|
||||
if (column == 0) {
|
||||
painter->drawPixmap(QRect(rect.x() + padding, rect.y() + (rect.height() - iconSize) / 2, iconSize, iconSize), QPixmap(":/res/disk.png"));
|
||||
int nameMaxWidth = rect.width() - iconSize - padding * 3;
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString deviceName = fm.elidedText(m_data->deviceName(), Qt::ElideRight, nameMaxWidth);//Qt::ElideMiddle
|
||||
painter->drawText(QRect(rect.x() + iconSize + padding * 2, rect.y(), nameMaxWidth, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, deviceName);
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 1) {
|
||||
if (!m_data->mountDir().isEmpty()) {
|
||||
int maxWidth = rect.width();
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString mountDir = fm.elidedText(m_data->mountDir(), Qt::ElideMiddle, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, mountDir);
|
||||
}
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 2) {
|
||||
if (!m_data->diskType().isEmpty()) {
|
||||
int maxWidth = rect.width();
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString diskType = fm.elidedText(m_data->diskType(), Qt::ElideRight, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, diskType);
|
||||
}
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 3) {
|
||||
if (!m_data->totalCapacity().isEmpty()) {
|
||||
int maxWidth = rect.width();
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString tCapacity = fm.elidedText(m_data->totalCapacity(), Qt::ElideRight, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, tCapacity);
|
||||
}
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 4) {
|
||||
if (!m_data->freeCapacity().isEmpty()) {
|
||||
int maxWidth = rect.width();
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString fCapacity = fm.elidedText(m_data->freeCapacity(), Qt::ElideRight, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, fCapacity);
|
||||
}
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 5) {
|
||||
if (!m_data->availCapacity().isEmpty()) {
|
||||
int maxWidth = rect.width();
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString aCapacity = fm.elidedText(m_data->availCapacity(), Qt::ElideRight, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, aCapacity);
|
||||
}
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 6) {
|
||||
if (!m_data->usedCapactiy().isEmpty()) {
|
||||
int maxWidth = 60;
|
||||
QFont font = painter->font();
|
||||
QFontMetrics fm(font);
|
||||
QString uCapacity = fm.elidedText(m_data->usedCapactiy(), Qt::ElideRight, maxWidth);
|
||||
painter->drawText(QRect(rect.x(), rect.y(), maxWidth - textPadding, rect.height()), Qt::AlignLeft | Qt::AlignVCenter, uCapacity);
|
||||
}
|
||||
int leftPadding = 10;
|
||||
int topPadding = 5;
|
||||
int pWidth = rect.width() - 60 - 2 * leftPadding - textPadding;
|
||||
int pHeight = rect.height() - 2 * topPadding;
|
||||
QPainterPath bgPath;
|
||||
bgPath.addRect(QRectF(rect.x() + 60, rect.y() + topPadding, pWidth, pHeight));
|
||||
painter->fillPath(bgPath, QColor("#eeeeee"));
|
||||
QPainterPath fillPath;
|
||||
fillPath.addRect(QRectF(rect.x() + 60, rect.y() + topPadding, pWidth - m_data->usedPercentage(), pHeight));
|
||||
painter->setOpacity(0.5);
|
||||
painter->fillPath(fillPath, QColor("#0288d1"));
|
||||
painter->setOpacity(1);
|
||||
painter->drawText(QRect(rect.x() + 60, rect.y() + topPadding, pWidth, pHeight), Qt::AlignHCenter | Qt::AlignVCenter, QString::number(m_data->usedPercentage()).append("%"));
|
||||
|
||||
/*
|
||||
QStyleOptionProgressBar progressBarStyle;//progressBarStyle.initFrom(this);
|
||||
progressBarStyle.rect = QRect(rect.x() + 60, rect.y() + topPadding, pWidth, pHeight);
|
||||
progressBarStyle.minimum = 0;
|
||||
progressBarStyle.maximum = 100;
|
||||
progressBarStyle.textAlignment = Qt::AlignCenter;
|
||||
progressBarStyle.progress = m_data->usedPercentage();
|
||||
progressBarStyle.text = QString("%1%").arg(m_data->usedPercentage());
|
||||
progressBarStyle.textVisible = true;
|
||||
QProgressBar progressBar;
|
||||
progressBar.setStyleSheet("QProgressBar{border: none;text-align: center;background:#eeeeee;}QProgressBar::chunk {background:#0288d1;}");
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarStyle, painter, &progressBar);//绘制进度条
|
||||
*/
|
||||
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString FileSystemListItem::getDeviceName() const
|
||||
{
|
||||
return m_data->deviceName();
|
||||
}
|
||||
|
||||
QString FileSystemListItem::getDirectory() const
|
||||
{
|
||||
return m_data->mountDir();
|
||||
}
|
|
@ -18,34 +18,35 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef DISKMODEL_H
|
||||
#define DISKMODEL_H
|
||||
#ifndef FILESYSTEMLISTITEM_H
|
||||
#define FILESYSTEMLISTITEM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
|
||||
#include "diskinfo.h"
|
||||
#include "filesystemdata.h"
|
||||
|
||||
class DiskModel : public QObject
|
||||
class FileSystemListItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiskModel(QObject *parent = 0);
|
||||
~DiskModel();
|
||||
|
||||
DiskInfo *getDiskInfo(const QString &devname);
|
||||
QList<DiskInfo *> diskInfoList() const;
|
||||
void addDiskInfo(const QString &devname, DiskInfo *info);
|
||||
void removeDiskInfo(const QString &devname);
|
||||
bool contains(const QString &devname);
|
||||
|
||||
signals:
|
||||
void oneDiskInfoAdded(DiskInfo *info);
|
||||
void oneDiskInfoRemoved(DiskInfo *info);
|
||||
FileSystemListItem(FileSystemData *info);
|
||||
|
||||
bool isSameItem(FileSystemListItem *item);
|
||||
void drawCellBackground(QRect rect, QPainter *painter, int level);
|
||||
void drawBackground(QRect rect, QPainter *painter, int index, bool isSelect);
|
||||
void drawForeground(QRect rect, QPainter *painter, int column, int index, bool isSelect, bool isSeparator);
|
||||
|
||||
QString getDeviceName() const;
|
||||
QString getDirectory() const;
|
||||
|
||||
private:
|
||||
QMap<QString, DiskInfo *> m_diskInfoList;
|
||||
FileSystemData *m_data;
|
||||
int iconSize;
|
||||
int padding;
|
||||
int textPadding;
|
||||
};
|
||||
|
||||
#endif // DISKMODEL_H
|
||||
|
||||
#endif // FILESYSTEMLISTITEM_H
|
|
@ -0,0 +1,586 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "filesystemlistwidget.h"
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
#include <QStyleFactory>
|
||||
#include <QWheelEvent>
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
#include <QPen>
|
||||
#include <QDesktopServices>
|
||||
|
||||
FileSystemListWidget::FileSystemListWidget(QList<bool> toBeDisplayedColumns, QWidget *parent) : QWidget(parent)
|
||||
,m_titlePadding(10)
|
||||
,m_titleHeight(34)
|
||||
,m_rowHeight(29)
|
||||
,m_offSet(0)
|
||||
,m_origOffset(0)
|
||||
,m_scrollbarWidth(10)
|
||||
,m_titleHoverColumn(-1)
|
||||
,m_titlePressColumn(-1)
|
||||
,m_mouseAtScrollArea(false)
|
||||
,m_mouseDragScrollbar(false)
|
||||
{
|
||||
this->m_lastItem = NULL;
|
||||
this->m_listItems = new QList<FileSystemListItem*>();
|
||||
this->m_selectedItems = new QList<FileSystemListItem*>();
|
||||
|
||||
this->columnTitles << tr("Device") << tr("Directory") << tr("Type") << tr("Total") << tr("Free") << tr("Available") << tr("Used");
|
||||
QList<int> widths;
|
||||
widths << 150 << -1 << 60 << 60 << 60 << 60 << 180;//-1时让改行填充所有剩余空间
|
||||
|
||||
QFont font;
|
||||
font.setPixelSize(12);//需要和填充所有剩余空间的那个的文字字体大小一致 font.setPointSize(9)
|
||||
QFontMetrics fm(font);
|
||||
|
||||
this->m_columnWidths.clear();
|
||||
for (int i = 0; i < widths.length(); i++) {
|
||||
if (widths[i] == -1) {
|
||||
this->m_columnWidths << widths[i];
|
||||
} else {//-1时让改行填充所有剩余空间
|
||||
int maxWidth = fm.width(this->columnTitles[i]) + this->m_titlePadding + /*m_upArrowPixmap.width() / m_upArrowPixmap.devicePixelRatio() +*/ 2 * 2;
|
||||
this->m_columnWidths << std::max(widths[i], maxWidth);
|
||||
}
|
||||
}
|
||||
|
||||
this->m_columnVisibles.clear();
|
||||
for (int i = 0; i < toBeDisplayedColumns.count(); i++) {
|
||||
this->m_columnVisibles.append(toBeDisplayedColumns[i]);
|
||||
}
|
||||
|
||||
this->setFocus();
|
||||
}
|
||||
|
||||
FileSystemListWidget::~FileSystemListWidget()
|
||||
{
|
||||
if (this->m_hideScrollbarTimer != NULL) {
|
||||
disconnect(this->m_hideScrollbarTimer,SIGNAL(timeout()),this,SLOT(hideScrollbar()));
|
||||
if(this->m_hideScrollbarTimer->isActive()) {
|
||||
this->m_hideScrollbarTimer->stop();
|
||||
}
|
||||
delete this->m_hideScrollbarTimer;
|
||||
this->m_hideScrollbarTimer = nullptr;
|
||||
}
|
||||
|
||||
delete this->m_lastItem;
|
||||
delete this->m_listItems;
|
||||
delete this->m_selectedItems;
|
||||
}
|
||||
|
||||
void FileSystemListWidget::clearItems()
|
||||
{
|
||||
qDeleteAll(this->m_listItems->begin(), this->m_listItems->end());
|
||||
this->m_listItems->clear();
|
||||
}
|
||||
|
||||
void FileSystemListWidget::addSelectedItems(QList<FileSystemListItem*> items, bool recordLastItem)
|
||||
{
|
||||
this->m_selectedItems->append(items);
|
||||
|
||||
if (recordLastItem && this->m_selectedItems->count() > 0) {
|
||||
this->m_lastItem = this->m_selectedItems->last();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::clearSelectedItems(bool clearLast)
|
||||
{
|
||||
this->m_selectedItems->clear();
|
||||
if (clearLast) {
|
||||
this->m_lastItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::refreshFileSystemItems(QList<FileSystemListItem*> items)
|
||||
{
|
||||
QList<FileSystemListItem*> *allItems = new QList<FileSystemListItem*>();
|
||||
FileSystemListItem *newLastItem = NULL;
|
||||
|
||||
for (FileSystemListItem *item:items) {
|
||||
for (FileSystemListItem *selectionItem:*this->m_selectedItems) {
|
||||
if (item->isSameItem(selectionItem)) {
|
||||
allItems->append(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->m_lastItem != NULL) {
|
||||
for (FileSystemListItem *item:items) {
|
||||
if (item->isSameItem(this->m_lastItem)) {
|
||||
newLastItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearItems();
|
||||
this->m_listItems->append(items);
|
||||
|
||||
clearSelectedItems();
|
||||
addSelectedItems(*allItems, false);
|
||||
|
||||
this->m_lastItem = newLastItem;
|
||||
this->m_offSet = setOffset(this->m_offSet);
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
void FileSystemListWidget::leaveEvent(QEvent * event)
|
||||
{
|
||||
hideScrollbar();
|
||||
QWidget::leaveEvent(event);
|
||||
}
|
||||
|
||||
void FileSystemListWidget::hideScrollbar()
|
||||
{
|
||||
this->m_mouseAtScrollArea = false;
|
||||
this->m_origOffset = this->m_offSet;
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
void FileSystemListWidget::mouseMoveEvent(QMouseEvent *mouseEvent)
|
||||
{
|
||||
if (this->m_mouseDragScrollbar) {
|
||||
this->m_offSet = setOffset((mouseEvent->y() - getScrollbarHeight() / 2 - this->m_titleHeight) / (getTheScrollAreaHeight() * 1.0) * this->getItemsTotalHeight());
|
||||
repaint();
|
||||
}
|
||||
else if (mouseAtScrollArea(mouseEvent->x()) != this->m_mouseAtScrollArea) {
|
||||
this->m_mouseAtScrollArea = mouseAtScrollArea(mouseEvent->x());
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
bool isTitleArea = mouseAtTitleArea(event->y());
|
||||
bool isScrollArea = mouseAtScrollArea(event->x());
|
||||
if (!isTitleArea && !isScrollArea) {
|
||||
int pressedItemIndex = (this->m_offSet + event->y() - this->m_titleHeight) / this->m_rowHeight;
|
||||
if (pressedItemIndex >= this->m_listItems->count()) {
|
||||
clearSelectedItems();
|
||||
repaint();
|
||||
}
|
||||
else {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
FileSystemListItem *pressItem = (*this->m_listItems)[pressedItemIndex];
|
||||
bool pressInSelectionArea = false;
|
||||
for (FileSystemListItem *item : *this->m_selectedItems) {
|
||||
if (item == pressItem) {
|
||||
pressInSelectionArea = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pressInSelectionArea) {
|
||||
//open the mount dir
|
||||
FileSystemListItem *procItem = static_cast<FileSystemListItem*>(pressItem);
|
||||
QString targetPath = QString("file://%1").arg(procItem->getDirectory());
|
||||
QDesktopServices::openUrl(QUrl(targetPath));//xdg-open
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void FileSystemListWidget::mousePressEvent(QMouseEvent *mouseEvent)
|
||||
{
|
||||
setFocus();
|
||||
|
||||
bool isTitleArea = mouseAtTitleArea(mouseEvent->y());
|
||||
bool isScrollArea = mouseAtScrollArea(mouseEvent->x());
|
||||
|
||||
if (isTitleArea) {//点击列表的标题栏区域
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
if (m_columnVisibles.count() == this->columnTitles.count()) {
|
||||
QMenu *menu = new QMenu();
|
||||
menu->setObjectName("MonitorMenu");
|
||||
for (int i = 0; i < m_columnVisibles.count(); i++) {
|
||||
if (i != 0) {//让第一行总是显示,不可以设置显示或者不显示,其他行可以设置
|
||||
QAction *action = new QAction(menu);
|
||||
action->setText(this->columnTitles[i]);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(m_columnVisibles[i]);
|
||||
connect(action, &QAction::triggered, this, [this, action, i] {
|
||||
m_columnVisibles[i] = !m_columnVisibles[i];
|
||||
emit this->changeColumnVisible(i, m_columnVisibles[i], m_columnVisibles);
|
||||
repaint();
|
||||
});
|
||||
menu->addAction(action);
|
||||
}
|
||||
}
|
||||
menu->exec(this->mapToGlobal(mouseEvent->pos()));
|
||||
delete menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isScrollArea) {//点击滚动条区域
|
||||
int barHeight = getScrollbarHeight();
|
||||
int barY = getScrollbarY();
|
||||
if (mouseEvent->y() > barY && mouseEvent->y() < barY + barHeight) {
|
||||
this->m_mouseDragScrollbar = true;
|
||||
}
|
||||
else {
|
||||
this->m_offSet = setOffset((mouseEvent->y() - barHeight / 2 - this->m_titleHeight) / (getTheScrollAreaHeight() * 1.0) * this->getItemsTotalHeight());
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
else {
|
||||
int pressedItemIndex = (this->m_offSet + mouseEvent->y() - this->m_titleHeight) / this->m_rowHeight;
|
||||
if (pressedItemIndex >= this->m_listItems->count()) {
|
||||
clearSelectedItems();
|
||||
repaint();
|
||||
}
|
||||
else {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
if (pressedItemIndex < this->m_listItems->count()) {
|
||||
if (mouseEvent->modifiers() == Qt::ControlModifier) {
|
||||
FileSystemListItem *item = (*this->m_listItems)[pressedItemIndex];
|
||||
if (this->m_selectedItems->contains(item)) {
|
||||
this->m_selectedItems->removeOne(item);
|
||||
} else {
|
||||
QList<FileSystemListItem*> items = QList<FileSystemListItem*>();
|
||||
items << item;
|
||||
addSelectedItems(items);
|
||||
}
|
||||
}
|
||||
else {
|
||||
clearSelectedItems();
|
||||
QList<FileSystemListItem*> items = QList<FileSystemListItem*>();
|
||||
items << (*this->m_listItems)[pressedItemIndex];
|
||||
addSelectedItems(items);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
else if (mouseEvent->button() == Qt::RightButton) {
|
||||
FileSystemListItem *pressItem = (*this->m_listItems)[pressedItemIndex];
|
||||
bool pressInSelectionArea = false;
|
||||
for (FileSystemListItem *item : *this->m_selectedItems) {
|
||||
if (item == pressItem) {
|
||||
pressInSelectionArea = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pressInSelectionArea) {
|
||||
emit this->rightMouseClickedItem(this->mapToGlobal(mouseEvent->pos()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::mouseReleaseEvent(QMouseEvent *)
|
||||
{
|
||||
if (this->m_mouseDragScrollbar) {
|
||||
this->m_mouseDragScrollbar = false;
|
||||
repaint();
|
||||
}
|
||||
else {
|
||||
if (this->m_titlePressColumn != -1) {
|
||||
this->m_titlePressColumn = -1;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (event->orientation() == Qt::Vertical) {
|
||||
this->m_origOffset = this->m_offSet;
|
||||
qreal scrollStep = event->angleDelta().y() / 100.0;
|
||||
this->m_offSet = setOffset(this->m_offSet - scrollStep * this->m_rowHeight);
|
||||
repaint();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void FileSystemListWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
QList<int> titleItemsWidths = getTitleItemsWidths();
|
||||
|
||||
painter.setOpacity(0.05);
|
||||
|
||||
int penWidth = 1;
|
||||
QPainterPath framePath;
|
||||
framePath.addRoundedRect(QRect(rect().x() + penWidth, rect().y() + penWidth, rect().width() - penWidth * 2, rect().height() - penWidth * 2), 5, 5);//背景弧度
|
||||
painter.setClipPath(framePath);
|
||||
|
||||
//标题的背景
|
||||
if (this->m_titleHeight > 0) {
|
||||
QPainterPath titlePath;
|
||||
titlePath.addRect(QRectF(rect().x(), rect().y(), rect().width(), this->m_titleHeight));
|
||||
painter.setOpacity(0.02);
|
||||
painter.fillPath(titlePath, QColor("#ffffff"));
|
||||
}
|
||||
|
||||
int title_Y = 0;
|
||||
int title_Height = 0;
|
||||
if (this->m_titleHeight > 0) {
|
||||
int counter = 0;
|
||||
int posX = 0;
|
||||
for (int itemWidth:titleItemsWidths) {
|
||||
if (itemWidth > 0) {
|
||||
//标题文字
|
||||
painter.setOpacity(1);
|
||||
QFont font = painter.font();
|
||||
font.setPixelSize(12);
|
||||
painter.setFont(font);
|
||||
painter.setPen(QPen(QColor("#999999")));
|
||||
|
||||
if (this->columnTitles[counter] == tr("Device") || this->columnTitles[counter] == tr("Directory") || this->columnTitles[counter] == tr("Used"))
|
||||
painter.drawText(QRect(posX + this->m_titlePadding, 0, itemWidth, this->m_titleHeight), Qt::AlignBottom | Qt::AlignLeft, this->columnTitles[counter]);
|
||||
else
|
||||
painter.drawText(QRect(posX, 0, itemWidth - this->m_titlePadding, this->m_titleHeight), Qt::AlignBottom | Qt::AlignRight, this->columnTitles[counter]);
|
||||
|
||||
//水平下划线
|
||||
painter.setOpacity(0.8);
|
||||
QPainterPath h_separatorPath;
|
||||
h_separatorPath.addRect(QRectF(posX, rect().y() + this->m_titleHeight - 1, itemWidth, 1));
|
||||
painter.fillPath(h_separatorPath, QColor("#e0e0e0"));
|
||||
|
||||
if (counter < titleItemsWidths.size()) {//垂直分割线
|
||||
QPainterPath v_separatorPath;
|
||||
v_separatorPath.addRect(QRectF(rect().x() + posX - 1, rect().y() + 5, 1, this->m_titleHeight - 5));
|
||||
painter.fillPath(v_separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
|
||||
posX += itemWidth;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
title_Y += this->m_titleHeight;
|
||||
title_Height += this->m_titleHeight;
|
||||
}
|
||||
|
||||
//去掉列表标题栏后的列表显示区域的背景
|
||||
painter.setOpacity(0.05);
|
||||
QPainterPath backgroundPath;
|
||||
backgroundPath.addRect(QRectF(rect().x(), rect().y() + this->m_titleHeight, rect().width(), rect().height() - this->m_titleHeight));
|
||||
painter.fillPath(backgroundPath, QColor("#ffffff"));
|
||||
|
||||
//挂载的磁盘文件系统信息
|
||||
QPainterPath scrollAreaPath;
|
||||
scrollAreaPath.addRect(QRectF(rect().x(), rect().y() + this->m_titleHeight, rect().width(), getTheScrollAreaHeight()));
|
||||
|
||||
int rowCounter = 0;
|
||||
for (FileSystemListItem *item:*this->m_listItems) {
|
||||
if (rowCounter > ((this->m_offSet - this->m_rowHeight) / this->m_rowHeight)) {
|
||||
QPainterPath itemPath;
|
||||
itemPath.addRect(QRect(0, title_Y + rowCounter * this->m_rowHeight - this->m_offSet, rect().width(), this->m_rowHeight));
|
||||
painter.setClipPath((framePath.intersected(scrollAreaPath)).intersected(itemPath));
|
||||
|
||||
bool isSelect = this->m_selectedItems->contains(item);
|
||||
painter.save();
|
||||
item->drawBackground(QRect(0, title_Y + rowCounter * this->m_rowHeight - this->m_offSet, rect().width(), this->m_rowHeight), &painter, rowCounter, isSelect);
|
||||
painter.restore();
|
||||
|
||||
int columnCounter = 0;
|
||||
int columnTitleX = 0;
|
||||
for (int titleItemWidth : titleItemsWidths) {
|
||||
if (titleItemWidth > 0) {
|
||||
painter.save();
|
||||
if (columnCounter < titleItemsWidths.size() - 1)
|
||||
item->drawForeground(QRect(columnTitleX, title_Y + rowCounter * this->m_rowHeight - this->m_offSet, titleItemWidth, this->m_rowHeight), &painter, columnCounter, rowCounter, isSelect, true);
|
||||
else
|
||||
item->drawForeground(QRect(columnTitleX, title_Y + rowCounter * this->m_rowHeight - this->m_offSet, titleItemWidth, this->m_rowHeight), &painter, columnCounter, rowCounter, isSelect, false);
|
||||
painter.restore();
|
||||
columnTitleX += titleItemWidth;
|
||||
}
|
||||
columnCounter++;
|
||||
}
|
||||
title_Height += this->m_rowHeight;
|
||||
if (title_Height > rect().height()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
rowCounter++;
|
||||
}
|
||||
painter.setClipPath(framePath);
|
||||
|
||||
//没有挂载的磁盘文件系统信息时绘制提示文字
|
||||
if (this->m_listItems->size() == 0) {
|
||||
painter.setOpacity(1);
|
||||
painter.setPen(QPen(QColor("#666666")));
|
||||
QFont font = painter.font() ;
|
||||
font.setPointSize(22);
|
||||
painter.setFont(font);
|
||||
painter.drawText(QRect(rect().x(), rect().y() + this->m_titleHeight, rect().width(), rect().height() - this->m_titleHeight), Qt::AlignCenter, tr("No File System Info"));
|
||||
}
|
||||
|
||||
//背景
|
||||
// QPen framePen;
|
||||
// framePen.setColor(QColor("#F5F5F5"));
|
||||
// painter.setPen(framePen);
|
||||
painter.setOpacity(0.2);
|
||||
painter.drawPath(framePath);
|
||||
|
||||
//垂直滚动条
|
||||
if (this->m_mouseAtScrollArea) {
|
||||
paintScrollbar(&painter);
|
||||
} else if (this->m_origOffset != this->m_offSet) {
|
||||
paintScrollbar(&painter);
|
||||
readyToHideScrollbar();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::paintScrollbar(QPainter *painter)
|
||||
{
|
||||
if (this->getItemsTotalHeight() > getTheScrollAreaHeight()) {
|
||||
qreal opacitry = 0;
|
||||
if (this->m_mouseDragScrollbar) {
|
||||
opacitry = 0.8;
|
||||
}
|
||||
else {
|
||||
if (this->m_mouseAtScrollArea)
|
||||
opacitry = 0.7;
|
||||
else
|
||||
opacitry = 0.5;
|
||||
}
|
||||
|
||||
int barWidth = (this->m_mouseAtScrollArea || this->m_mouseDragScrollbar) ? this->m_scrollbarWidth : 6;
|
||||
int barY = getScrollbarY();
|
||||
int barHeight = getScrollbarHeight();
|
||||
painter->setOpacity(opacitry);
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(
|
||||
QRectF(rect().x() + rect().width() - barWidth - 4, barY + 2, barWidth, barHeight - 2 * 2), 2, 2);//2 is radius
|
||||
painter->fillPath(path, QColor("#0B95D7"));
|
||||
|
||||
QPen pen;
|
||||
pen.setColor(QColor("#0B95D7"));
|
||||
pen.setWidth(1);
|
||||
painter->setOpacity(0);
|
||||
painter->setPen(pen);
|
||||
painter->drawPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
QList<int> FileSystemListWidget::getTitleItemsWidths()
|
||||
{
|
||||
QList<int> titleItemsWidths;
|
||||
if (this->m_columnWidths.length() > 0) {
|
||||
if (this->m_columnWidths.contains(-1)) {
|
||||
for (int i = 0; i < this->m_columnWidths.count(); i++) {
|
||||
if (this->m_columnWidths[i] != -1) {
|
||||
if (m_columnVisibles[i]) {
|
||||
titleItemsWidths << this->m_columnWidths[i];
|
||||
} else {
|
||||
titleItemsWidths << 0;
|
||||
}
|
||||
} else {
|
||||
if (m_columnVisibles[i]) {
|
||||
int totalWidth = 0;
|
||||
for (int j = 0; j < this->m_columnWidths.count(); j++) {
|
||||
if (this->m_columnWidths[j] != -1 && m_columnVisibles[j]) {
|
||||
totalWidth += this->m_columnWidths[j];
|
||||
}
|
||||
}
|
||||
titleItemsWidths << rect().width() - totalWidth;
|
||||
}
|
||||
else {
|
||||
titleItemsWidths << 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < this->m_columnWidths.count(); i++) {
|
||||
if (m_columnVisibles[i]) {
|
||||
titleItemsWidths << this->m_columnWidths[i];
|
||||
}
|
||||
else {
|
||||
titleItemsWidths << 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
titleItemsWidths << rect().width();
|
||||
}
|
||||
|
||||
return titleItemsWidths;
|
||||
}
|
||||
|
||||
bool FileSystemListWidget::mouseAtScrollArea(int x)
|
||||
{
|
||||
return (x > rect().x() + rect().width() - this->m_scrollbarWidth) && (x < rect().x() + rect().width());
|
||||
}
|
||||
|
||||
bool FileSystemListWidget::mouseAtTitleArea(int y)
|
||||
{
|
||||
return (y > rect().y() && y < rect().y() + this->m_titleHeight);
|
||||
}
|
||||
|
||||
int FileSystemListWidget::setOffset(int offset)
|
||||
{
|
||||
return std::max(0, std::min(offset, getBottomOffset()));
|
||||
}
|
||||
|
||||
int FileSystemListWidget::getItemsTotalHeight()
|
||||
{
|
||||
return m_listItems->count() * m_rowHeight;
|
||||
}
|
||||
|
||||
int FileSystemListWidget::getTheScrollAreaHeight()
|
||||
{
|
||||
return this->rect().height() - this->m_titleHeight;
|
||||
}
|
||||
|
||||
int FileSystemListWidget::getScrollbarY()
|
||||
{
|
||||
return static_cast<int>((this->m_offSet / (this->getItemsTotalHeight() * 1.0)) * getTheScrollAreaHeight() + this->m_titleHeight);
|
||||
}
|
||||
|
||||
int FileSystemListWidget::getScrollbarHeight()
|
||||
{
|
||||
return std::max(static_cast<int>(getTheScrollAreaHeight() / (this->getItemsTotalHeight() * 1.0) * rect().height()), 30);//30 is min height
|
||||
}
|
||||
|
||||
int FileSystemListWidget::getBottomOffset()
|
||||
{
|
||||
int itemsHeight = this->getItemsTotalHeight();
|
||||
if (itemsHeight > rect().height() - this->m_titleHeight) {
|
||||
return this->getItemsTotalHeight() - rect().height() + this->m_titleHeight;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemListWidget::readyToHideScrollbar()
|
||||
{
|
||||
if (this->m_hideScrollbarTimer) {
|
||||
if (this->m_hideScrollbarTimer->isActive())
|
||||
this->m_hideScrollbarTimer->stop();
|
||||
}
|
||||
else {
|
||||
this->m_hideScrollbarTimer = new QTimer();
|
||||
this->m_hideScrollbarTimer->setSingleShot(true);
|
||||
connect(this->m_hideScrollbarTimer, SIGNAL(timeout()), this, SLOT(hideScrollbar()));
|
||||
}
|
||||
this->m_hideScrollbarTimer->start(2000);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2013 ~ 2018 National University of Defense Technology(NUDT) & Tianjin Kylin Ltd.
|
||||
*
|
||||
* Authors:
|
||||
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 3.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FILESYSTEMLISTWIDGET_H
|
||||
#define FILESYSTEMLISTWIDGET_H
|
||||
|
||||
#include "filesystemlistitem.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QPixmap>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
class FileSystemListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileSystemListWidget(QList<bool> toBeDisplayedColumns, QWidget *parent = 0);
|
||||
~FileSystemListWidget();
|
||||
|
||||
void readyToHideScrollbar();
|
||||
void clearItems();
|
||||
void addSelectedItems(QList<FileSystemListItem*> items, bool recordLastItem=true);
|
||||
void clearSelectedItems(bool clearLast=true);
|
||||
void refreshFileSystemItems(QList<FileSystemListItem*> items);
|
||||
|
||||
int getItemsTotalHeight();
|
||||
int getBottomOffset();
|
||||
int getScrollbarY();
|
||||
int getScrollbarHeight();
|
||||
int getTheScrollAreaHeight();
|
||||
|
||||
QList<int> getTitleItemsWidths();
|
||||
|
||||
int setOffset(int offset);
|
||||
|
||||
bool mouseAtScrollArea(int x);
|
||||
bool mouseAtTitleArea(int y);
|
||||
|
||||
signals:
|
||||
void rightMouseClickedItem(QPoint pos);
|
||||
void changeColumnVisible(int index, bool visible, QList<bool> columnVisible);
|
||||
|
||||
public slots:
|
||||
void hideScrollbar();
|
||||
|
||||
protected:
|
||||
virtual void leaveEvent(QEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *mouseEvent);
|
||||
void mousePressEvent(QMouseEvent *mouseEvent);
|
||||
void mouseReleaseEvent(QMouseEvent *mouseEvent);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void paintScrollbar(QPainter *painter);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QTimer *m_hideScrollbarTimer = nullptr;
|
||||
// SearchFunction m_searchFunc;
|
||||
|
||||
FileSystemListItem *m_lastItem = nullptr;
|
||||
QList<FileSystemListItem*> *m_listItems;
|
||||
QList<FileSystemListItem*> *m_selectedItems;
|
||||
QList<QString> columnTitles;
|
||||
QList<int> m_columnWidths;
|
||||
QList<bool> m_columnVisibles;
|
||||
|
||||
bool m_mouseAtScrollArea;
|
||||
bool m_mouseDragScrollbar;
|
||||
int m_origOffset;
|
||||
int m_offSet;
|
||||
int m_rowHeight;
|
||||
int m_scrollbarWidth;
|
||||
int m_titleHeight;
|
||||
int m_titleHoverColumn;
|
||||
int m_titlePadding;
|
||||
int m_titlePressColumn;
|
||||
};
|
||||
|
||||
#endif // PROCESSLISTWIDGET_H
|
|
@ -18,14 +18,16 @@
|
|||
*/
|
||||
|
||||
#include "filesystemworker.h"
|
||||
#include "diskinfo.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <glibtop/mountlist.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
/*For PRIu64*/
|
||||
#include <inttypes.h>
|
||||
|
||||
//extern "C" {
|
||||
//#include <gio/gio.h>
|
||||
//}
|
||||
|
||||
typedef struct _DISK_INFO
|
||||
{
|
||||
|
@ -34,6 +36,7 @@ typedef struct _DISK_INFO
|
|||
char type[256];
|
||||
gint percentage;
|
||||
guint64 btotal;
|
||||
guint64 bfree;
|
||||
guint64 bavail;
|
||||
guint64 bused;
|
||||
gint valid;
|
||||
|
@ -85,6 +88,7 @@ DISK_INFO add_disk(const glibtop_mountentry *entry, gboolean show_all_fs)
|
|||
memcpy(disk.type, entry->type, strlen(entry->type));
|
||||
disk.percentage = percentage;
|
||||
disk.btotal = btotal;
|
||||
disk.bfree = bfree;
|
||||
disk.bavail = bavail;
|
||||
disk.bused = bused;
|
||||
disk.valid = 1;
|
||||
|
@ -103,11 +107,9 @@ DISK_INFO add_disk(const glibtop_mountentry *entry, gboolean show_all_fs)
|
|||
// g_print ("Hello World\n");
|
||||
//}
|
||||
|
||||
FileSystemWorker::FileSystemWorker(DiskModel *diskList, QObject *parent)
|
||||
FileSystemWorker::FileSystemWorker(QObject *parent)
|
||||
: QObject(parent)
|
||||
,m_diskModel(diskList)
|
||||
{
|
||||
onFileSystemListChanged();
|
||||
// GVolumeMonitor * monitor;//GVolumeMonitor不是 thread-default-context aware,因此不能在除了主线程中的其他地方使用????
|
||||
// monitor = g_volume_monitor_get();
|
||||
// g_signal_connect(monitor, "mount-added", G_CALLBACK(hello), NULL);
|
||||
|
@ -125,8 +127,14 @@ FileSystemWorker::FileSystemWorker(DiskModel *diskList, QObject *parent)
|
|||
// }
|
||||
}
|
||||
|
||||
FileSystemWorker::~FileSystemWorker()
|
||||
{
|
||||
m_diskInfoList.clear();
|
||||
}
|
||||
|
||||
void FileSystemWorker::onFileSystemListChanged()
|
||||
{
|
||||
QStringList newDiskList;
|
||||
glibtop_mountentry *entries;
|
||||
glibtop_mountlist mountlist;
|
||||
guint i;
|
||||
|
@ -136,27 +144,65 @@ void FileSystemWorker::onFileSystemListChanged()
|
|||
DISK_INFO disk = add_disk(&entries[i], show_all_fs);
|
||||
if (disk.valid == 1) {
|
||||
QString dev_name = QString(QLatin1String(disk.devname));
|
||||
if (!m_diskModel->contains(dev_name)) {
|
||||
DiskInfo *info = new DiskInfo(this);
|
||||
newDiskList.append(dev_name);
|
||||
|
||||
if (!this->isDeviceContains(dev_name)) {
|
||||
FileSystemData *info = new FileSystemData(this);
|
||||
info->setDevName(dev_name);
|
||||
info->setOtherDiskInfo(QString(QLatin1String(disk.mountdir)), QString(QLatin1String(disk.type)), QString(QLatin1String(g_format_size_full(disk.btotal, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bavail, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bused, G_FORMAT_SIZE_DEFAULT))), QString::number(disk.percentage).append("%"));
|
||||
m_diskModel->addDiskInfo(dev_name, info);
|
||||
info->updateDiskInfo(QString(QLatin1String(disk.mountdir)), QString(QLatin1String(disk.type)), QString(QLatin1String(g_format_size_full(disk.btotal, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bfree, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bavail, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bused, G_FORMAT_SIZE_DEFAULT))), disk.percentage/*QString::number(disk.percentage).append("%")*/);
|
||||
this->addDiskInfo(dev_name, info);
|
||||
}
|
||||
else {//update info which had exists
|
||||
DiskInfo *info = m_diskModel->getDiskInfo(dev_name);
|
||||
FileSystemData *info = this->getDiskInfo(dev_name);
|
||||
if (info) {
|
||||
info->setOtherDiskInfo(QString(QLatin1String(disk.mountdir)), QString(QLatin1String(disk.type)), QString(QLatin1String(g_format_size_full(disk.btotal, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bavail, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bused, G_FORMAT_SIZE_DEFAULT))), QString::number(disk.percentage).append("%"));
|
||||
info->updateDiskInfo(QString(QLatin1String(disk.mountdir)), QString(QLatin1String(disk.type)), QString(QLatin1String(g_format_size_full(disk.btotal, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bfree, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bavail, G_FORMAT_SIZE_DEFAULT))), QString(QLatin1String(g_format_size_full(disk.bused, G_FORMAT_SIZE_DEFAULT))), disk.percentage/*QString::number(disk.percentage).append("%")*/);
|
||||
}
|
||||
// for (DiskInfo *info : m_diskModel->diskInfoList()) {
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove the device whice not exists anymore
|
||||
for (auto device : m_diskInfoList.keys()) {
|
||||
bool foundDevice = false;
|
||||
for (auto devName : newDiskList) {
|
||||
if (devName == device) {
|
||||
foundDevice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundDevice) {
|
||||
m_diskInfoList.remove(device);//or erase???
|
||||
}
|
||||
}
|
||||
|
||||
g_free(entries);
|
||||
}
|
||||
|
||||
FileSystemData *FileSystemWorker::getDiskInfo(const QString &devname)
|
||||
{
|
||||
return m_diskInfoList.value(devname, nullptr);
|
||||
}
|
||||
|
||||
QList<FileSystemData *> FileSystemWorker::diskInfoList() const
|
||||
{
|
||||
return m_diskInfoList.values();
|
||||
}
|
||||
|
||||
void FileSystemWorker::addDiskInfo(const QString &devname, FileSystemData *info)
|
||||
{
|
||||
if (!m_diskInfoList.contains(devname)) {
|
||||
m_diskInfoList[devname] = info;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemWorker::removeDiskItem(const QString &devname)
|
||||
{
|
||||
m_diskModel->removeDiskInfo(devname);
|
||||
// FileSystemData *info = getDiskInfo(devname);
|
||||
// m_diskInfoList.remove(devname);
|
||||
}
|
||||
|
||||
bool FileSystemWorker::isDeviceContains(const QString &devname)
|
||||
{
|
||||
return m_diskInfoList.contains(devname);
|
||||
}
|
||||
|
|
|
@ -22,25 +22,33 @@
|
|||
#define FILESYSTEMWORKER_H
|
||||
|
||||
#include <QObject>
|
||||
#include "diskinfo.h"
|
||||
#include "diskmodel.h"
|
||||
#include <QMap>
|
||||
|
||||
#include "filesystemdata.h"
|
||||
|
||||
class FileSystemWorker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileSystemWorker(DiskModel *diskList, QObject *parent = 0);
|
||||
explicit FileSystemWorker(QObject *parent = 0);
|
||||
~FileSystemWorker();
|
||||
|
||||
void removeDiskItem(const QString &devname);
|
||||
|
||||
FileSystemData *getDiskInfo(const QString &devname);
|
||||
QList<FileSystemData *> diskInfoList() const;
|
||||
void addDiskInfo(const QString &devname, FileSystemData *info);
|
||||
void removeDiskInfo(const QString &devname);
|
||||
bool isDeviceContains(const QString &devname);
|
||||
|
||||
public slots:
|
||||
void onFileSystemListChanged();
|
||||
void removeUserByName(const QString &name);
|
||||
|
||||
|
||||
private:
|
||||
DiskModel *m_diskModel;
|
||||
QMap<QString, FileSystemData *> m_diskInfoList;
|
||||
// QMap<QString, bool> *processSentBytes;
|
||||
};
|
||||
|
||||
#endif // FILESYSTEMWORKER_H
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
ProcessListItem::ProcessListItem(ProcData info)
|
||||
{
|
||||
m_data = info;
|
||||
iconSize = 24;
|
||||
iconSize = 16;
|
||||
padding = 14;
|
||||
textPadding = 5;
|
||||
}
|
||||
|
@ -63,11 +63,12 @@ void ProcessListItem::drawBackground(QRect rect, QPainter *painter, int index, b
|
|||
}
|
||||
else {
|
||||
painter->setOpacity(1);
|
||||
if (index % 2 == 0) {
|
||||
painter->fillPath(path, QColor("#ffffff"));
|
||||
} else {
|
||||
painter->fillPath(path, QColor("#e9eef0"));
|
||||
}
|
||||
painter->fillPath(path, QColor("#ffffff"));
|
||||
// if (index % 2 == 0) {
|
||||
// painter->fillPath(path, QColor("#ffffff"));
|
||||
// } else {
|
||||
// painter->fillPath(path, QColor("#e9eef0"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,6 +139,12 @@ void ProcessListItem::drawForeground(QRect rect, QPainter *painter, int column,
|
|||
this->drawCellBackground(QRect(rect.x(), rect.y(), rect.width(), rect.height()), painter, 2);
|
||||
}
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - textPadding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, QString("%1%").arg(m_data.cpu));
|
||||
if (isSeparator) {
|
||||
painter->setOpacity(0.8);
|
||||
QPainterPath separatorPath;
|
||||
separatorPath.addRect(QRectF(rect.x() + rect.width() - 1, rect.y(), 1, rect.height()));
|
||||
painter->fillPath(separatorPath, QColor("#e0e0e0"));
|
||||
}
|
||||
}
|
||||
else if (column == 4) {
|
||||
painter->drawText(QRect(rect.x(), rect.y(), rect.width() - padding, rect.height()), Qt::AlignRight | Qt::AlignVCenter, QString("%1").arg(m_data.pid));
|
||||
|
|
|
@ -616,7 +616,8 @@ void ProcessListWidget::mousePressEvent(QMouseEvent *mouseEvent)
|
|||
clearSelectedItems();
|
||||
|
||||
repaint();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
if (pressedItemIndex < this->m_searchedItems->count()) {
|
||||
if (mouseEvent->modifiers() == Qt::ControlModifier) {
|
||||
|
@ -644,7 +645,8 @@ void ProcessListWidget::mousePressEvent(QMouseEvent *mouseEvent)
|
|||
}
|
||||
repaint();
|
||||
}
|
||||
} else if (mouseEvent->button() == Qt::RightButton) {
|
||||
}
|
||||
else if (mouseEvent->button() == Qt::RightButton) {
|
||||
ProcessListItem *pressItem = (*this->m_searchedItems)[pressedItemIndex];
|
||||
bool pressInSelectionArea = false;
|
||||
for (ProcessListItem *item : *this->m_selectedItems) {
|
||||
|
|
|
@ -36,12 +36,10 @@ class ProcessListWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
~ProcessListWidget();
|
||||
ProcessListWidget(QList<bool> toBeDisplayedColumns, QWidget *parent = 0);
|
||||
~ProcessListWidget();
|
||||
|
||||
void readyToHideScrollbar();
|
||||
|
||||
void setProcessSortFunctions(QList<SortFunction> *list, int sortColumn=-1, bool isSort=false);
|
||||
void setSearchFunction(SearchFunction func);
|
||||
void addItems(QList<ProcessListItem*> items);
|
||||
|
|
|
@ -102,7 +102,7 @@ void SystemMonitor::resizeEvent(QResizeEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
void SystemMonitor::recordVisibleColumn(int, bool, QList<bool> columnVisible)
|
||||
void SystemMonitor::recordProcessVisibleColumn(int, bool, QList<bool> columnVisible)
|
||||
{
|
||||
QList<QString> m_visibleColumns;
|
||||
m_visibleColumns << "name";
|
||||
|
@ -161,6 +161,50 @@ void SystemMonitor::recordSortStatus(int index, bool isSort)
|
|||
proSettings->sync();
|
||||
}
|
||||
|
||||
void SystemMonitor::recordFileSysVisibleColumn(int, bool, QList<bool> columnVisible)
|
||||
{
|
||||
QList<QString> m_visibleColumns;
|
||||
m_visibleColumns << "device";
|
||||
|
||||
if (columnVisible[1]) {
|
||||
m_visibleColumns << "directory";
|
||||
}
|
||||
|
||||
if (columnVisible[2]) {
|
||||
m_visibleColumns << "type";
|
||||
}
|
||||
|
||||
if (columnVisible[3]) {
|
||||
m_visibleColumns << "total";
|
||||
}
|
||||
|
||||
if (columnVisible[4]) {
|
||||
m_visibleColumns << "free";
|
||||
}
|
||||
|
||||
if (columnVisible[5]) {
|
||||
m_visibleColumns << "available";
|
||||
}
|
||||
|
||||
if (columnVisible[6]) {
|
||||
m_visibleColumns << "used";
|
||||
}
|
||||
|
||||
QString displayedColumns = "";
|
||||
for (int i = 0; i < m_visibleColumns.length(); i++) {
|
||||
if (i != m_visibleColumns.length() - 1) {
|
||||
displayedColumns += QString("%1,").arg(m_visibleColumns[i]);
|
||||
} else {
|
||||
displayedColumns += m_visibleColumns[i];
|
||||
}
|
||||
}
|
||||
|
||||
proSettings->beginGroup("FileSystem");
|
||||
proSettings->setValue("DisplayedColumns", displayedColumns);
|
||||
proSettings->endGroup();
|
||||
proSettings->sync();
|
||||
}
|
||||
|
||||
void SystemMonitor::initPanelStack()
|
||||
{
|
||||
m_sysMonitorStack = new QStackedWidget(this);
|
||||
|
@ -172,13 +216,16 @@ void SystemMonitor::initPanelStack()
|
|||
m_sysMonitorStack->setMouseTracking(false);
|
||||
m_sysMonitorStack->installEventFilter(this);
|
||||
|
||||
process_dialog = new ProcessDialog(getReadyDisplayColumns(), getCurrentSortColumnIndex(), isSortOrNot(), proSettings);
|
||||
process_dialog = new ProcessDialog(getReadyDisplayProcessColumns(), getCurrentSortColumnIndex(), isSortOrNot(), proSettings);
|
||||
process_dialog->getProcessView()->installEventFilter(this);
|
||||
connect(process_dialog, &ProcessDialog::changeColumnVisible, this, &SystemMonitor::recordVisibleColumn);
|
||||
connect(process_dialog, &ProcessDialog::changeColumnVisible, this, &SystemMonitor::recordProcessVisibleColumn);
|
||||
connect(process_dialog, &ProcessDialog::changeSortStatus, this, &SystemMonitor::recordSortStatus);
|
||||
|
||||
resources_dialog = new ResouresDialog;
|
||||
filesystem_dialog = new FileSystemDialog;
|
||||
|
||||
filesystem_dialog = new FileSystemDialog(getReadyDisplayFileSysColumns(), proSettings);
|
||||
filesystem_dialog->getFileSysView()->installEventFilter(this);
|
||||
connect(filesystem_dialog, SIGNAL(changeColumnVisible(int,bool,QList<bool>)), this, SLOT(recordFileSysVisibleColumn(int,bool,QList<bool>)));
|
||||
|
||||
m_sysMonitorStack->addWidget(process_dialog);
|
||||
m_sysMonitorStack->addWidget(resources_dialog);
|
||||
|
@ -235,7 +282,7 @@ bool SystemMonitor::isSortOrNot()
|
|||
return value;
|
||||
}
|
||||
|
||||
QList<bool> SystemMonitor::getReadyDisplayColumns()
|
||||
QList<bool> SystemMonitor::getReadyDisplayProcessColumns()
|
||||
{
|
||||
proSettings->beginGroup("PROCESS");
|
||||
QString displayedColumns = proSettings->value("DisplayedColumns", "name,user,status,cpu,pid,command,memory,priority").toString();
|
||||
|
@ -262,6 +309,32 @@ QList<bool> SystemMonitor::getReadyDisplayColumns()
|
|||
return m_shows;
|
||||
}
|
||||
|
||||
QList<bool> SystemMonitor::getReadyDisplayFileSysColumns()
|
||||
{
|
||||
proSettings->beginGroup("FileSystem");
|
||||
QString displayedColumns = proSettings->value("DisplayedColumns", "device,directory,type,total,free,available,used").toString();
|
||||
proSettings->endGroup();
|
||||
|
||||
if (displayedColumns.isEmpty()) {
|
||||
proSettings->beginGroup("FileSystem");
|
||||
displayedColumns = "device,directory,type,total,free,available,used";
|
||||
proSettings->setValue("DisplayedColumns", displayedColumns);
|
||||
proSettings->endGroup();
|
||||
proSettings->sync();
|
||||
}
|
||||
|
||||
QList<bool> m_shows;
|
||||
m_shows << displayedColumns.contains("device");
|
||||
m_shows << displayedColumns.contains("directory");
|
||||
m_shows << displayedColumns.contains("type");
|
||||
m_shows << displayedColumns.contains("total");
|
||||
m_shows << displayedColumns.contains("free");
|
||||
m_shows << displayedColumns.contains("available");
|
||||
m_shows << displayedColumns.contains("used");
|
||||
|
||||
return m_shows;
|
||||
}
|
||||
|
||||
void SystemMonitor::moveCenter()
|
||||
{
|
||||
QPoint pos = QCursor::pos();
|
||||
|
|
|
@ -42,14 +42,18 @@ public:
|
|||
void initPanelStack();
|
||||
void initConnections();
|
||||
|
||||
QList<bool> getReadyDisplayColumns();
|
||||
QList<bool> getReadyDisplayProcessColumns();
|
||||
bool isSortOrNot();
|
||||
int getCurrentSortColumnIndex();
|
||||
|
||||
QList<bool> getReadyDisplayFileSysColumns();
|
||||
|
||||
void moveCenter();
|
||||
|
||||
public slots:
|
||||
void recordVisibleColumn(int, bool, QList<bool> columnVisible);
|
||||
void recordProcessVisibleColumn(int, bool, QList<bool> columnVisible);
|
||||
void recordSortStatus(int index, bool isSort);
|
||||
void recordFileSysVisibleColumn(int, bool, QList<bool> columnVisible);
|
||||
void onChangePage(int index);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -16,6 +16,7 @@ DESTDIR = $$_PRO_FILE_PWD_/../
|
|||
CONFIG += plugin c++11 link_pkgconfig
|
||||
PKGCONFIG += libgtop-2.0 libsystemd
|
||||
#gio-2.0
|
||||
#LIBS +=-lgio-2.0 -lglib-2.0
|
||||
|
||||
target.path = $${PREFIX}/lib/kylin-assistant/plugins/
|
||||
INSTALLS += target
|
||||
|
@ -49,11 +50,8 @@ HEADERS += \
|
|||
monitortitlewidget.h \
|
||||
resourcesdialog.h \
|
||||
filesystemdialog.h \
|
||||
diskitemlist.h \
|
||||
diskitem.h \
|
||||
filesystemworker.h \
|
||||
diskmodel.h \
|
||||
diskinfo.h \
|
||||
filesystemdata.h \
|
||||
../widgets/mysearchedit.h \
|
||||
networkwidget.h \
|
||||
networkflow.h \
|
||||
|
@ -64,7 +62,9 @@ HEADERS += \
|
|||
memorycircle.h \
|
||||
networkindicator.h \
|
||||
resourcesindicator.h \
|
||||
resourcescategory.h
|
||||
resourcescategory.h \
|
||||
filesystemlistwidget.h \
|
||||
filesystemlistitem.h
|
||||
|
||||
SOURCES += \
|
||||
systemmonitor.cpp \
|
||||
|
@ -86,11 +86,8 @@ SOURCES += \
|
|||
monitortitlewidget.cpp \
|
||||
resourcesdialog.cpp \
|
||||
filesystemdialog.cpp \
|
||||
diskitemlist.cpp \
|
||||
diskitem.cpp \
|
||||
filesystemworker.cpp \
|
||||
diskmodel.cpp \
|
||||
diskinfo.cpp \
|
||||
filesystemdata.cpp \
|
||||
../widgets/mysearchedit.cpp \
|
||||
networkwidget.cpp \
|
||||
networkflow.cpp \
|
||||
|
@ -101,7 +98,9 @@ SOURCES += \
|
|||
memorycircle.cpp \
|
||||
networkindicator.cpp \
|
||||
resourcesindicator.cpp \
|
||||
resourcescategory.cpp
|
||||
resourcescategory.cpp \
|
||||
filesystemlistwidget.cpp \
|
||||
filesystemlistitem.cpp
|
||||
|
||||
OTHER_FILES += \
|
||||
systemmonitor.json
|
||||
|
|
|
@ -771,6 +771,60 @@ Kylin Team <ubuntukylin-members@list.launchpad.net></source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemDialog</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemdialog.cpp" line="58"/>
|
||||
<source>Refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Total</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Free</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="433"/>
|
||||
<source>No File System Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FontWidget</name>
|
||||
<message>
|
||||
|
@ -1716,28 +1770,28 @@ Are you sure to continue?</source>
|
|||
<context>
|
||||
<name>ProcessListItem</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="82"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="83"/>
|
||||
<source>Stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="84"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="85"/>
|
||||
<source>Suspend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="86"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="87"/>
|
||||
<source>Zombie</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="88"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="89"/>
|
||||
<source>No response</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="90"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="92"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="91"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="93"/>
|
||||
<source>Uninterruptible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1746,7 +1800,7 @@ Are you sure to continue?</source>
|
|||
<name>ProcessListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Process Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1772,7 +1826,7 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Command Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1783,12 +1837,12 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Priority</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="821"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="823"/>
|
||||
<source>No search result</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -771,6 +771,60 @@ Kylin Team <ubuntukylin-members@list.launchpad.net></source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemDialog</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemdialog.cpp" line="58"/>
|
||||
<source>Refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Total</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Free</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="433"/>
|
||||
<source>No File System Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FontWidget</name>
|
||||
<message>
|
||||
|
@ -1716,28 +1770,28 @@ Are you sure to continue?</source>
|
|||
<context>
|
||||
<name>ProcessListItem</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="82"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="83"/>
|
||||
<source>Stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="84"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="85"/>
|
||||
<source>Suspend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="86"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="87"/>
|
||||
<source>Zombie</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="88"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="89"/>
|
||||
<source>No response</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="90"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="92"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="91"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="93"/>
|
||||
<source>Uninterruptible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1746,7 +1800,7 @@ Are you sure to continue?</source>
|
|||
<name>ProcessListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Process Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1772,7 +1826,7 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Command Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1783,12 +1837,12 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Priority</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="821"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="823"/>
|
||||
<source>No search result</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -771,6 +771,60 @@ Kylin Team <ubuntukylin-members@list.launchpad.net></source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemDialog</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemdialog.cpp" line="58"/>
|
||||
<source>Refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Total</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Free</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="433"/>
|
||||
<source>No File System Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FontWidget</name>
|
||||
<message>
|
||||
|
@ -1716,28 +1770,28 @@ Are you sure to continue?</source>
|
|||
<context>
|
||||
<name>ProcessListItem</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="82"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="83"/>
|
||||
<source>Stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="84"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="85"/>
|
||||
<source>Suspend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="86"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="87"/>
|
||||
<source>Zombie</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="88"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="89"/>
|
||||
<source>No response</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="90"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="92"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="91"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="93"/>
|
||||
<source>Uninterruptible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1746,7 +1800,7 @@ Are you sure to continue?</source>
|
|||
<name>ProcessListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Process Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1772,7 +1826,7 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Command Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1783,12 +1837,12 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Priority</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="821"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="823"/>
|
||||
<source>No search result</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -771,6 +771,60 @@ Kylin Team <ubuntukylin-members@list.launchpad.net></source>
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemDialog</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemdialog.cpp" line="58"/>
|
||||
<source>Refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Device</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Total</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Free</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Used</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="433"/>
|
||||
<source>No File System Info</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FontWidget</name>
|
||||
<message>
|
||||
|
@ -1716,28 +1770,28 @@ Are you sure to continue?</source>
|
|||
<context>
|
||||
<name>ProcessListItem</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="82"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="83"/>
|
||||
<source>Stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="84"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="85"/>
|
||||
<source>Suspend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="86"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="87"/>
|
||||
<source>Zombie</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="88"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="89"/>
|
||||
<source>No response</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="90"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="92"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="91"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="93"/>
|
||||
<source>Uninterruptible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1746,7 +1800,7 @@ Are you sure to continue?</source>
|
|||
<name>ProcessListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Process Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1772,7 +1826,7 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Command Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -1783,12 +1837,12 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Priority</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="821"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="823"/>
|
||||
<source>No search result</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -1456,6 +1456,60 @@ Kylin Team <ubuntukylin-members@list.launchpad.net></source>
|
|||
<translation>最大缩略图缓存尺寸(MB)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemDialog</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemdialog.cpp" line="58"/>
|
||||
<source>Refresh</source>
|
||||
<translation>刷新</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileSystemListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Device</source>
|
||||
<translation>设备</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Directory</source>
|
||||
<translation>目录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Type</source>
|
||||
<translation>类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Total</source>
|
||||
<translation>总数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Free</source>
|
||||
<translation>空闲</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<source>Available</source>
|
||||
<translation>可用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="49"/>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="355"/>
|
||||
<source>Used</source>
|
||||
<translation>已用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/filesystemlistwidget.cpp" line="433"/>
|
||||
<source>No File System Info</source>
|
||||
<translation>没有发现文件系统信息</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FontWidget</name>
|
||||
<message>
|
||||
|
@ -2576,28 +2630,28 @@ Are you sure to continue?</source>
|
|||
<context>
|
||||
<name>ProcessListItem</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="82"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="83"/>
|
||||
<source>Stopped</source>
|
||||
<translation>已停止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="84"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="85"/>
|
||||
<source>Suspend</source>
|
||||
<translation>停止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="86"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="87"/>
|
||||
<source>Zombie</source>
|
||||
<translation>僵死</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="88"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="89"/>
|
||||
<source>No response</source>
|
||||
<translation>无反应</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="90"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="92"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="91"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistitem.cpp" line="93"/>
|
||||
<source>Uninterruptible</source>
|
||||
<translation>不可中断</translation>
|
||||
</message>
|
||||
|
@ -2606,7 +2660,7 @@ Are you sure to continue?</source>
|
|||
<name>ProcessListWidget</name>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Process Name</source>
|
||||
<translation>进程名</translation>
|
||||
</message>
|
||||
|
@ -2632,7 +2686,7 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Command Line</source>
|
||||
<translation>命令行</translation>
|
||||
</message>
|
||||
|
@ -2643,12 +2697,12 @@ Are you sure to continue?</source>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="57"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="743"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="745"/>
|
||||
<source>Priority</source>
|
||||
<translation>优先级</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="821"/>
|
||||
<location filename="../../plugins/systemmonitor/processlistwidget.cpp" line="823"/>
|
||||
<source>No search result</source>
|
||||
<translation>无搜索结果</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue