解决规范性问题

This commit is contained in:
lixueman 2022-09-13 08:37:16 +08:00
parent 8e026603c8
commit 3b4474ab63
45 changed files with 238 additions and 315 deletions

View File

@ -38,6 +38,10 @@ DesktopWatcher::DesktopWatcher()
connect(m_directoryChangedThread, &DirectoryChangedThread::requestUpdateSignal, this, &DesktopWatcher::requestUpdateSlot);
}
DesktopWatcher::~DesktopWatcher()
{
}
/**
* desktop文件目录改变信号槽
*/

View File

@ -27,6 +27,7 @@ class DesktopWatcher : public QObject
Q_OBJECT
public:
DesktopWatcher();
~DesktopWatcher();
public:
Q_SIGNALS:

View File

@ -28,7 +28,10 @@ DirectoryChangedThread::DirectoryChangedThread()
DirectoryChangedThread::~DirectoryChangedThread()
{
delete m_ukuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void DirectoryChangedThread::run()

View File

@ -28,21 +28,20 @@ TabletDirectoryChangedThread::TabletDirectoryChangedThread()
{
m_ukuiMenuInterface = new UkuiMenuInterface;
QString path = QDir::homePath() + "/.config/ukui/ukui-menu.ini";
setting = new QSettings(path, QSettings::IniFormat);
m_setting = new QSettings(path, QSettings::IniFormat);
}
TabletDirectoryChangedThread::~TabletDirectoryChangedThread()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
if (setting) {
delete setting;
if (m_setting) {
delete m_setting;
m_setting = nullptr;
}
m_ukuiMenuInterface = nullptr;
setting = nullptr;
}
@ -67,35 +66,35 @@ void TabletDirectoryChangedThread::run()
QStringList list = str.split('/');
str = list[list.size() - 1];
QString desktopfn = str;
setting->beginGroup("recentapp");
setting->setValue(desktopfn, datetime);
setting->sync();
setting->endGroup();
m_setting->beginGroup("recentapp");
m_setting->setValue(desktopfn, datetime);
m_setting->sync();
m_setting->endGroup();
//wgx
setting->beginGroup("application");
QStringList applist = setting->allKeys();
int appnum = setting->allKeys().count();
m_setting->beginGroup("application");
QStringList applist = m_setting->allKeys();
int appnum = m_setting->allKeys().count();
int maxindex = 0;
int minindex = 0;
for (int i = 0; i < appnum; i++) {
if (setting->value(applist.at(i)).toInt() > maxindex) {
maxindex = setting->value(applist.at(i)).toInt();
if (m_setting->value(applist.at(i)).toInt() > maxindex) {
maxindex = m_setting->value(applist.at(i)).toInt();
}
if(setting->value(applist.at(i)).toInt() <= minindex) {
minindex = setting->value(applist.at(i)).toInt();
if(m_setting->value(applist.at(i)).toInt() <= minindex) {
minindex = m_setting->value(applist.at(i)).toInt();
}
}
if (desktopfn.contains("small-plugin-manage")){
setting->setValue(desktopfn,minindex-1);
m_setting->setValue(desktopfn,minindex-1);
} else {
setting->setValue(desktopfn,maxindex+1);
m_setting->setValue(desktopfn,maxindex+1);
}
setting->sync();
setting->endGroup();
m_setting->sync();
m_setting->endGroup();
//
QString iconstr = m_ukuiMenuInterface->getAppIcon(desktopfpList.at(i));
syslog(LOG_LOCAL0 | LOG_DEBUG, "%s", iconstr.toLocal8Bit().data());
@ -113,35 +112,35 @@ void TabletDirectoryChangedThread::run()
QFileInfo fileInfo(desktopfp);
QString desktopfn = fileInfo.fileName();
myDebug() << "卸载" << desktopfn;
setting->beginGroup("lockapplication");
setting->remove(desktopfn);
setting->sync();
setting->endGroup();
setting->beginGroup("application");
m_setting->beginGroup("lockapplication");
m_setting->remove(desktopfn);
m_setting->sync();
m_setting->endGroup();
m_setting->beginGroup("application");
if (!setting->contains(desktopfn)) {
setting->sync();
setting->endGroup();
if (!m_setting->contains(desktopfn)) {
m_setting->sync();
m_setting->endGroup();
continue;
}
int val = setting->value(desktopfn).toInt();
int val = m_setting->value(desktopfn).toInt();
myDebug() << "卸载val" << val;
setting->remove(desktopfn);
QStringList desktopfnList = setting->allKeys();
m_setting->remove(desktopfn);
QStringList desktopfnList = m_setting->allKeys();
for (int i = 0; i < desktopfnList.count(); i++) {
if (setting->value(desktopfnList.at(i)).toInt() > val) {
setting->setValue(desktopfnList.at(i), setting->value(desktopfnList.at(i)).toInt() - 1);
if (m_setting->value(desktopfnList.at(i)).toInt() > val) {
m_setting->setValue(desktopfnList.at(i), m_setting->value(desktopfnList.at(i)).toInt() - 1);
}
}
setting->sync();
setting->endGroup();
setting->beginGroup("recentapp");
setting->remove(desktopfn);
setting->sync();
setting->endGroup();
m_setting->sync();
m_setting->endGroup();
m_setting->beginGroup("recentapp");
m_setting->remove(desktopfn);
m_setting->sync();
m_setting->endGroup();
syslog(LOG_LOCAL0 | LOG_DEBUG, "软件卸载desktop文件名%s", desktopfn.toLocal8Bit().data());
QDBusInterface iface("com.ukui.panel.desktop",
"/",

View File

@ -35,7 +35,7 @@ public:
private:
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
QSettings *setting = nullptr;
QSettings *m_setting = nullptr;
TabletListView *m_listView = nullptr;
QStandardItemModel *listmodel = nullptr;

View File

@ -25,9 +25,9 @@
#include <QDateTime>
#include <QObject>
class CurrentTimeInterface : QObject
class CurrentTimeInterface : public QObject
{
Q_OBJECT
public:
CurrentTimeInterface();
~CurrentTimeInterface();

View File

@ -27,7 +27,10 @@ SearchAppThread::SearchAppThread()
SearchAppThread::~SearchAppThread()
{
delete m_ukuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void SearchAppThread::run()

View File

@ -27,6 +27,14 @@ GetModelData::GetModelData()
loadDesktopVercor();
}
GetModelData::~GetModelData()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void GetModelData::loadDesktopVercor()
{
UkuiMenuInterface::appInfoVector.clear();
@ -58,10 +66,10 @@ QStringList GetModelData::getPreCollectionApp()
QStringList preAppList = QStringList();
QStringList preAppListExist = QStringList();
preAppList << QString("/usr/share/applications/ukui-control-center.desktop")
<<QString("/usr/share/applications/kylin-weather.desktop")
<<QString("/usr/share/applications/kylin-software-center.desktop")
<<QString("/usr/share/applications/kylin-screenshot.desktop")
<<QString("/usr/share/applications/peony.desktop");
<< QString("/usr/share/applications/kylin-weather.desktop")
<< QString("/usr/share/applications/kylin-software-center.desktop")
<< QString("/usr/share/applications/kylin-screenshot.desktop")
<< QString("/usr/share/applications/peony.desktop");
Q_FOREACH(QString appDesktop,preAppList) {
if (UkuiMenuInterface::allAppVector.contains(appDesktop)) {
preAppListExist.append(appDesktop);

View File

@ -29,6 +29,7 @@ class GetModelData : public QObject
public:
GetModelData();
~GetModelData();
public:
/**

View File

@ -27,6 +27,14 @@ PageManager::PageManager()
m_ukuiMenuInterface->initAppIni();
}
PageManager::~PageManager()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
int PageManager::getPageNum(const int &appNum)
{
int pageNum = 0;

View File

@ -27,6 +27,7 @@ class PageManager : public QObject
Q_OBJECT
public:
PageManager();
~PageManager();
int getPageNum(const int &appNum);
QVector<QStringList> sortAppInPage(const QVector<QString> &appVector);

View File

@ -30,13 +30,25 @@ FullListView::FullListView(QWidget *parent, int module):
initWidget();
m_delegate = new FullItemDelegate(this, module);
this->setItemDelegate(m_delegate);
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
FullListView::~FullListView()
{
delete menu;
delete gsetting;
if (m_rightMenu) {
delete m_rightMenu;
m_rightMenu = nullptr;
}
if (m_gsetting) {
delete m_gsetting;
m_gsetting = nullptr;
}
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullListView::initWidget()

View File

@ -42,9 +42,9 @@ protected:
void keyPressEvent(QKeyEvent *e);
private:
RightClickMenu *menu = nullptr;//右键菜单
QStringList data;
QGSettings *gsetting = nullptr;
RightClickMenu *m_rightMenu = nullptr;//右键菜单
QStringList m_data;
QGSettings *m_gsetting = nullptr;
public Q_SLOTS:
void selectFirstItem();

View File

@ -30,37 +30,43 @@ KListView::KListView(QWidget *parent):
KListView::~KListView()
{
delete m_delegate;
delete listmodel;
delete pUkuiMenuInterface;
if (m_delegate) {
delete m_delegate;
m_delegate = nullptr;
}
if (m_listmodel) {
delete m_listmodel;
m_listmodel = nullptr;
}
}
void KListView::addData(QStringList data)
{
listmodel = new QStandardItemModel(this);
this->setModel(listmodel);
m_listmodel = new QStandardItemModel(this);
this->setModel(m_listmodel);
Q_FOREACH(QString desktopfp, data) {
QStandardItem *item = new QStandardItem;
item->setData(QVariant::fromValue<QString>(desktopfp), Qt::DisplayRole);
listmodel->appendRow(item);
m_listmodel->appendRow(item);
}
}
void KListView::updateData(QStringList data)
{
listmodel->clear();
m_listmodel->clear();
Q_FOREACH(QString desktopfp, data) {
QStandardItem *item = new QStandardItem;
item->setData(QVariant::fromValue<QString>(desktopfp), Qt::DisplayRole);
listmodel->appendRow(item);
m_listmodel->appendRow(item);
}
}
void KListView::onClicked(QModelIndex index)
{
QVariant var = listmodel->data(index, Qt::DisplayRole);
QVariant var = m_listmodel->data(index, Qt::DisplayRole);
if (var.isValid()) {
QString desktopfp = var.value<QString>();
Q_EMIT sendHideMainWindowSignal();
@ -88,7 +94,7 @@ void KListView::mouseMoveEvent(QMouseEvent *e)
void KListView::mousePressEvent(QMouseEvent *event)
{
if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
pressApp = listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
}
return QListView::mousePressEvent(event);
}
@ -111,7 +117,7 @@ void KListView::rightClickedSlot(const QPoint &pos)
return;
}
QVariant var = listmodel->data(index, Qt::DisplayRole);
QVariant var = m_listmodel->data(index, Qt::DisplayRole);
QStringList strlist = var.value<QStringList>();
if (strlist.count() == 1 || ((strlist.count() == 2) && (strlist.at(1).toInt() == 1))) {

View File

@ -33,11 +33,11 @@ public:
void initWidget();
KItemDelegate *m_delegate = nullptr;
QStandardItemModel *listmodel = nullptr;
QStandardItemModel *m_listmodel = nullptr;
int module = 0;
double transparency;
QVariant pressApp;
UkuiMenuInterface *pUkuiMenuInterface = nullptr;
double m_transparency;
QVariant m_pressApp;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
protected:
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *event);

View File

@ -30,15 +30,18 @@ ListView::ListView(QWidget *parent/*, int width, int height, int module*/):
this->h = 540;
this->module = 1;
initWidget();
listmodel = new QStandardItemModel(this);
this->setModel(listmodel);
pUkuiMenuInterface = new UkuiMenuInterface;
m_listmodel = new QStandardItemModel(this);
this->setModel(m_listmodel);
m_ukuiMenuInterface = new UkuiMenuInterface;
this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
ListView::~ListView()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void ListView::initWidget()
@ -70,12 +73,12 @@ void ListView::initWidget()
void ListView::addData(QVector<QStringList> data, int module)
{
this->module = module;
listmodel->clear();
m_listmodel->clear();
Q_FOREACH(QStringList desktopfp, data) {
QStandardItem *item = new QStandardItem;
item->setData(QVariant::fromValue<QStringList>(desktopfp), Qt::DisplayRole);
listmodel->appendRow(item);
m_listmodel->appendRow(item);
}
m_delegate = new ItemDelegate(this, module);
@ -84,18 +87,18 @@ void ListView::addData(QVector<QStringList> data, int module)
void ListView::updateData(QVector<QStringList> data)
{
listmodel->clear();
m_listmodel->clear();
Q_FOREACH(QStringList desktopfp, data) {
QStandardItem *item = new QStandardItem;
item->setData(QVariant::fromValue<QStringList>(desktopfp), Qt::DisplayRole);
listmodel->appendRow(item);
m_listmodel->appendRow(item);
}
}
void ListView::onClicked(QModelIndex index)
{
QVariant var = listmodel->data(index, Qt::DisplayRole);
QVariant var = m_listmodel->data(index, Qt::DisplayRole);
QString desktopfp = var.value<QStringList>().at(0);
if (var.isValid()) {

View File

@ -30,12 +30,16 @@ RightListView::RightListView(QWidget *parent):
initWidget();
m_delegate = new RightItemDelegate(this);
this->setItemDelegate(m_delegate);
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
RightListView::~RightListView()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void RightListView::initWidget()
@ -69,11 +73,11 @@ void RightListView::dropEvent(QDropEvent *event)
m_dropPos = event->pos();
if (this->indexAt(m_dropPos).isValid()) {
QVariant var = listmodel->data(indexAt(m_dropPos), Qt::DisplayRole);
QVariant var = m_listmodel->data(indexAt(m_dropPos), Qt::DisplayRole);
QString desktopfp = var.value<QString>();
QFileInfo fileInfo(desktopfp);
QString desktopfn = fileInfo.fileName();
QString dragDesktopfp = pressApp.value<QString>();
QString dragDesktopfp = m_pressApp.value<QString>();
QFileInfo dragFileInfo(dragDesktopfp);
QString dragDesktopfn = dragFileInfo.fileName();
changeCollectSort(dragDesktopfn, desktopfn);
@ -129,7 +133,7 @@ void RightListView::keyPressEvent(QKeyEvent *e)
void RightListView::onClicked(QModelIndex index)
{
QVariant var = listmodel->data(index, Qt::DisplayRole);
QVariant var = m_listmodel->data(index, Qt::DisplayRole);
QString desktopfp = var.value<QStringList>().at(0);
if (var.isValid()) {
QString desktopfp = var.value<QString>();

View File

@ -362,6 +362,7 @@ void TabletListView::mousePressEvent(QMouseEvent *event)
void TabletListView::mouseMoveEvent(QMouseEvent *event)
{
myDebug();
if (event->buttons() & Qt::LeftButton & this->indexAt(event->pos()).isValid()) {
if (iconClick) {
if ((event->pos() - startPos).manhattanLength() >= QApplication::startDragDistance()) {
@ -429,12 +430,14 @@ void TabletListView::dragMoveEvent(QDragMoveEvent *event)
void TabletListView::dragEnterEvent(QDragEnterEvent *event)
{
myDebug();
iconClick = true;
event->accept();
}
void TabletListView::dropEvent(QDropEvent *event)
{
myDebug();
dropPos = event->pos();
pressDesktopfp = (QString)event->mimeData()->data("INFO");
insertApplication(startPos, dropPos);
@ -442,6 +445,7 @@ void TabletListView::dropEvent(QDropEvent *event)
}
void TabletListView::mouseReleaseEvent(QMouseEvent *e)
{
myDebug();
releasepos = e->pos();//释放的位置坐标
if (iconClick) {

View File

@ -19,6 +19,7 @@
#include "rotationlabel.h"
#include <QPainter>
#include <QDebug>
#include "utility.h"
RotationLabel::RotationLabel(QWidget *parent)
: QLabel(parent)
@ -50,6 +51,11 @@ void RotationLabel::paintEvent(QPaintEvent *event)
return QLabel::paintEvent(event);
}
void RotationLabel::mouseReleaseEvent(QMouseEvent *ev)
{
Q_UNUSED(ev);
}
void RotationLabel::setIcon(const QPixmap &pixmap)
{
m_pixmap = pixmap;

View File

@ -31,6 +31,7 @@ protected:
int rotation();
void setRotation(int rot);
void paintEvent(QPaintEvent *event);
void mouseReleaseEvent(QMouseEvent *ev);
private:
int m_rotation = 0;
QPixmap m_pixmap;

View File

@ -47,8 +47,15 @@ RightClickMenu::RightClickMenu(QWidget *parent):
RightClickMenu::~RightClickMenu()
{
delete m_cmdProc;
delete m_ukuiMenuInterface;
if (m_cmdProc) {
delete m_cmdProc;
m_cmdProc = nullptr;
}
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
QPixmap RightClickMenu::getIconPixmap(QString iconstr, int type)
@ -127,7 +134,7 @@ bool RightClickMenu::canSwitch()
return false;
} else {
QDBusReply<QVariant> reply = interface.call("Get","org.freedesktop.DisplayManager.Seat","CanSwitch");
return reply.value().toBool();
return reply.value().toBool();
}
}
@ -307,14 +314,14 @@ int RightClickMenu::showShutdownMenu(const QPoint &pos, const bool &isFullWind)
reply = iface.call("canHibernate");
if (reply.isValid() && reply.value() == true) {
if (reply.isValid() && reply.value()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("kylin-sleep-symbolic", 1)), tr("Hibernate"),
this, SLOT(hibernateActionTriggerSlot()));
}
reply = iface.call("canSuspend");
if (reply.isValid() && reply.value() == true) {
if (reply.isValid() && reply.value()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("kylin-hebernate-symbolic", 1)), tr("Sleep"),
this, SLOT(sleepActionTriggerSlot()));
}
@ -323,21 +330,21 @@ int RightClickMenu::showShutdownMenu(const QPoint &pos, const bool &isFullWind)
this, SLOT(lockScreenActionTriggerSlot()));
reply = iface.call("canLogout");
if (reply.isValid() && reply.value() == true) {
if (reply.isValid() && reply.value()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("system-logout-symbolic", 1)), tr("Log Out"),
this, SLOT(logoutActionTriggerSlot()));
}
reply = iface.call("canReboot");
if (reply.isValid() && reply.value() == true) {
if (reply.isValid() && reply.value()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("system-restart-symbolic", 1)), tr("Restart"),
this, SLOT(rebootActionTriggerSlot()));
}
reply = iface.call("canPowerOff");
if (reply.isValid() && reply.value() == true) {
if (reply.isValid() && reply.value()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("exit-symbolic", 1)), tr("Power Off"),
this, SLOT(shutdownActionTriggerSlot()));
}

View File

@ -24,12 +24,15 @@ FullItemDelegate::FullItemDelegate(QObject *parent, int module):
KItemDelegate(parent)
{
this->module = module;
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
FullItemDelegate::~FullItemDelegate()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
@ -69,7 +72,7 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
painter->save();
painter->setOpacity(1);
QString desktopfp = index.data(Qt::DisplayRole).value<QString>();
QString iconstr = pUkuiMenuInterface->getAppIcon(desktopfp);
QString iconstr = m_ukuiMenuInterface->getAppIcon(desktopfp);
QIcon icon;
QFileInfo iconFileInfo(iconstr);
@ -115,7 +118,7 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
}
}
QString appname = pUkuiMenuInterface->getAppName(desktopfp);
QString appname = m_ukuiMenuInterface->getAppName(desktopfp);
QRect iconRect;
QRect textRect;
iconRect = QRect(rect.x() + (rect.width() - Style::AppListIconSize) / 2,

View File

@ -26,12 +26,15 @@ ItemDelegate::ItemDelegate(QObject *parent, int module):
KItemDelegate(parent)
{
this->module = module;
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
ItemDelegate::~ItemDelegate()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
@ -86,7 +89,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
if (module > 0) {
if (strlist.at(1).toInt() == 1) {
QRect iconRect = QRect(rect.x() + 11, rect.y() + (rect.height() - 32) / 2, 32, 32);
QString iconstr = pUkuiMenuInterface->getAppIcon(strlist.at(0));
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
QIcon icon;
QFileInfo iconFileInfo(iconstr);
@ -130,7 +133,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->save();
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = pUkuiMenuInterface->getAppName(strlist.at(0));
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
QFontMetrics fm = painter->fontMetrics();
QString appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 62, Qt::TextShowMnemonic);
painter->drawText(QRect(iconRect.right() + 15, rect.y(),
@ -253,7 +256,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
}
} else {
QRect iconRect = QRect(rect.left() + 11, rect.y() + (rect.height() - 32) / 2, 32, 32);
QString iconstr = pUkuiMenuInterface->getAppIcon(strlist.at(0));
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
QIcon icon;
QFileInfo iconFileInfo(iconstr);
@ -296,7 +299,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
}
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = pUkuiMenuInterface->getAppName(strlist.at(0));
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
QFileInfo fileInfo(strlist.at(0));
QString desktopfn = fileInfo.fileName();

View File

@ -22,3 +22,7 @@ KItemDelegate::KItemDelegate(QObject *parent):
QStyledItemDelegate(parent)
{
}
KItemDelegate::~KItemDelegate()
{
}

View File

@ -26,9 +26,10 @@ class KItemDelegate : public QStyledItemDelegate
Q_OBJECT
public:
KItemDelegate(QObject *parent);
~KItemDelegate();
int module = 0;
UkuiMenuInterface *pUkuiMenuInterface = nullptr;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
};
#endif // KITEMDELEGATE_H

View File

@ -18,19 +18,22 @@
#include "recent_item_delegate.h"
recentitemdelegate::recentitemdelegate(QObject *parent, int module):
RecentItemDelegate::RecentItemDelegate(QObject *parent, int module):
KItemDelegate(parent)
{
this->module = module;
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
recentitemdelegate::~recentitemdelegate()
RecentItemDelegate::~RecentItemDelegate()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void recentitemdelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
void RecentItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.isValid()) {
// QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
@ -148,7 +151,7 @@ void recentitemdelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
}
} else {
QRect iconRect = QRect(rect.left() + 11, rect.y() + (rect.height() - 32) / 2, 32, 32);
QString iconstr = pUkuiMenuInterface->getAppIcon(strlist.at(0));
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
QIcon icon;
QFileInfo iconFileInfo(iconstr);
@ -191,7 +194,7 @@ void recentitemdelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
}
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = pUkuiMenuInterface->getAppName(strlist.at(0));
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
QFileInfo fileInfo(strlist.at(0));
QString desktopfn = fileInfo.fileName();
@ -237,7 +240,7 @@ void recentitemdelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
}
}
QSize recentitemdelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
QSize RecentItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
// QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
// if(strlist.at(1).toInt()==1)

View File

@ -26,15 +26,15 @@
#include "src/UtilityFunction/utility.h"
#include "kitemdelegate.h"
class recentitemdelegate : public KItemDelegate
class RecentItemDelegate : public KItemDelegate
{
Q_OBJECT
public:
/**
* @param module为0时为常用模块123
*/
recentitemdelegate(QObject *parent, int module);
~recentitemdelegate();
RecentItemDelegate(QObject *parent, int module);
~RecentItemDelegate();
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};

View File

@ -23,12 +23,15 @@
RightItemDelegate::RightItemDelegate(QObject *parent):
KItemDelegate(parent)
{
pUkuiMenuInterface = new UkuiMenuInterface;
m_ukuiMenuInterface = new UkuiMenuInterface;
}
RightItemDelegate::~RightItemDelegate()
{
delete pUkuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
@ -83,7 +86,7 @@ void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
painter->save();
painter->setOpacity(1);
QString desktopfp = index.data(Qt::DisplayRole).value<QString>();
QString iconstr = pUkuiMenuInterface->getAppIcon(desktopfp);
QString iconstr = m_ukuiMenuInterface->getAppIcon(desktopfp);
QIcon icon;
QFileInfo iconFileInfo(iconstr);
@ -129,7 +132,7 @@ void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
}
}
QString appname = pUkuiMenuInterface->getAppName(desktopfp);
QString appname = m_ukuiMenuInterface->getAppName(desktopfp);
QRect iconRect;
QRect textRect;
iconRect = QRect(rect.x() + 28,

View File

@ -31,7 +31,10 @@ FullCommonUseWidget::FullCommonUseWidget(QWidget *parent) :
FullCommonUseWidget::~FullCommonUseWidget()
{
delete m_ukuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullCommonUseWidget::initUi()

View File

@ -32,7 +32,10 @@ FullFunctionWidget::FullFunctionWidget(QWidget *parent) :
FullFunctionWidget::~FullFunctionWidget()
{
delete m_ukuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullFunctionWidget::initUi()

View File

@ -28,8 +28,14 @@ FullLetterWidget::FullLetterWidget(QWidget *parent) :
FullLetterWidget::~FullLetterWidget()
{
delete m_ukuiMenuInterface;
delete m_letterListBottomSpacer;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
if (m_letterListBottomSpacer) {
delete m_letterListBottomSpacer;
m_letterListBottomSpacer = nullptr;
}
}
/**

View File

@ -29,7 +29,10 @@ FullSearchResultWidget::FullSearchResultWidget(QWidget *parent) :
FullSearchResultWidget::~FullSearchResultWidget()
{
delete m_ukuiMenuInterface;
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullSearchResultWidget::initUi()

View File

@ -24,7 +24,6 @@
#include <QLocale>
#include <qwindow.h>
#include <QDir>
#include <AbstractInterface.h>
#include <QPluginLoader>
#include "currenttime_interface.h"
#include "style.h"
@ -228,7 +227,7 @@ void FunctionWidget::initUi()
}
mainLayout->addWidget(searchEditBtn);
focusPlug = new pluginwidget(this);
focusPlug = new PluginWidget(this);
mainLayout->addWidget(focusPlug);
focusPlug->setFixedSize(400, 638);
mainLayout->addStretch();

View File

@ -29,7 +29,6 @@
#include <QDateTime>
#include <QGSettings>
#include <QSettings>
#include "AbstractInterface.h"
#include <QGraphicsDropShadowEffect>
#include "plugin_widget.h"
#include "currenttime_interface.h"
@ -41,7 +40,7 @@ public:
FunctionWidget(QWidget *parent);
~FunctionWidget();
//QWidget* focusPlug=nullptr;
pluginwidget *focusPlug = nullptr;
PluginWidget *focusPlug = nullptr;
void setDownOpacityEffect(const qreal &num);
protected:

View File

@ -19,14 +19,14 @@
#include "plugin_widget.h"
#include "KySmallPluginInterface.h"
#include <QDebug>
pluginwidget::pluginwidget(QWidget *parent) : QWidget(parent)
PluginWidget::PluginWidget(QWidget *parent) : QWidget(parent)
{
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_StyledBackground, true);
this->setFocusPolicy(Qt::NoFocus);
init();
}
void pluginwidget::init()
void PluginWidget::init()
{
QPluginLoader loader("/opt/small-plugin/bin/libsmall-plugin-manage.so");
QObject *plugin = loader.instance();

View File

@ -26,8 +26,6 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPluginLoader>
#include <AbstractInterface.h>
#include <abstractInterface.h>
#include <QLibrary>
#include <QEvent>
#include <QLabel>
@ -35,11 +33,11 @@
#include <QSettings>
#include <QDBusInterface>
#include <QDBusReply>
class pluginwidget : public QWidget
class PluginWidget : public QWidget
{
Q_OBJECT
public:
explicit pluginwidget(QWidget *parent = nullptr);
explicit PluginWidget(QWidget *parent = nullptr);
void init();
};

View File

@ -1,54 +0,0 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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; either version 3, or (at your option)
* any later version.
*
* 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/&gt;.
*
*/
#include "tabview_widget.h"
#include <QTabBar>
TabViewWidget::TabViewWidget()
{
setStyleSheet("background:transparent");
collectionTab = new QWidget();
recentTab = new QWidget();
collectionTab->setObjectName(QString::fromUtf8("collectionTab"));
recentTab->setObjectName(QString::fromUtf8("recentTab"));
this->addTab(collectionTab, QString());
this->addTab(recentTab, QString());
this->tabBar()->hide();
this->setCurrentIndex(0);
initAppListWidget();
updateListView();
}
void TabViewWidget::initAppListWidget()
{
m_collectListView = new RightListView(collectionTab);
m_collectListView->setFixedSize(352, 428);
m_collectListView->show();
}
void TabViewWidget::updateListView()
{
m_data.clear();
Q_FOREACH(QString desktopfp, m_ukuiMenuInterface->getAllClassification()) {
m_data.append(desktopfp);
}
m_collectListView->addData(m_data);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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; either version 3, or (at your option)
* any later version.
*
* 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/&gt;.
*
*/
#ifndef TABVIEWWIDGET_H
#define TABVIEWWIDGET_H
#include <QTabWidget>
#include "rightlistview.h"
class TabViewWidget: public QTabWidget
{
public:
TabViewWidget();
protected:
void initAppListWidget();
void updateListView();
private:
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
QWidget *collectionTab = nullptr;
QWidget *recentTab = nullptr;
RightListView *m_collectListView = nullptr;
QStringList m_data;
};
#endif // TABVIEWWIDGET_H

View File

@ -770,7 +770,7 @@ void MainWindow::minAnimationFinished()
// m_collectPushButton->clicked(true);
on_collectPushButton_clicked();
QTimer::singleShot(200, [=]() {
QTimer::singleShot(200, [ = ]() {
m_animationPage->hide();
});
}
@ -790,7 +790,7 @@ void MainWindow::maxAnimationFinished()
setMaxWindowPos();
m_fullWindow->activateWindow();
QTimer::singleShot(200, [=]() {
QTimer::singleShot(200, [ = ]() {
m_animationPage->hide();
});
}

View File

@ -38,7 +38,6 @@
#include "convert_winid_to_desktop.h"
#include "style.h"
#include "main_view_widget.h"
#include "tabview_widget.h"
#include "dbus.h"
#include "dbus-adaptor.h"
#include "software_database_update_thread.h"
@ -54,6 +53,7 @@
#include "letter_button_widget.h"
#include "animationpage.h"
#include "rotationlabel.h"
#include "rightlistview.h"
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"

View File

@ -40,7 +40,6 @@ HEADERS += \
$$PWD/Widget/main_view_widget.h \
$$PWD/Widget/plugin_widget.h \
$$PWD/Widget/splitbar_frame.h \
$$PWD/Widget/tabview_widget.h \
$$PWD/full_mainwindow.h \
$$PWD/mainwindow.h \
$$PWD/tabletwindow.h
@ -78,7 +77,6 @@ SOURCES += \
$$PWD/Widget/main_view_widget.cpp \
$$PWD/Widget/plugin_widget.cpp \
$$PWD/Widget/splitbar_frame.cpp \
$$PWD/Widget/tabview_widget.cpp \
$$PWD/full_mainwindow.cpp \
$$PWD/mainwindow.cpp \
$$PWD/tabletwindow.cpp

View File

@ -1,31 +0,0 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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; either version 3, or (at your option)
* any later version.
*
* 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/&gt;.
*
*/
#ifndef ABSTRACTINTERFACE_H
#define ABSTRACTINTERFACE_H
#include <QObject>
class QWidget;
class AbstractInterface
{
public:
virtual ~AbstractInterface() {}
virtual QWidget *createPluginWidget(QWidget *parent, bool type) = 0;
};
#define AbstractInterface_iid "Welcome to use focusmode"
Q_DECLARE_INTERFACE(AbstractInterface, AbstractInterface_iid)
#endif // ABSTRACTINTERFACE_H

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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; either version 3, or (at your option)
* any later version.
*
* 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/&gt;.
*
*/
#ifndef OOBE_PLUGIN_INFACE_H
#define OOBE_PLUGIN_INFACE_H
#include <QtPlugin>
#include <functional>
#include <QString>
#include <QObject>
class QWidget;
class kyMenuPluginInterface
{
public:
virtual ~kyMenuPluginInterface() {}
virtual const QString name() = 0;
virtual const QString description() = 0;
virtual QWidget *createWidget(QWidget *parent) = 0;
};
Q_DECLARE_INTERFACE(kyMenuPluginInterface, "org.kyMenuPlugin.AbstractInterface")
#endif

View File

@ -237,19 +237,13 @@ bool ThumbNail::appDisable(QString desktopfp)//判断是否是禁用应用(这
char *name = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Exec", nullptr, nullptr);
//取出value值
QString execnamestr = QString::fromLocal8Bit(name);
//处理value值
str = execnamestr;
// str = execnamestr.section(' ', 0, 0);
// QStringList list = str.split('/');
// str = list[list.size()-1];
//关闭文件
g_key_file_free(keyfile);
QString desktopfp1 =/*"application/"+*/str;
//QString group=desktopfp.split('/').last();
disableSetting->beginGroup("application");
//判断
bool bo = disableSetting->contains(desktopfp1.toLocal8Bit().data()); // iskey
bool bo1 = disableSetting->QSettings::value(desktopfp1.toLocal8Bit().data()).toBool(); //isvalue
bool bo = disableSetting->contains(execnamestr.toLocal8Bit().data()); // iskey
bool bo1 = disableSetting->QSettings::value(execnamestr.toLocal8Bit().data()).toBool(); //isvalue
disableSetting->endGroup();
//qDebug()<<bo<<bo1;

View File

@ -3,10 +3,8 @@ INCLUDEPATH += \
$$PWD/Style
HEADERS += \
$$PWD/AbstractInterface.h \
$$PWD/KySmallPluginInterface.h \
$$PWD/Style/style.h \
$$PWD/abstractInterface.h \
$$PWD/thumbnail.h \
$$PWD/utility.h