!23 改动同步

Merge pull request !23 from lixueman/upstream
This commit is contained in:
lixueman 2022-10-21 07:58:10 +00:00 committed by Gitee
commit 641845bff6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
114 changed files with 1996 additions and 1426 deletions

View File

@ -46,7 +46,7 @@ bugfixes for this package.
## Preparation
You can build pre-depends with such command:
`sudo apt install libglib2.0-dev qtbase5-dev libqt5svg5-dev libqt5x11extras5-dev libgsettings-qt-dev libbamf3-dev libxrandr-dev libxtst-dev libx11-dev`
`sudo apt install g++ qtbase5-dev qttools5-dev-tools libglib2.0-dev libqt5svg5-dev libqt5x11extras5-dev libgsettings-qt-dev libbamf3-dev libxrandr-dev libxtst-dev libx11-dev libkf5windowsystem-dev libuchardet-dev libpeony-dev libkysdk-waylandhelper-dev libukui-common-dev`
Note: build-depends references the paragraph in debian/control.

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "mainwindow.h"
@ -81,17 +80,17 @@ int main(int argc, char *argv[])
if (Style::m_panelPosition == 0) {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY +
Style::m_availableScreenHeight - Style::minh - 3, Style::minw, Style::minh));
Style::m_availableScreenHeight - Style::m_minh - 3, Style::m_minw, Style::m_minh));
} else {
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh - 3,
Style::minw, Style::minh));
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::m_minh - 3,
Style::m_minw, Style::m_minh));
}
} else if (Style::m_panelPosition == 1) {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4,
Style::m_primaryScreenY + 4, Style::minw, Style::minh));
Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh));
} else {
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh));
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh));
}
} else if (Style::m_panelPosition == 2) {
@ -99,17 +98,17 @@ int main(int argc, char *argv[])
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + 4,
Style::m_primaryScreenY + 4, Style::minw, Style::minh));
Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh));
} else {
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh));
w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh));
}
} else {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth -
Style::minw - 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh));
Style::m_minw - 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh));
} else {
w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::minw - 4, Style::m_primaryScreenY + 4,
Style::minw, Style::minh));
w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::m_minw - 4, Style::m_primaryScreenY + 4,
Style::m_minw, Style::m_minh));
}
}

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "dbus.h"
#include <QFileInfo>
#include <QDir>

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef DBUS_H
#define DBUS_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,13 +12,11 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "convert_winid_to_desktop.h"
#include "utility.h"
#include <KWindowSystem>
#include <QFile>
#include <QDebug>
#include <QDir>

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CONVERTDESKTOPTOWINID_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "desktop_watcher.h"
#include <QDir>
#include <QEventLoop>
@ -20,6 +37,10 @@ DesktopWatcher::DesktopWatcher()
connect(m_directoryChangedThread, &DirectoryChangedThread::requestUpdateSignal, this, &DesktopWatcher::requestUpdateSlot);
}
DesktopWatcher::~DesktopWatcher()
{
}
/**
* desktop文件目录改变信号槽
*/

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef DESKTOPWATCHER_H
#define DESKTOPWATCHER_H
#include <QFileSystemWatcher>
@ -9,6 +26,7 @@ class DesktopWatcher : public QObject
Q_OBJECT
public:
DesktopWatcher();
~DesktopWatcher();
public:
Q_SIGNALS:

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "directory_changed_thread.h"
@ -28,7 +27,10 @@ DirectoryChangedThread::DirectoryChangedThread()
DirectoryChangedThread::~DirectoryChangedThread()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void DirectoryChangedThread::run()

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DIRECTORYCHANGEDTHREAD_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "software_database_update_thread.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SOFTWAREDATABASEUPDATETHREAD_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tablet_directorychanged_thread.h"
@ -28,21 +27,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;
}
if (setting) {
delete setting;
}
m_ukuiMenuInterface = nullptr;
setting = nullptr;
}
if (m_setting) {
delete m_setting;
m_setting = nullptr;
}
}
@ -67,35 +65,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 +111,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

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TABLETDIRECTORYCHANGEDTHREAD_H
@ -35,7 +34,7 @@ public:
private:
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
QSettings *setting = nullptr;
QSettings *m_setting = nullptr;
TabletListView *m_listView = nullptr;
QStandardItemModel *listmodel = nullptr;

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "currenttime_interface.h"
#include <QTimer>
#define TIME_FORMAT "org.ukui.control-center.panel.plugins"

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef CURRENTTIMEINTERFACE_H
#define CURRENTTIMEINTERFACE_H
#include <QString>
@ -7,9 +24,9 @@
#include <QDateTime>
#include <QObject>
class CurrentTimeInterface : QObject
class CurrentTimeInterface : public QObject
{
Q_OBJECT
public:
CurrentTimeInterface();
~CurrentTimeInterface();

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ukui_chineseletter.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef UKUICHINESELETTER_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ukuimenuinterface.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef UKUIMENUINTERFACE_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "searchappthread.h"
@ -27,7 +26,10 @@ SearchAppThread::SearchAppThread()
SearchAppThread::~SearchAppThread()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void SearchAppThread::run()

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SEARCHAPPTHREAD_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "getmodeldata.h"
#include <QTranslator>
#include <QDir>
@ -9,6 +26,14 @@ GetModelData::GetModelData()
loadDesktopVercor();
}
GetModelData::~GetModelData()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void GetModelData::loadDesktopVercor()
{
UkuiMenuInterface::appInfoVector.clear();
@ -83,7 +108,6 @@ QVector<QStringList> GetModelData::getRecentData()
enumerator = new Peony::FileEnumerator(this);
enumerator->setEnumerateDirectory("recent:///");
enumerator->enumerateSync();
QString uri;
for (auto fileInfo : enumerator->getChildren()) {
QStringList recentData;

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef GETMODELDATA_H
#define GETMODELDATA_H
#include "ukuimenuinterface.h"
@ -11,6 +28,7 @@ class GetModelData : public QObject
public:
GetModelData();
~GetModelData();
public:
/**

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "pagemanager.h"
#include "ukuimenuinterface.h"
#include "style.h"
@ -9,19 +26,27 @@ 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;
if (appNum / (Style::appColumnFirst * Style::appLineFirst) == 0) {
if (appNum / (Style::m_appColumnFirst * Style::m_appLineFirst) == 0) {
pageNum = 1;
} else {
int appNumOtherPage = appNum - (Style::appColumnFirst * Style::appLineFirst);
int appNumOtherPage = appNum - (Style::m_appColumnFirst * Style::m_appLineFirst);
if (appNumOtherPage % (Style::appColumn * Style::appLine) == 0) {
pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 1;
if (appNumOtherPage % (Style::m_appColumn * Style::m_appLine) == 0) {
pageNum = appNumOtherPage / (Style::m_appColumn * Style::m_appLine) + 1;
} else {
pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 2;
pageNum = appNumOtherPage / (Style::m_appColumn * Style::m_appLine) + 2;
}
}
@ -41,7 +66,7 @@ QVector<QStringList> PageManager::sortAppInPage(const QVector<QString> &appVecto
int pageSize = getPageNum(m_data.size());
onePageData.clear();
for (int j = 0; j < Style::appColumnFirst * Style::appLineFirst; j++) {
for (int j = 0; j < Style::m_appColumnFirst * Style::m_appLineFirst; j++) {
if (m_data.size() > 0) {
onePageData.append(m_data.at(0));
m_data.pop_front();
@ -55,7 +80,7 @@ QVector<QStringList> PageManager::sortAppInPage(const QVector<QString> &appVecto
for (int i = 0; i < pageSize - 1; i++) {
onePageData.clear();
for (int j = 0; j < Style::appColumn * Style::appLine; j++) {
for (int j = 0; j < Style::m_appColumn * Style::m_appLine; j++) {
if (m_data.size() > 0) {
onePageData.append(m_data.at(0));
m_data.pop_front();

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef PAGEMANAGER_H
#define PAGEMANAGER_H
@ -9,6 +26,7 @@ class PageManager : public QObject
Q_OBJECT
public:
PageManager();
~PageManager();
int getPageNum(const int &appNum);
QVector<QStringList> sortAppInPage(const QVector<QString> &appVector);

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "function_classify_button.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FUNCTIONCLASSIFYBUTTON_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "letter_classify_button.h"
@ -167,9 +166,9 @@ void LetterClassifyButton::leaveEvent(QEvent *e)
if (m_fullscreen) {
QFont font;
font.setPixelSize(Style::LeftLetterFontSize);
font.setPixelSize(Style::m_leftLetterFontSize);
this->setFont(font);
this->setFixedSize(Style::LeftLetterBtnHeight, Style::LeftLetterBtnHeight);
this->setFixedSize(Style::m_leftLetterBtnHeight, Style::m_leftLetterBtnHeight);
tooltip->close();
delete tooltip;
tooltip = nullptr;
@ -195,9 +194,9 @@ void LetterClassifyButton::focusInEvent(QEvent *e)
if (m_fullscreen) {
QFont font;
font.setPixelSize(Style::LeftLetterFontSize * 3);
font.setPixelSize(Style::m_leftLetterFontSize * 3);
this->setFont(font);
this->setFixedSize(Style::LeftLetterBtnHeight * 2, Style::LeftLetterBtnHeight * 2);
this->setFixedSize(Style::m_leftLetterBtnHeight * 2, Style::m_leftLetterBtnHeight * 2);
}
}

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef LETTERCLASSIFYBUTTON_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tool_button.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TOOLBUTTON_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "fulllistview.h"
@ -30,13 +29,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()
@ -84,7 +95,7 @@ void FullListView::keyPressEvent(QKeyEvent *e)
case Qt::Key_Left: {
this->clearFocus();
if (mapToGlobal(center.topRight()).y() < Style::QueryLineEditHeight + Style::m_applistGridSizeWidth) {
if (mapToGlobal(center.topRight()).y() < Style::m_queryLineEditHeight + Style::m_applistGridSizeWidth) {
Q_EMIT sendSetslidebar(-Style::m_applistGridSizeWidth);
}
@ -107,7 +118,7 @@ void FullListView::keyPressEvent(QKeyEvent *e)
case Qt::Key_Up: {
if (module == 0) {
if (mapToGlobal(center.topRight()).y() < (Style::QueryLineEditHeight + Style::m_applistGridSizeWidth)) {
if (mapToGlobal(center.topRight()).y() < (Style::m_queryLineEditHeight + Style::m_applistGridSizeWidth)) {
Q_EMIT sendSetslidebar(-Style::m_applistGridSizeWidth);
}
}

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLLISTVIEW_H
@ -42,9 +41,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

@ -1,7 +1,25 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include <QPainter>
#include "klistview.h"
#include "utility.h"
#include <QScrollBar>
#include <QtConcurrent/QtConcurrent>
#include "rightclickmenu.h"
KListView::KListView(QWidget *parent):
@ -11,42 +29,47 @@ KListView::KListView(QWidget *parent):
KListView::~KListView()
{
if (m_delegate) {
delete m_delegate;
delete listmodel;
delete pUkuiMenuInterface;
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();
execApp(desktopfp);
QtConcurrent::run(execApp, QString(desktopfp));
}
}
@ -69,14 +92,21 @@ void KListView::mouseMoveEvent(QMouseEvent *e)
void KListView::mousePressEvent(QMouseEvent *event)
{
if (!(this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
Q_EMIT sendHideMainWindowSignal();
} else {
pressApp = listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
}
return QListView::mousePressEvent(event);
}
void KListView::mouseReleaseEvent(QMouseEvent *e)
{
if (!(this->indexAt(e->pos()).isValid()) && e->button() == Qt::LeftButton) {
Q_EMIT sendHideMainWindowSignal();
} else {
return QListView::mouseReleaseEvent(e);
}
}
void KListView::rightClickedSlot(const QPoint &pos)
{
if (!(this->selectionModel()->selectedIndexes().isEmpty())) {
@ -86,7 +116,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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef KLISTVIEW_H
#define KLISTVIEW_H
#include <QListView>
@ -15,15 +32,16 @@ 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);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
public:
void addData(QStringList data);
void updateData(QStringList data);

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "listview.h"
@ -21,6 +20,7 @@
#include "utility.h"
#include <QDebug>
#include <QDesktopServices>
#include <QtConcurrent/QtConcurrent>
ListView::ListView(QWidget *parent/*, int width, int height, int module*/):
KListView(parent)
@ -29,15 +29,19 @@ 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;
setAttribute(Qt::WA_AcceptTouchEvents);
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()
@ -69,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);
@ -83,18 +87,33 @@ 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);
}
}
bool ListView::event(QEvent *e)
{
switch (e->type()) {
case QEvent::TouchBegin:
m_scrollbarState = false;
break;
case QEvent::ChildRemoved:
m_scrollbarState = true;
break;
default:
break;
}
return QListView::event(e);
}
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()) {
@ -108,7 +127,7 @@ void ListView::onClicked(QModelIndex index)
Q_EMIT sendAppClassificationBtnClicked();
} else {
Q_EMIT sendHideMainWindowSignal();
execApp(desktopfp);
QtConcurrent::run(execApp, QString(desktopfp));
}
}
}
@ -116,14 +135,18 @@ void ListView::onClicked(QModelIndex index)
void ListView::enterEvent(QEvent *e)
{
Q_UNUSED(e);
if (m_scrollbarState) {
this->selectionModel()->clear();
this->verticalScrollBar()->setVisible(true);
verticalScrollBar()->setVisible(true);
}
}
void ListView::leaveEvent(QEvent *e)
{
Q_UNUSED(e);
this->verticalScrollBar()->setVisible(false);
if (m_scrollbarState) {
verticalScrollBar()->setVisible(false);
}
}
void ListView::paintEvent(QPaintEvent *e)

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef LISTVIEW_H
@ -50,11 +49,12 @@ protected:
void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *e) override;
void keyPressEvent(QKeyEvent *e);
bool event(QEvent *e);
private:
int w = 0;
int h = 0;
int m_preRowCount;
bool m_scrollbarState = true;
private Q_SLOTS:

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rightlistview.h"
@ -22,6 +21,7 @@
#include <syslog.h>
#include <QPushButton>
#include <QGSettings>
#include <QtConcurrent/QtConcurrent>
RightListView::RightListView(QWidget *parent):
KListView(parent)
@ -29,12 +29,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()
@ -68,11 +72,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);
@ -128,12 +132,12 @@ void RightListView::keyPressEvent(QKeyEvent *e)
void RightListView::onClicked(QModelIndex index)
{
Q_EMIT sendHideMainWindowSignal();
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>();
execApp(desktopfp);
Q_EMIT sendHideMainWindowSignal();
QtConcurrent::run(execApp, QString(desktopfp));
}
}

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef RIGHTLISTVIEW_H
#define RIGHTLISTVIEW_H
#include <QListView>

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tabletlistview.h"
@ -312,15 +311,15 @@ void TabletListView::mousePressEvent(QMouseEvent *event)
//左键
myDebug() << "左键点击,当前点坐标" << event->pos();
if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && (((pressedpos.x() % Style::TabletItemSizeWidthFirst) >= Style::FirstPageSpace) &&
((pressedpos.x() % Style::TabletItemSizeWidthFirst) <= (Style::FirstPageSpace + Style::AppListIconSize)) &&
((pressedpos.y() % Style::AppListItemSizeHeight) >= Style::AppTopSpace) &&
((pressedpos.y() % Style::AppListItemSizeHeight) <= (Style::AppTopSpace + Style::AppListIconSize)))) ||
if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && (((pressedpos.x() % Style::m_tabletItemSizeWidthFirst) >= Style::m_firstPageSpace) &&
((pressedpos.x() % Style::m_tabletItemSizeWidthFirst) <= (Style::m_firstPageSpace + Style::m_appListIconSize)) &&
((pressedpos.y() % Style::m_appListItemSizeHeight) >= Style::m_appTopSpace) &&
((pressedpos.y() % Style::m_appListItemSizeHeight) <= (Style::m_appTopSpace + Style::m_appListIconSize)))) ||
((this->indexAt(event->pos()).isValid()) && (m_pageNum == OTHERPAGE) &&
(pressedpos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace &&
pressedpos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize &&
pressedpos.y() % Style::AppListItemSizeHeight >= Style::AppTopSpace &&
pressedpos.y() % Style::AppListItemSizeHeight <= Style::AppTopSpace + Style::AppListIconSize))) {
(pressedpos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace &&
pressedpos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize &&
pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace &&
pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) {
pressApp = listmodel->data(this->indexAt(pressedpos), Qt::DisplayRole);
iconClick = true;
startPos = event->pos();
@ -337,15 +336,15 @@ void TabletListView::mousePressEvent(QMouseEvent *event)
//右键
myDebug() << "右键点击,当前点坐标" << event->pos();
if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && ((pressedpos.x()) % Style::TabletItemSizeWidthFirst >= Style::FirstPageSpace &&
(pressedpos.x()) % Style::TabletItemSizeWidthFirst <= Style::FirstPageSpace + Style::AppListIconSize &&
pressedpos.y() % Style::AppListItemSizeHeight >= Style::AppTopSpace &&
pressedpos.y() % Style::AppListItemSizeHeight <= Style::AppTopSpace + Style::AppListIconSize)) ||
if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && ((pressedpos.x()) % Style::m_tabletItemSizeWidthFirst >= Style::m_firstPageSpace &&
(pressedpos.x()) % Style::m_tabletItemSizeWidthFirst <= Style::m_firstPageSpace + Style::m_appListIconSize &&
pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace &&
pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize)) ||
((this->indexAt(event->pos()).isValid()) && (m_pageNum == OTHERPAGE) &&
(pressedpos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace &&
pressedpos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize &&
pressedpos.y() % Style::AppListItemSizeHeight >= Style::AppTopSpace &&
pressedpos.y() % Style::AppListItemSizeHeight <= Style::AppTopSpace + Style::AppListIconSize))) {
(pressedpos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace &&
pressedpos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize &&
pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace &&
pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) {
pressApp = listmodel->data(this->indexAt(pressedpos), Qt::DisplayRole);
right_iconClick = true;
right_pressedpos = pressedpos;
@ -362,6 +361,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()) {
@ -408,17 +408,17 @@ void TabletListView::dragMoveEvent(QDragMoveEvent *event)
m_time->start(500);
if (m_pageNum == OTHERPAGE) {
if (event->pos().x() >= (Style::OtherPageViewWidth - (Style::OtherPageSpace / 2)) || event->pos().x() <= (Style::OtherPageSpace / 2)) {
if (event->pos().x() <= (Style::OtherPageSpace / 2)) {
if (event->pos().x() >= (Style::m_otherPageViewWidth - (Style::m_otherPageSpace / 2)) || event->pos().x() <= (Style::m_otherPageSpace / 2)) {
if (event->pos().x() <= (Style::m_otherPageSpace / 2)) {
Q_EMIT pagenumchanged(false);
}
if (event->pos().x() >= (Style::OtherPageViewWidth - (Style::OtherPageSpace / 2))) {
if (event->pos().x() >= (Style::m_otherPageViewWidth - (Style::m_otherPageSpace / 2))) {
Q_EMIT pagenumchanged(true);
}
}
} else {
if (event->pos().x() >= (Style::FirsPageViewWidth - (Style::FirstPageSpace / 2))) {
if (event->pos().x() >= (Style::m_firsPageViewWidth - (Style::m_firstPageSpace / 2))) {
Q_EMIT pagenumchanged(true);
}
}
@ -429,12 +429,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 +444,7 @@ void TabletListView::dropEvent(QDropEvent *event)
}
void TabletListView::mouseReleaseEvent(QMouseEvent *e)
{
myDebug();
releasepos = e->pos();//释放的位置坐标
if (iconClick) {
@ -503,9 +506,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos)
QString desktopfn2 = fileInfo2.fileName();
if (m_pageNum == FIRSTPAGE) {
releasepos.setX(releasepos.x() + Style::OtherPageSpace);
releasepos.setX(releasepos.x() + Style::m_otherPageSpace);
} else {
releasepos.setX(releasepos.x() + Style::FirstPageSpace);
releasepos.setX(releasepos.x() + Style::m_firstPageSpace);
}
QVariant var3 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//释放位置右侧有应用
@ -514,9 +517,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos)
QString desktopfn3 = fileInfo3.fileName();
if (m_pageNum == FIRSTPAGE) {
releasepos.setX(releasepos.x() - (Style::OtherPageSpace * 2));
releasepos.setX(releasepos.x() - (Style::m_otherPageSpace * 2));
} else {
releasepos.setX(releasepos.x() - (Style::FirstPageSpace * 2));
releasepos.setX(releasepos.x() - (Style::m_firstPageSpace * 2));
}
QVariant var4 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//右侧没有左侧有
@ -620,22 +623,22 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos)
QFileInfo fileInfo2(pressDesktopfp);
QString desktopfn2 = fileInfo2.fileName();
if (((this->indexAt(releasepos).isValid()) && (m_pageNum == FIRSTPAGE) && ((releasepos.x()) % Style::TabletItemSizeWidthFirst >= Style::FirstPageSpace &&
(releasepos.x()) % Style::TabletItemSizeWidthFirst <= Style::FirstPageSpace + Style::AppListIconSize &&
releasepos.y() % Style::AppListItemSizeHeight >= Style::AppTopSpace &&
releasepos.y() % Style::AppListItemSizeHeight <= Style::AppTopSpace + Style::AppListIconSize)) ||
if (((this->indexAt(releasepos).isValid()) && (m_pageNum == FIRSTPAGE) && ((releasepos.x()) % Style::m_tabletItemSizeWidthFirst >= Style::m_firstPageSpace &&
(releasepos.x()) % Style::m_tabletItemSizeWidthFirst <= Style::m_firstPageSpace + Style::m_appListIconSize &&
releasepos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace &&
releasepos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize)) ||
((this->indexAt(releasepos).isValid()) && (m_pageNum == OTHERPAGE) &&
(releasepos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace &&
releasepos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize &&
releasepos.y() % Style::AppListItemSizeHeight >= Style::AppTopSpace &&
releasepos.y() % Style::AppListItemSizeHeight <= Style::AppTopSpace + Style::AppListIconSize))) {
(releasepos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace &&
releasepos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize &&
releasepos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace &&
releasepos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) {
return;
}
if (m_pageNum == FIRSTPAGE) {
releasepos.setX(releasepos.x() + Style::FirstPageSpace);
releasepos.setX(releasepos.x() + Style::m_firstPageSpace);
} else {
releasepos.setX(releasepos.x() + Style::OtherPageSpace);
releasepos.setX(releasepos.x() + Style::m_otherPageSpace);
}
QVariant var3 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//释放位置右侧有应用
@ -644,9 +647,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos)
QString desktopfn3 = fileInfo3.fileName();
if (m_pageNum == FIRSTPAGE) {
releasepos.setX(releasepos.x() - Style::FirstPageSpace * 2);
releasepos.setX(releasepos.x() - Style::m_firstPageSpace * 2);
} else {
releasepos.setX(releasepos.x() - Style::OtherPageSpace * 2);
releasepos.setX(releasepos.x() - Style::m_otherPageSpace * 2);
}
QVariant var4 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//右侧没有左侧有

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TABLETLISTVIEW_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "classify_btn_scrollarea.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CLASSIFYSCROLLAREA_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "lettertooltip.h"
#include <QPainter>
#include <QAction>

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef LETTERTOOLTIP_H
#define LETTERTOOLTIP_H
#include <QDialog>

View File

@ -1,6 +1,24 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "rotationlabel.h"
#include <QPainter>
#include <QDebug>
#include "utility.h"
RotationLabel::RotationLabel(QWidget *parent)
: QLabel(parent)
@ -32,6 +50,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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef ROTATIONLABEL_H
#define ROTATIONLABEL_H
#include <QLabel>
@ -13,6 +30,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

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "scrollarea.h"
@ -74,23 +73,13 @@ void ScrollAreaWid::paintEvent(QPaintEvent *event)
ScrollArea::ScrollArea()
{
// this->verticalScrollBar()->setVisible(false);
// this->setFocusPolicy(Qt::NoFocus);
//// this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
this->setFixedWidth(1330);
// this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
this->setFocusPolicy(Qt::NoFocus);
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
this->setFrameShape(QFrame::NoFrame);
// this->verticalScrollBar()->setProperty("drawScrollBarGroove",false);
// this->verticalScrollBar()->setAttribute(Qt::WA_TranslucentBackground, false);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->verticalScrollBar()->setVisible(false);
//滚动条设置
QPalette p = this->verticalScrollBar()->palette();
QColor color(255, 255, 255);
color.setAlphaF(0.25);
p.setColor(QPalette::Active, QPalette::Button, color);
this->verticalScrollBar()->setPalette(p);
this->horizontalScrollBar()->setVisible(false);
this->setStyleSheet("QWidget{background:transparent;}");
}
void ScrollArea::setFocusToNextChild()

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SCROLLAREA_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "menubox.h"
#include <QDebug>
#include <QMouseEvent>

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef MENUBOX_H
#define MENUBOX_H
#include <QMenu>

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rightclickmenu.h"
@ -47,8 +46,15 @@ RightClickMenu::RightClickMenu(QWidget *parent):
RightClickMenu::~RightClickMenu()
{
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)
@ -101,6 +107,36 @@ void RightClickMenu::removeFromCollectionActionTriggerSlot()
m_actionNumber = 18;
}
bool RightClickMenu::hasMultipleUsers()
{
QDBusInterface interface("org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus());
if (!interface.isValid()) {
qCritical() << QDBusConnection::systemBus().lastError().message();
return false;
}
QDBusReply<QVariant> reply = interface.call("Get","org.freedesktop.Accounts","HasMultipleUsers");
return reply.value().toBool();
}
bool RightClickMenu::canSwitch()
{
QDBusInterface interface("org.freedesktop.DisplayManager",
"/org/freedesktop/DisplayManager/Seat0",
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus());
if (!interface.isValid()) {
qCritical() << QDBusConnection::systemBus().lastError().message();
return false;
} else {
QDBusReply<QVariant> reply = interface.call("Get","org.freedesktop.DisplayManager.Seat","CanSwitch");
return reply.value().toBool();
}
}
void RightClickMenu::fixToTaskbarActionTriggerSlot()
{
QDBusInterface iface("com.ukui.panel.desktop",
@ -265,26 +301,26 @@ int RightClickMenu::showShutdownMenu(const QPoint &pos, const bool &isFullWind)
{
m_actionNumber = 0;
MenuBox m_showShutMenu;
QDBusReply<bool> reply;
connect(&m_showShutMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
QDBusInterface iface(DBUS_SESSION_NAME, DBUS_SESSION_PATH,
DBUS_SESSION_INTERFACE, QDBusConnection::sessionBus());
QDBusReply<bool> reply = iface.call("canSwitch");
if (reply.isValid() && reply.value() == true) {
if (canSwitch() && hasMultipleUsers()) {
m_showShutMenu.addAction(QIcon(getIconPixmap("stock-people-symbolic", 1)), tr("Switch user"),
this, SLOT(switchUserActionTriggerSlot()));
}
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()));
}
@ -293,21 +329,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

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef RIGHTCLICKMENU_H
@ -78,7 +77,6 @@ private:
int m_actionNumber;
QProcess *m_cmdProc = nullptr;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
QStringList m_whiteList;
protected:
@ -92,6 +90,10 @@ protected:
*/
QPixmap getIconPixmap(QString iconstr, int type);
bool hasMultipleUsers();
bool canSwitch();
private Q_SLOTS:
/**
* @brief Fixed to all software

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tabletrightclickmenu.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TABLETRIGHTCLICKMENU_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "full_item_delegate.h"
@ -24,12 +23,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 +71,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,13 +117,13 @@ 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,
rect.y() + 20,
Style::AppListIconSize,
Style::AppListIconSize);
iconRect = QRect(rect.x() + (rect.width() - Style::m_appListIconSize) / 2,
rect.y() + Style::m_appTopSpace,
Style::m_appListIconSize,
Style::m_appListIconSize);
icon.paint(painter, iconRect);
painter->restore();
painter->save();
@ -140,9 +142,9 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
painter->restore();
textRect = QRect(rect.x() + 5,
iconRect.bottom() + Style::AppSpaceBetweenIconText,
iconRect.bottom() + Style::m_appSpaceBetweenIconText,
rect.width() - 10,
rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText);
Style::m_appTextRectHeight);
painter->save();
//添加最近安装蓝色标签
bool is_recentapp = false;
@ -153,9 +155,9 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
is_recentapp = true;
appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 23, Qt::TextShowMnemonic);
textRect = QRect(rect.x() + 18,
iconRect.bottom() + Style::AppSpaceBetweenIconText,
iconRect.bottom() + Style::m_appSpaceBetweenIconText,
rect.width() - 23,
rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText);
Style::m_appTextRectHeight);
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
int x = 0;
@ -217,5 +219,5 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
QSize FullItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
return QSize(Style::AppListItemSizeWidth, Style::AppListItemSizeWidth);
return QSize(Style::m_appListItemSizeWidth, Style::m_appListItemSizeWidth);
}

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLITEMDELEGATE_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "itemdelegate.h"
@ -26,12 +25,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 +88,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 +132,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(),
@ -155,7 +157,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
if (option.state & QStyle::State_MouseOver) {
QToolTip::showText(QCursor::pos(), appname);
} else {
QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.bottomRight().x(), rect.center().y())), appname);
QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.bottomRight().x(), rect.bottom())), appname);
}
} else {
QToolTip::hideText();
@ -227,6 +229,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = strlist.at(1);
QString url = QUrl(strlist.at(0)).path().remove(appname);
painter->setOpacity(1);
painter->save();
painter->setPen(QPen(option.palette.text().color()));
@ -239,21 +242,21 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->restore();
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
QToolTip::showText(QCursor::pos(), "为了刷新");
int len = fm.boundingRect(appname).width();
//富文本,tooltip可自动换行
QString tipString = QString("<font>");
if (len > rect.width() - 64) {
if (option.state & QStyle::State_MouseOver) {
QToolTip::showText(QCursor::pos(), appname);
tipString += appname +"<br>"+ tr("path:") + url;
} else {
QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.bottomRight().x(), rect.center().y())), appname);
}
} else {
QToolTip::hideText();
tipString += tr("path:") + url;
}
tipString += QString("</font>");
QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.right() + 20, rect.center().y())), tipString);
}
} 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

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ITEMDELEGATE_H

View File

@ -1,6 +1,27 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "kitemdelegate.h"
KItemDelegate::KItemDelegate(QObject *parent):
QStyledItemDelegate(parent)
{
}
KItemDelegate::~KItemDelegate()
{
}

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef KITEMDELEGATE_H
#define KITEMDELEGATE_H
#include <QStyledItemDelegate>
@ -8,9 +25,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

@ -1,18 +1,38 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#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
@ -130,7 +150,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);
@ -173,7 +193,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();
@ -219,7 +239,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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef RECENTITEMDELEGATE_H
#define RECENTITEMDELEGATE_H
#include "itemdelegate.h"
@ -8,15 +25,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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "right_item_delegate.h"
#include "utility.h"
#include <QDebug>
@ -5,12 +22,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
@ -65,7 +85,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);
@ -111,7 +131,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,
@ -139,9 +159,9 @@ void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
is_recentapp = true;
appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 23, Qt::TextShowMnemonic);
textRect = QRect(rect.x() + 18,
iconRect.bottom() + Style::AppSpaceBetweenIconText,
iconRect.bottom() + Style::m_appSpaceBetweenIconText,
rect.width() - 23,
rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText);
rect.height() - iconRect.height() - Style::m_appSpaceBetweenIconText);
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
int x = 0;

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef RIGHTITEMDELEGATE_H
#define RIGHTITEMDELEGATE_H
#include <QStyledItemDelegate>

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tablet_full_itemdelegate.h"
@ -112,14 +111,14 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
}
bool bigIcon = index.data(Qt::UserRole + 2).toBool();
int iconTopSpace = (rect.height() - Style::AppListIconSize) / 2;
int iconLeftSpace = (rect.width() - Style::AppListIconSize) / 2;
int iconTopSpace = (rect.height() - Style::m_appListIconSize) / 2;
int iconLeftSpace = (rect.width() - Style::m_appListIconSize) / 2;
if (bigIcon) {
iconRect = QRect(rect.x() + iconLeftSpace - 6,
rect.y() + iconTopSpace - 6,
Style::AppListIconSize + 12,
Style::AppListIconSize + 12);
Style::m_appListIconSize + 12,
Style::m_appListIconSize + 12);
textRect = QRect(rect.x(),
rect.bottom() - iconTopSpace,
rect.width(),
@ -127,8 +126,8 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
} else {
iconRect = QRect(rect.x() + iconLeftSpace,
rect.y() + iconTopSpace,
Style::AppListIconSize,
Style::AppListIconSize);
Style::m_appListIconSize,
Style::m_appListIconSize);
textRect = QRect(rect.x(),
rect.bottom() - iconTopSpace,
rect.width(),
@ -165,10 +164,10 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QPixmap pixmap;
if (bigIcon) {
pixmap = icon.pixmap((Style::AppListBigIconSize, Style::AppListBigIconSize), QIcon::Disabled, QIcon::Off); //wgx
pixmap = pixmap.scaled(Style::AppListBigIconSize, Style::AppListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
pixmap = icon.pixmap((Style::m_appListBigIconSize, Style::m_appListBigIconSize), QIcon::Disabled, QIcon::Off); //wgx
pixmap = pixmap.scaled(Style::m_appListBigIconSize, Style::m_appListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} else {
pixmap = icon.pixmap((Style::AppListIconSize, Style::AppListIconSize), QIcon::Disabled, QIcon::Off); //wgx
pixmap = icon.pixmap((Style::m_appListIconSize, Style::m_appListIconSize), QIcon::Disabled, QIcon::Off); //wgx
}
icon = QIcon(pixmap);
@ -176,10 +175,10 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QPixmap mPixmap;
if (bigIcon) {
mPixmap = icon.pixmap((Style::AppListBigIconSize, Style::AppListBigIconSize)); //wgx
mPixmap = mPixmap.scaled(Style::AppListBigIconSize, Style::AppListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
mPixmap = icon.pixmap((Style::m_appListBigIconSize, Style::m_appListBigIconSize)); //wgx
mPixmap = mPixmap.scaled(Style::m_appListBigIconSize, Style::m_appListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} else {
mPixmap = icon.pixmap((Style::AppListIconSize, Style::AppListIconSize)); //wgx
mPixmap = icon.pixmap((Style::m_appListIconSize, Style::m_appListIconSize)); //wgx
}
icon = QIcon(mPixmap);
@ -209,6 +208,6 @@ QSize TabletFullItemDelegate::sizeHint(const QStyleOptionViewItem &option, const
// {
// return QSize(0,0);
// }
return QSize(Style::TabletItemSizeWidthFirst, Style::AppListItemSizeHeight);
return QSize(Style::m_tabletItemSizeWidthFirst, Style::m_appListItemSizeHeight);
}

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TABLETITEMDELEGATE_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "animationpage.h"
#include "utility.h"
#include <QPainter>

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef ANIMATIONPAGE_H
#define ANIMATIONPAGE_H
#include <QLabel>

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "full_commonuse_widget.h"
@ -31,7 +30,10 @@ FullCommonUseWidget::FullCommonUseWidget(QWidget *parent) :
FullCommonUseWidget::~FullCommonUseWidget()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullCommonUseWidget::initUi()
@ -48,11 +50,11 @@ void FullCommonUseWidget::initUi()
m_scrollArea = new ScrollArea();
m_scrollAreaWid = new ScrollAreaWid(this);
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
m_scrollArea->setWidget(m_scrollAreaWid);
m_scrollArea->setAlignment(Qt::AlignCenter);
m_scrollArea->setStyleSheet("QWidget{background:transparent;}");
m_scrollArea->setWidgetResizable(true);
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid);
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
m_scrollAreaWidLayout->setSpacing(10);
@ -146,9 +148,9 @@ void FullCommonUseWidget::initAppListWidget()
m_listView = new FullListView(this, 0);
m_listView->installEventFilter(this);
m_scrollAreaWidLayout->addWidget(m_listView);
m_listView->setFixedWidth(m_scrollArea->width());
connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullCommonUseWidget::execApplication);
m_listView->setFixedWidth(m_scrollAreaWid->width());
connect(m_listView, &FullListView::sendUpdateAppListSignal, this, &FullCommonUseWidget::updateListViewSlot);
connect(m_listView, &FullListView::sendCollectViewUpdate, this, &FullCommonUseWidget::sendCollectViewUpdate);
connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullCommonUseWidget::sendHideMainWindowSignal);
connect(m_listView, &FullListView::sendSetslidebar, this, &FullCommonUseWidget::onSetSlider);
}
@ -184,15 +186,6 @@ void FullCommonUseWidget::fillAppList()
resizeScrollAreaControls();
}
/**
*
*/
void FullCommonUseWidget::execApplication(QString desktopfp)
{
Q_EMIT sendHideMainWindowSignal();
execApp(desktopfp);
}
void FullCommonUseWidget::selectFirstItem()
{
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
@ -281,7 +274,7 @@ void FullCommonUseWidget::updateListView()
void FullCommonUseWidget::repaintWidget()
{
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
m_scrollAreaWidLayout->removeWidget(m_listView);
m_listView->setParent(nullptr);
delete m_listView;

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLCOMMONUSEWIDGET_H
@ -102,11 +101,6 @@ protected:
bool eventFilter(QObject *watched, QEvent *event);
public Q_SLOTS:
/**
* @brief Open the application
* @param arg: Desktop file path
*/
void execApplication(QString desktopfp);
/**
* @brief Update the application list slot function
*/
@ -134,6 +128,7 @@ Q_SIGNALS:
void changeScrollValue(int value, int maximumValue);
void setFocusToSideWin();
void sendUpdateOtherView();
void sendCollectViewUpdate();
};
#endif // FULLCOMMONUSEWIDGET_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "full_function_widget.h"
@ -32,7 +31,10 @@ FullFunctionWidget::FullFunctionWidget(QWidget *parent) :
FullFunctionWidget::~FullFunctionWidget()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullFunctionWidget::initUi()
@ -45,7 +47,7 @@ void FullFunctionWidget::initUi()
m_iconListWid = new QWidget(this);
m_iconListWid->setAttribute(Qt::WA_TranslucentBackground);
m_iconListWid->setAutoFillBackground(false);
m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_applistWid->setFixedWidth(Style::m_applistAreaWidth);
m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
m_verticalScrollBar = new QScrollBar(m_scrollArea);
m_verticalScrollBar->installEventFilter(this);
@ -111,15 +113,15 @@ void FullFunctionWidget::initAppListWidget()
layout->setContentsMargins(0, 0, 0, 0);
m_applistWid->setLayout(layout);
m_scrollArea = new ScrollArea;
m_scrollArea->setStyleSheet("background:transparent");
m_scrollAreaWid = new ScrollAreaWid(this);
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
m_scrollAreaWid->adjustSize();
m_scrollArea->setWidget(m_scrollAreaWid);
m_scrollArea->setWidgetResizable(true);
m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid);
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
m_scrollAreaWidLayout->setSpacing(10);
m_scrollAreaWidLayout->setSpacing(0);
layout->addWidget(m_scrollArea);
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
this, &FullFunctionWidget::valueChangedSlot);
@ -183,7 +185,7 @@ void FullFunctionWidget::fillAppList()
void FullFunctionWidget::insertClassificationBtn(QString category)
{
SplitBarFrame *classificationbtn = new SplitBarFrame(this, category, m_scrollArea->width() - 12, 30, 2);
SplitBarFrame *classificationbtn = new SplitBarFrame(this, category, m_scrollArea->width() - 12, 50, 2);
classificationbtn->setAttribute(Qt::WA_TranslucentBackground);
classificationbtn->setAutoFillBackground(false);
m_scrollAreaWidLayout->addWidget(classificationbtn);
@ -208,18 +210,9 @@ void FullFunctionWidget::insertAppList(QStringList desktopfplist)
}
listview->addData(m_data);
connect(listview, &FullListView::sendItemClickedSignal, this, &FullFunctionWidget::execApplication);
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullFunctionWidget::sendHideMainWindowSignal);
connect(listview, &FullListView::sendUpdateAppListSignal, this, &FullFunctionWidget::sendUpdateCommonView);
}
/**
*
*/
void FullFunctionWidget::execApplication(QString desktopfp)
{
Q_EMIT sendHideMainWindowSignal();
execApp(desktopfp);
connect(listview, &FullListView::sendCollectViewUpdate, this, &FullFunctionWidget::sendCollectViewUpdate);
}
void FullFunctionWidget::on_setAreaScrollBarValue(int value)
@ -298,7 +291,7 @@ void FullFunctionWidget::resizeScrollAreaControls()
row++;
}
m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight - 10);
m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight);
}
/**
@ -307,7 +300,7 @@ void FullFunctionWidget::resizeScrollAreaControls()
void FullFunctionWidget::initIconListWidget()
{
m_iconListWidLayout = new QVBoxLayout(m_iconListWid);
m_iconListWidLayout->setSpacing(Style::LeftSpaceBetweenItem);
m_iconListWidLayout->setSpacing(Style::m_leftSpaceBetweenItem);
m_iconListWidLayout->setContentsMargins(45, 0, 0, 0);
m_topSpacerItem = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding);
m_bottomSpacerItem = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding);
@ -322,7 +315,7 @@ void FullFunctionWidget::initIconListWidget()
void FullFunctionWidget::on_setScrollBarValue(int value)
{
m_verticalScrollBar->setMaximum(m_scrollAreaWidHeight - Style::m_applistWidHeight);
m_verticalScrollBar->setMaximum(m_scrollAreaWidHeight - Style::m_applistWidHeight + Style::m_scrollBarHeight);
m_verticalScrollBar->setValue(value);
}
@ -335,9 +328,9 @@ void FullFunctionWidget::initIconListScrollArea()
for (int i = 0; i < m_classificationList.size(); i++) {
FunctionClassifyButton *iconbtn = new FunctionClassifyButton(
Style::LeftBtnWidth,
Style::LeftBtnHeight,
Style::LeftIconSize,
Style::m_leftBtnWidth,
Style::m_leftBtnHeight,
Style::m_leftIconSize,
m_classificationList.at(i),
true,
true);
@ -414,13 +407,18 @@ void FullFunctionWidget::valueChangedSlot(int value)
int index = 0;
while (index <= m_classificationList.count() - 1) {
int min = m_scrollAreaWidLayout->itemAt(2 * index)->widget()->y();
int min = 0;
int max = 0;
if (index == m_classificationList.count() - 1) {
min = m_scrollAreaWidLayout->itemAt(2 * index - 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
max = m_scrollAreaWid->height();
} else if (index == 0) {
min = 0;
max = m_scrollAreaWidLayout->itemAt(2 * index + 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
} else {
max = m_scrollAreaWidLayout->itemAt(2 * (index + 1))->widget()->y();
min = m_scrollAreaWidLayout->itemAt(2 * index - 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
max = m_scrollAreaWidLayout->itemAt(2 * index + 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
}
if (value >= min && value < max) {
@ -452,9 +450,9 @@ void FullFunctionWidget::enterAnimation()
m_animation->setDuration(200);//动画总时间
m_animation->setStartValue(QRect(0, 0,
0, m_iconListWid->height()));
m_animation->setEndValue(QRect(Style::LeftMargin,
m_animation->setEndValue(QRect(Style::m_leftMargin,
0,
Style::LeftBtnWidth,
Style::m_leftBtnWidth,
m_iconListWid->height()));
m_animation->setEasingCurve(QEasingCurve::InQuart);
m_animation->start();
@ -464,16 +462,16 @@ void FullFunctionWidget::enterAnimation()
void FullFunctionWidget::setFunctionBtnGeometry()
{
// int height=m_classificationList.size()*Style::LeftBtnHeight+(m_classificationList.size()-1)*Style::LeftSpaceBetweenItem;
m_iconListScrollAreaWid->setGeometry(QRect(Style::LeftMargin,
m_iconListScrollAreaWid->setGeometry(QRect(Style::m_leftMargin,
0,
Style::LeftBtnWidth,
Style::m_leftBtnWidth,
m_iconListWid->height()));
m_iconListScrollAreaWid->show();
}
void FullFunctionWidget::repaintWidget()
{
m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_applistWid->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight + Style::m_scrollBarHeight);
m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
updateAppListView();

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLFUNCTIONWIDGET_H
@ -142,11 +141,6 @@ protected:
bool eventFilter(QObject *watched, QEvent *event);
public Q_SLOTS:
/**
* @brief Open the application
* @param arg: Desktop file path
*/
void execApplication(QString desktopfp);
/**
* @brief Respond to button click
* @param btn: QButtonGroup button
@ -197,6 +191,7 @@ Q_SIGNALS:
void sendUpdateCommonView();
void sendCollectViewUpdate();
};
#endif // FULLFUNCTIONWIDGET_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "full_letter_widget.h"
@ -28,8 +27,14 @@ FullLetterWidget::FullLetterWidget(QWidget *parent) :
FullLetterWidget::~FullLetterWidget()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
if (m_letterListBottomSpacer) {
delete m_letterListBottomSpacer;
m_letterListBottomSpacer = nullptr;
}
}
/**
@ -41,7 +46,7 @@ void FullLetterWidget::initUi()
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->setAttribute(Qt::WA_TranslucentBackground);
m_letterListWid = new QWidget(this);
m_letterListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
m_letterListWid->setFixedWidth(Style::m_leftWidWidth);
m_verticalScrollBar = new QScrollBar(m_scrollArea);
m_verticalScrollBar->installEventFilter(this);
m_verticalScrollBar->setOrientation(Qt::Vertical);
@ -77,15 +82,13 @@ void FullLetterWidget::initAppListWidget()
// layout->setContentsMargins(0,0,0,0);
// m_applistWid->setLayout(layout);
m_scrollArea = new ScrollArea();
m_scrollArea->setStyleSheet("background:transparent");
m_scrollAreaWid = new ScrollAreaWid(this);
m_scrollArea->setWidget(m_scrollAreaWid);
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setWidgetResizable(true);
// m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
m_scrollAreaWidLayout = new QVBoxLayout;
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
m_scrollAreaWidLayout->setSpacing(10);
m_scrollAreaWidLayout->setSpacing(0);
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
m_mainLayout->addWidget(m_scrollArea);
QSpacerItem *m_spaceItem1 = nullptr;
@ -189,7 +192,7 @@ void FullLetterWidget::fillAppList()
m_letterList.append(letterstr);//存储分类字符
//插入字母分类按钮
SplitBarFrame *letterbtn = new SplitBarFrame(this, letterstr, m_scrollArea->width() - 12, 30, 1);
SplitBarFrame *letterbtn = new SplitBarFrame(this, letterstr, m_scrollArea->width() - 12, 50, 1);
m_scrollAreaWidLayout->addWidget(letterbtn);
//插入应用列表
FullListView *listview = new FullListView(this, 1);
@ -208,24 +211,15 @@ void FullLetterWidget::fillAppList()
}
listview->addData(m_data);
connect(listview, &FullListView::sendItemClickedSignal, this, &FullLetterWidget::execApplication);
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullLetterWidget::sendHideMainWindowSignal);
connect(listview, &FullListView::sendUpdateAppListSignal, this, &FullLetterWidget::sendUpdateCommonView);
connect(listview, &FullListView::sendCollectViewUpdate, this, &FullLetterWidget::sendCollectViewUpdate);
}
}
resizeScrollAreaControls();
}
/**
*
*/
void FullLetterWidget::execApplication(QString desktopfp)
{
Q_EMIT sendHideMainWindowSignal();
execApp(desktopfp);
}
void FullLetterWidget::on_setAreaScrollBarValue(int value)
{
// m_scrollArea->verticalScrollBar()->setMaximum(maxmumValue);
@ -277,7 +271,7 @@ void FullLetterWidget::updateAppListView()
void FullLetterWidget::on_setScrollBarValue(int value)
{
m_verticalScrollBar->setMaximum(m_scrollAreaWidHeight - Style::m_applistWidHeight);
m_verticalScrollBar->setMaximum(m_scrollAreaWidHeight - Style::m_applistWidHeight + Style::m_scrollBarHeight);
m_verticalScrollBar->setValue(value);
}
@ -305,11 +299,12 @@ void FullLetterWidget::resizeScrollAreaControls()
}
listview->setFixedSize(m_scrollArea->width(), listview->gridSize().height() * rowcount);
areaHeight += listview->height() + 50;
areaHeight += (listview->height() + 50);
row++;
}
m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight - 10);
m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight);
}
/**
@ -346,7 +341,7 @@ void FullLetterWidget::initLetterListScrollArea()
LetterClassifyButton *letterbtn = new LetterClassifyButton(m_letterListWid,
true,
m_letterList.at(i));
letterbtn->setFixedSize(Style::LeftLetterBtnHeight, Style::LeftLetterBtnHeight);
letterbtn->setFixedSize(Style::m_leftLetterBtnHeight, Style::m_leftLetterBtnHeight);
m_buttonList.append(letterbtn);
m_letterListWidLayout->addWidget(letterbtn);
m_letterListWidLayout->setAlignment(letterbtn, Qt::AlignLeft);
@ -427,13 +422,19 @@ void FullLetterWidget::valueChangedSlot(int value)
int index = 0;
while (index <= m_letterList.count() - 1) {
int min = m_scrollAreaWidLayout->itemAt(2 * index)->widget()->y();
int min = 0;
int max = 0;
if (index == m_letterList.count() - 1) {
min = m_scrollAreaWidLayout->itemAt(2 * index - 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
max = m_scrollAreaWid->height();
} else if (index == 0) {
min = 0;
max = m_scrollAreaWidLayout->itemAt(2 * index + 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
} else {
max = m_scrollAreaWidLayout->itemAt(2 * (index + 1))->widget()->y();
min = m_scrollAreaWidLayout->itemAt(2 * index - 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
max = m_scrollAreaWidLayout->itemAt(2 * index + 1)->widget()->geometry().bottom() - Style::m_boundaryOffset;
}
if (value >= min && value < max) {
@ -457,12 +458,12 @@ void FullLetterWidget::valueChangedSlot(int value)
void FullLetterWidget::enterAnimation()
{
m_animation->setDuration(200);//动画总时间
m_animation->setStartValue(QRect(0, (m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2,
0, (m_letterList.size() + 1)*Style::LeftLetterBtnHeight));
m_animation->setEndValue(QRect(Style::LeftMargin,
(m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2,
Style::LeftLetterBtnHeight * 2,
(m_letterList.size() + 1)*Style::LeftLetterBtnHeight));
m_animation->setStartValue(QRect(0, (m_letterListWid->height() - (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight) / 2,
0, (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight));
m_animation->setEndValue(QRect(Style::m_leftMargin,
(m_letterListWid->height() - (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight) / 2,
Style::m_leftLetterBtnHeight * 2,
(m_letterList.size() + 1)*Style::m_leftLetterBtnHeight));
m_animation->setEasingCurve(QEasingCurve::InQuart);
m_animation->start();
// m_letterListScrollArea->show();
@ -480,7 +481,8 @@ void FullLetterWidget::setLetterBtnGeometry()
void FullLetterWidget::repaintWidget()
{
m_letterListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight + Style::m_scrollBarHeight);
m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth);
updateAppListView();
}

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLLETTERWIDGET_H
@ -147,11 +146,6 @@ public Q_SLOTS:
* @param btn: QButtonGroup button
*/
void btnGroupClickedSlot(QAbstractButton *btn);
/**
* @brief Open the application
* @param arg: Desktop file path
*/
void execApplication(QString desktopfp);
/**
* @brief Update application list slot function
*/
@ -199,6 +193,8 @@ Q_SIGNALS:
void changeScrollValue(int value, int maximumValue);
void sendUpdateCommonView();
void sendCollectViewUpdate();
};
#endif // FULLLETTERWIDGET_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "full_searchresult_widget.h"
#include <QHeaderView>
@ -29,7 +28,10 @@ FullSearchResultWidget::FullSearchResultWidget(QWidget *parent) :
FullSearchResultWidget::~FullSearchResultWidget()
{
if (m_ukuiMenuInterface) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullSearchResultWidget::initUi()
@ -47,7 +49,7 @@ void FullSearchResultWidget::initUi()
m_scrollArea->setStyleSheet("background:transparent");
m_scrollAreaWid = new ScrollAreaWid(this);
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
m_scrollArea->setWidget(m_scrollAreaWid);
m_scrollArea->setWidgetResizable(true);
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -136,9 +138,9 @@ void FullSearchResultWidget::initAppListWidget()
m_listView->installEventFilter(this);
m_scrollAreaWidLayout->addWidget(m_listView);
m_listView->setFixedWidth(m_scrollArea->width());
connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullSearchResultWidget::execApplication);
connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullSearchResultWidget::sendHideMainWindowSignal);
connect(m_listView, &FullListView::sendSetslidebar, this, &FullSearchResultWidget::onSetSlider);
connect(m_listView, &FullListView::sendCollectViewUpdate, this, &FullSearchResultWidget::sendCollectViewUpdate);
}
void FullSearchResultWidget::fillAppList()
@ -147,14 +149,6 @@ void FullSearchResultWidget::fillAppList()
m_listView->addData(m_data);
resizeScrollAreaControls();
}
/**
*
*/
void FullSearchResultWidget::execApplication(QString desktopfp)
{
Q_EMIT sendHideMainWindowSignal();
execApp(desktopfp);
}
void FullSearchResultWidget::updateAppListView(QVector<QStringList> arg)
{
@ -228,7 +222,7 @@ void FullSearchResultWidget::selectFirstItemTab()
void FullSearchResultWidget::repaintWidget()
{
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
resizeScrollAreaControls();
m_scrollAreaWidHeight = m_scrollAreaWid->height() + 1;
initVerticalScrollBar();

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FULLSEARCHRESULTWIDGET_H
@ -90,11 +89,6 @@ protected:
bool eventFilter(QObject *watched, QEvent *event);
public Q_SLOTS:
/**
* @brief Open the application
* @param arg: Desktop file path
*/
void execApplication(QString desktopfp);
void selectFirstItemTab();
@ -114,6 +108,7 @@ Q_SIGNALS:
*/
void sendHideMainWindowSignal();
void setFocusToSideWin();
void sendCollectViewUpdate();
};
#endif // FULLSEARCHRESULTWIDGET_H

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "function_Widget.h"
#include "style.h"
#include <QVBoxLayout>
@ -6,7 +23,6 @@
#include <QLocale>
#include <qwindow.h>
#include <QDir>
#include <AbstractInterface.h>
#include <QPluginLoader>
#include "currenttime_interface.h"
#include "style.h"
@ -210,7 +226,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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef FUNCTIONWIDGET_H
#define FUNCTIONWIDGET_H
@ -11,7 +28,6 @@
#include <QDateTime>
#include <QGSettings>
#include <QSettings>
#include "AbstractInterface.h"
#include <QGraphicsDropShadowEffect>
#include "plugin_widget.h"
#include "currenttime_interface.h"
@ -23,7 +39,7 @@ public:
FunctionWidget(QWidget *parent);
~FunctionWidget();
//QWidget* focusPlug=nullptr;
pluginwidget *focusPlug = nullptr;
PluginWidget *focusPlug = nullptr;
void setDownOpacityEffect(const qreal &num);
protected:

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "function_button_widget.h"
@ -55,9 +54,9 @@ void FunctionButtonWidget::initUi()
for (int row = 0; row < 6; row++)
for (int col = 0; col < 2; col++) {
FunctionClassifyButton *iconbtn = new FunctionClassifyButton(Style::LeftBtnWidth,
Style::LeftBtnHeight,
Style::LeftIconSize,
FunctionClassifyButton *iconbtn = new FunctionClassifyButton(Style::m_leftBtnWidth,
Style::m_leftBtnHeight,
Style::m_leftIconSize,
m_categoryList.at(row * 2 + col),
false,
false);

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FUNCTIONBUTTONWIDGET_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "letter_button_widget.h"

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef LETTERBUTTONWIDGET_H

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "main_view_widget.h"
@ -55,23 +54,12 @@ void MainViewWidget::styleChangeSlot(const QString &style)
void MainViewWidget::paintEvent(QPaintEvent *event)
{
// double transparency = getTransparency();
QRect rect = this->rect();
QRect rect = this->rect().adjusted(5, 5, 0, -5);
QPainterPath path;
QPainter painter(this);
path.addRoundedRect(rect, 10, 10);
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
painter.setPen(Qt::transparent);
qreal radius = 10;
path.moveTo(rect.topRight() - QPointF(radius, 0));
path.lineTo(rect.topLeft() + QPointF(radius, 0));
path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
path.lineTo(rect.bottomLeft() + QPointF(0, -radius));
path.quadTo(rect.bottomLeft(), rect.bottomLeft() + QPointF(radius, 0));
path.lineTo(rect.bottomRight() - QPointF(radius, 0));
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
painter.setPen(Qt::transparent);
painter.setOpacity(0.58);
painter.fillPath(path, m_backColor);
QWidget::paintEvent(event);

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MAINVIEWWIDGET_H

View File

@ -1,14 +1,31 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef PLUGINWIDGET_H
#define PLUGINWIDGET_H
@ -8,8 +25,6 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPluginLoader>
#include <AbstractInterface.h>
#include <abstractInterface.h>
#include <QLibrary>
#include <QEvent>
#include <QLabel>
@ -17,11 +32,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,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "splitbar_frame.h"
@ -45,7 +44,7 @@ void SplitBarFrame::initAppBtn()
layout->setContentsMargins(15, 0, 0, 0);
layout->setSpacing(6);
m_textLabel->setAutoFillBackground(false);
m_textLabel->setAlignment(Qt::AlignCenter);
m_textLabel->setAlignment(Qt::AlignTop);
m_textLabel->setText(m_category);
m_textLabel->adjustSize();
QPalette pe = m_textLabel->palette();

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef PUSHBUTTON_H

View File

@ -1,36 +0,0 @@
#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,25 +0,0 @@
#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

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#include "full_mainwindow.h"
#include <KWindowEffects>
#include <QAction>
@ -216,11 +233,15 @@ void FullMainWindow::initConnect()
connect(this, &FullMainWindow::sendSetFocusToResult, m_fullResultPage, &FullSearchResultWidget::selectFirstItemTab);
// connect(m_fullSelectMenuButton, &QToolButton::clicked, this, &FullMainWindow::on_fullSelectMenuButton_clicked);
connect(m_fullCommonPage, &FullCommonUseWidget::sendUpdateOtherView, this, &FullMainWindow::sendUpdateOtherView);
connect(m_fullCommonPage, &FullCommonUseWidget::sendCollectViewUpdate, this, &FullMainWindow::sendCollectViewUpdate);
connect(m_fullFunctionPage, &FullFunctionWidget::sendUpdateCommonView, m_fullCommonPage, &FullCommonUseWidget::updateListViewSlot);
connect(m_fullFunctionPage, &FullFunctionWidget::sendCollectViewUpdate, this, &FullMainWindow::sendCollectViewUpdate);
connect(m_fullLetterPage, &FullLetterWidget::sendUpdateCommonView, m_fullCommonPage, &FullCommonUseWidget::updateListViewSlot);
connect(m_fullLetterPage, &FullLetterWidget::sendCollectViewUpdate, this, &FullMainWindow::sendCollectViewUpdate);
connect(m_fullCommonPage, &FullCommonUseWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
connect(m_fullFunctionPage, &FullFunctionWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
connect(m_fullLetterPage, &FullLetterWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
connect(m_fullResultPage, &FullSearchResultWidget::sendCollectViewUpdate, this, &FullMainWindow::sendCollectViewUpdate);
connect(m_fullResultPage, &FullSearchResultWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
connect(m_dropDownMenu, &MenuBox::triggered, this, &FullMainWindow::on_fullSelectMenuButton_triggered);
connect(m_dropDownMenu, &MenuBox::sendMainWinActiveSignal, [ = ]() {
@ -315,7 +336,7 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event)
m_queryText->setParent(nullptr);
}
m_queryWid->setGeometry(6, 2, m_queryIcon->width() + 5, Style::QueryLineEditHeight);
m_queryWid->setGeometry(6, 2, m_queryIcon->width() + 5, Style::m_queryLineEditHeight);
m_queryWid->layout()->setAlignment(Qt::AlignVCenter);
m_lineEdit->setTextMargins(26, 0, 0, 0);
}
@ -511,10 +532,15 @@ void FullMainWindow::searchAppSlot(QString arg)
void FullMainWindow::mousePressEvent(QMouseEvent *event)
{
resetEditline();
return QMainWindow::mousePressEvent(event);
}
void FullMainWindow::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
this->hide();
}
return QMainWindow::mousePressEvent(event);
return QMainWindow::mouseReleaseEvent(event);
}
void FullMainWindow::recvSearchResult(QVector<QStringList> arg)

View File

@ -1,3 +1,20 @@
/*
* Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
*/
#ifndef FULLMAINWINDOW_H
#define FULLMAINWINDOW_H
@ -35,6 +52,7 @@ Q_SIGNALS:
void sendSetFocusToLet();
void sendSetFocusToResult();
void sendUpdateOtherView();
void sendCollectViewUpdate();
private Q_SLOTS:
@ -53,6 +71,7 @@ protected:
bool event(QEvent *event);
bool eventFilter(QObject *watched, QEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void changeStyle();
void initConnect();
void initTabOrder();

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "mainwindow.h"
@ -41,7 +40,7 @@ MainWindow::MainWindow(QWidget *parent) :
Style::initWidStyle();
openDataBase("MainThreadDataBase");
initDatabase();
this->resize(Style::minw, Style::minh);
this->resize(Style::m_minw, Style::m_minh);
this->setAutoFillBackground(false);
m_centralwidget = new QWidget(this);
m_centerLayout = new QHBoxLayout(m_centralwidget);
@ -62,8 +61,6 @@ MainWindow::MainWindow(QWidget *parent) :
m_softwareDbThread = new SoftwareDatabaseUpdateThread;
m_animationPage = new AnimationPage();
m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this);
m_minAnimation = new QPropertyAnimation(m_animationPage, "geometry", this);
m_searchAppThread = new SearchAppThread;
m_functionBtnWid = new FunctionButtonWidget(m_minFuncPage);
m_functionBtnWid->hide();
@ -209,13 +206,12 @@ void MainWindow::initSignalConnect()
connect(m_letterBtnWid, &LetterButtonWidget::sendLetterBtnSignal, this, &MainWindow::recvFunctionBtnSignal);
connect(m_functionBtnWid, &FunctionButtonWidget::sendResetFunctionPage, this, &MainWindow::resetFunctionPage);
connect(m_letterBtnWid, &LetterButtonWidget::sendResetLetterPage, this, &MainWindow::resetLetterPage);
connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished);
connect(m_minAnimation, &QPropertyAnimation::finished, this, &MainWindow::minAnimationFinished);
connect(m_lineEdit, &QLineEdit::textChanged, this, &MainWindow::searchAppSlot);
connect(this, &MainWindow::sendSearchKeyword, m_searchAppThread, &SearchAppThread::recvSearchKeyword);
connect(m_searchAppThread, &SearchAppThread::sendSearchResult, this, &MainWindow::recvSearchResult);
connect(m_fullWindow, &FullMainWindow::showNormalWindow, this, &MainWindow::showNormalWindowSlot);
connect(m_fullWindow, &FullMainWindow::sendUpdateOtherView, this, &MainWindow::updateMinAllView);
connect(m_fullWindow, &FullMainWindow::sendCollectViewUpdate, this, &MainWindow::updateCollectView);
connect(m_minSelectButton, &QToolButton::clicked, this, &MainWindow::on_minSelectButton_clicked);
connect(m_dropDownMenu, &MenuBox::triggered, this, &MainWindow::on_selectMenuButton_triggered);
connect(m_dropDownMenu, &MenuBox::sendMainWinActiveSignal, [ = ]() {
@ -322,7 +318,7 @@ void MainWindow::initSearchUi()
m_selectMenuButton->setAcceptDrops(true);
m_selectMenuButton->setFocusPolicy(Qt::StrongFocus);
m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true)
.pixmap(QSize(Style::miniIconSize, Style::miniIconSize)));
.pixmap(QSize(Style::m_minIconSize, Style::m_minIconSize)));
//搜索框展开页
m_minSearchPage = new QWidget();
m_leftTopSearchHorizontalLayout = new QHBoxLayout(m_minSearchPage);
@ -349,32 +345,32 @@ void MainWindow::initLeftWidget()
{
//左侧列表区
m_leftStackedWidget = new QStackedWidget(m_viewWidget);
m_leftStackedWidget->setFixedSize(QSize(300, Style::leftPageHeight));
m_leftStackedWidget->setFixedSize(QSize(300, Style::m_leftPageHeight));
m_minAllPage = new QWidget();
m_minAllPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minAllPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minAllListView = new ListView(m_minAllPage);
m_minAllListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minAllListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minAllListView->setFrameShape(QFrame::NoFrame);
m_leftStackedWidget->addWidget(m_minAllPage);
m_minAllListView->installEventFilter(this);
m_minLetterPage = new QWidget();
m_minLetterPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minLetterPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minLetterListView = new ListView(m_minLetterPage);
m_minLetterListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minLetterListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minLetterListView->setFrameShape(QFrame::NoFrame);
m_leftStackedWidget->addWidget(m_minLetterPage);
m_minLetterListView->installEventFilter(this);
m_minFuncPage = new QWidget();
m_minFuncPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minFuncPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minFuncListView = new ListView(m_minFuncPage);
m_minFuncListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minFuncListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minFuncListView->setFrameShape(QFrame::NoFrame);
m_leftStackedWidget->addWidget(m_minFuncPage);
m_minFuncListView->installEventFilter(this);
m_minSearchResultPage = new QWidget();
m_minSearchResultPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minSearchResultPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minSearchResultListView = new ListView(m_minSearchResultPage);
m_minSearchResultListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight));
m_minSearchResultListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight));
m_minSearchResultListView->installEventFilter(this);
m_leftStackedWidget->addWidget(m_minSearchResultPage);
}
@ -449,9 +445,9 @@ void MainWindow::initRecentWidget()
//最近视图
m_recentListView = new ListView(m_recentPage);
m_recentListView->installEventFilter(this);
m_recentListView->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight));
m_recentListView->setFixedSize(QSize(Style::m_rightViewWidth, Style::m_rightViewHeight));
m_recentTextlabel = new QLabel(m_recentPage);
m_recentTextlabel->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight));
m_recentTextlabel->setFixedSize(QSize(Style::m_rightViewWidth, Style::m_rightViewHeight));
m_recentTextlabel->setAlignment(Qt::AlignCenter);
m_recentTextlabel->setText(QApplication::translate("MainWindow", "No recent files"));
@ -678,27 +674,29 @@ void MainWindow::paintEvent(QPaintEvent *event)
if ( transparency == 1) {
curColor.setAlpha(255);
}
QRect rect = this->rect();
QRect rect = this->rect().adjusted(5, 5, -5, -5);
QPainterPath path;
// rect.setTopLeft(QPoint(rect.x()+320,rect.y()));
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
painter.save();
painter.setPen(Qt::transparent);
qreal radius = 10;
path.moveTo(rect.topRight() - QPointF(radius, 0));
path.lineTo(rect.topLeft() + QPointF(radius, 0));
path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
path.lineTo(rect.bottomLeft() + QPointF(0, -radius));
path.quadTo(rect.bottomLeft(), rect.bottomLeft() + QPointF(radius, 0));
path.lineTo(rect.bottomRight() - QPointF(radius, 0));
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
path.addRoundedRect(rect, 10, 10);
painter.setBrush(curColor);
painter.setPen(Qt::transparent);
painter.setOpacity(transparency);
painter.drawPath(path);
painter.restore();
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
QColor color = Qt::black;
painter.save();
for (int i = 0; i < 7; i++) {
rect = this->rect().adjusted(i, i, - i, - i);
color.setAlpha(i * 6);
painter.setBrush(Qt::NoBrush);
painter.setPen(QPen(color, 1));
painter.drawRoundedRect(rect, 10, 10);
}
painter.restore();
QMainWindow::paintEvent(event);
}
/**
@ -772,12 +770,13 @@ void MainWindow::minAnimationFinished()
m_viewWidget->setFocus();
// m_collectPushButton->clicked(true);
on_collectPushButton_clicked();
QEventLoop loop;
QTimer::singleShot(100, &loop, SLOT(quit()));
loop.exec();
QTimer::singleShot(200, [ = ]() {
m_animationPage->hide();
});
}
void MainWindow::iconAnimationFinished()
{
m_dropDownMenu->raise();
@ -791,11 +790,12 @@ void MainWindow::maxAnimationFinished()
m_fullWindow->showNormal();
setMaxWindowPos();
m_fullWindow->activateWindow();
QEventLoop loop;
QTimer::singleShot(100, &loop, SLOT(quit()));
loop.exec();
QTimer::singleShot(200, [ = ]() {
m_animationPage->hide();
});
}
void MainWindow::resetLetterPage()
{
m_minLetterListView->show();
@ -845,12 +845,13 @@ void MainWindow::primaryScreenChangeSlot()
{
repaintWidget();
}
void MainWindow::appClassificationBtnClickedSlot()
{
m_leaveAnimation->setStartValue(QRect(0, 0, Style::leftPageWidth, Style::leftPageHeight));
m_leaveAnimation->setStartValue(QRect(0, 0, Style::m_leftPageWidth, Style::m_leftPageHeight));
m_leaveAnimation->setEndValue(QRect(0, 0, 0, 0));
m_enterAnimation->setStartValue(QRect(-40, -40, Style::leftPageWidth + 80, Style::leftPageHeight + 80));
m_enterAnimation->setEndValue(QRect(10, 0, Style::leftPageWidth - 20, Style::leftPageHeight - 60));
m_enterAnimation->setStartValue(QRect(-40, -40, Style::m_leftPageWidth + 80, Style::m_leftPageHeight + 80));
m_enterAnimation->setEndValue(QRect(10, 0, Style::m_leftPageWidth - 20, Style::m_leftPageHeight - 60));
m_leaveAnimation->setDuration(10);
m_enterAnimation->setDuration(100);
@ -948,7 +949,7 @@ bool MainWindow::eventFilter(QObject *target, QEvent *event)
if (target == m_selectMenuButton) {
m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true)
.pixmap(QSize(Style::miniIconSize, Style::miniIconSize)));
.pixmap(QSize(Style::m_minIconSize, Style::m_minIconSize)));
selectIconAnimation(true);
}
}
@ -1152,7 +1153,7 @@ void MainWindow::searchAppSlot(QString arg)
}
void MainWindow::on_selectMenuButton_triggered(QAction *arg1)
{
m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true).pixmap(QSize(Style::miniIconSize, Style::miniIconSize)));
m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true).pixmap(QSize(Style::m_minIconSize, Style::m_minIconSize)));
selectIconAnimation(false);
if (arg1 == m_allAction) {
@ -1270,12 +1271,14 @@ void MainWindow::on_minMaxChangeButton_clicked()
{
m_canHide = true;
m_isFullScreen = true;
QPropertyAnimation *m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this);
connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished);
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
m_maxAnimation->setDuration(1);
} else {
m_animationPage->show();
m_animationPage->setGeometry(this->x(), this->y(), Style::minw, Style::minh);
m_animationPage->setGeometry(this->x() + 5, this->y() + 5, Style::m_minw - 10, Style::m_minh - 10);
m_animationPage->raise();
m_animationPage->repaint();
m_maxAnimation->setDuration(260);
@ -1286,12 +1289,13 @@ void MainWindow::on_minMaxChangeButton_clicked()
loop.exec();
m_maxAnimation->setEasingCurve(QEasingCurve::OutExpo);
// m_maxAnimation->setStartValue(QRect(Style::m_primaryScreenX, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh, Style::minw, Style::minh));
m_maxAnimation->setStartValue(QRect(this->x(), this->y(), Style::minw, Style::minh));
m_maxAnimation->setStartValue(QRect(this->x() + 5, this->y() + 5, Style::m_minw - 10, Style::m_minh - 10));
m_maxAnimation->setEndValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
m_maxAnimation->start();
m_maxAnimation->start(QAbstractAnimation::DeleteWhenStopped);
this->hide();
}
void MainWindow::showWindow()
{
Style::initWidStyle();
@ -1338,27 +1342,27 @@ void MainWindow::setMinWindowPos()
if (position == 0) {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + height - Style::m_minh - 3, Style::m_minw, Style::m_minh));
} else {
this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
this->setGeometry(QRect(x + 4, y + height - Style::m_minh - 3, Style::m_minw, Style::m_minh));
}
} else if (position == 1) {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh));
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::m_minw, Style::m_minh));
} else {
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
this->setGeometry(QRect(x + 4, y + 4, Style::m_minw, Style::m_minh));
}
} else if (position == 2) {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh));
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::m_minw, Style::m_minh));
} else {
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
this->setGeometry(QRect(x + 4, y + 4, Style::m_minw, Style::m_minh));
}
} else {
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + width - Style::m_minw - 4, y + 4, Style::m_minw, Style::m_minh));
} else {
this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
this->setGeometry(QRect(x + width - Style::m_minw - 4, y + 4, Style::m_minw, Style::m_minh));
}
}
}
@ -1373,7 +1377,7 @@ void MainWindow::setMaxWindowPos()
void MainWindow::repaintWidget()
{
Style::initWidStyle();
this->setMinimumSize(Style::minw, Style::minh);
this->setMinimumSize(Style::m_minw, Style::m_minh);
int x = Style::m_primaryScreenX;
int y = Style::m_primaryScreenY;
int width = Style::m_availableScreenWidth;
@ -1388,6 +1392,9 @@ void MainWindow::showNormalWindowSlot()
{
myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight;
QPropertyAnimation *m_minAnimation = new QPropertyAnimation(m_animationPage, "geometry", this);
connect(m_minAnimation, &QPropertyAnimation::finished, this, &MainWindow::minAnimationFinished);
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
m_minAnimation->setDuration(1);
} else {
@ -1405,9 +1412,9 @@ void MainWindow::showNormalWindowSlot()
m_isFullScreen = false;
m_minAnimation->setEasingCurve(QEasingCurve::OutExpo);
m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
m_minAnimation->setEndValue(QRect(this->x(), this->y(), Style::minw, Style::minh));
m_minAnimation->setEndValue(QRect(this->x() + 5, this->y() + 5, Style::m_minw - 10, Style::m_minh - 10));
m_minAnimation->start();
m_minAnimation->start(QAbstractAnimation::DeleteWhenStopped);
m_fullWindow->hide();
}
void MainWindow::on_powerOffButton_clicked()

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
@ -38,7 +37,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 +52,7 @@
#include "letter_button_widget.h"
#include "animationpage.h"
#include "rotationlabel.h"
#include "rightlistview.h"
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"
@ -144,6 +143,7 @@ public Q_SLOTS:
void iconAnimationFinished();
void changeStyle();
void tabletModeChangeSlot(bool flag);
private Q_SLOTS:
void on_selectMenuButton_triggered(QAction *arg1);
@ -236,8 +236,6 @@ private:
DesktopWatcher *m_desktopWatcher = nullptr;
QPropertyAnimation *m_enterAnimation = nullptr;
QPropertyAnimation *m_leaveAnimation = nullptr;
QPropertyAnimation *m_minAnimation = nullptr;
QPropertyAnimation *m_maxAnimation = nullptr;
QPropertyAnimation *iconAnimation = nullptr;
int m_widgetState = -1;
FunctionButtonWidget *m_functionBtnWid = nullptr;

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tabletwindow.h"
@ -69,12 +68,12 @@ void TabletWindow::initSize()
{
Style::initWidStyle();
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->setFixedSize(Style::ScreenWidth, Style::ScreenHeight);
m_leftWidget->setFixedSize(Style::m_leftWidWidth, Style::CenterWindHeight);
m_leftWidget->layout()->setContentsMargins(Style::TimeWidgetLeft, Style::TimeWidgetTop, 0, 0);
m_scrollAreaWid->setFixedHeight(Style::CenterWindHeight);
m_scrollArea->setFixedSize(Style::ScreenWidth, Style::CenterWindHeight);
m_buttonWidget->setFixedSize(Style::OtherPageViewWidth, 30);
this->setFixedSize(Style::m_screenWidth, Style::m_screenHeight);
m_leftWidget->setFixedSize(Style::m_leftWidWidth, Style::m_centerWindHeight);
m_leftWidget->layout()->setContentsMargins(Style::m_timeWidgetLeft, Style::m_timeWidgetTop, 0, 0);
m_scrollAreaWid->setFixedHeight(Style::m_centerWindHeight);
m_scrollArea->setFixedSize(Style::m_screenWidth, Style::m_centerWindHeight);
m_buttonWidget->setFixedSize(Style::m_otherPageViewWidth, 30);
}
void TabletWindow::initUi()
@ -557,15 +556,15 @@ void TabletWindow::insertAppList(QStringList desktopfplist)
m_firstPageLayout->setContentsMargins(0, 0, 0, 0);
m_firstPageWidget->setLayout(m_firstPageLayout);
m_firstPageLayout->addWidget(m_leftWidget);
listview->setFixedSize(Style::FirsPageViewWidth, Style::CenterWindHeight);
listview->setFixedSize(Style::m_firsPageViewWidth, Style::m_centerWindHeight);
m_firstPageLayout->addWidget(listview);
m_scrollAreaWidLayout->addWidget(m_firstPageWidget);
listview->setGridSize(QSize(Style::TabletItemSizeWidthFirst, Style::AppListItemSizeHeight));
listview->setGridSize(QSize(Style::m_tabletItemSizeWidthFirst, Style::m_appListItemSizeHeight));
m_isFirstPage = false;
} else {
listview = new TabletListView(this, 1);
listview->setFixedSize(Style::OtherPageViewWidth, Style::CenterWindHeight);
listview->setGridSize(QSize(Style::TabletItemSizeWidthOther, Style::AppListItemSizeHeight));
listview->setFixedSize(Style::m_otherPageViewWidth, Style::m_centerWindHeight);
listview->setGridSize(QSize(Style::m_tabletItemSizeWidthOther, Style::m_appListItemSizeHeight));
m_scrollAreaWidLayout->addWidget(listview);
}
@ -936,7 +935,7 @@ void TabletWindow::buttonClicked(QAbstractButton *button)
if (!(m_scrollAnimation->state() == QPropertyAnimation::Running)) {
int idd = m_buttonGroup->id(button);
int preNum = m_curPageNum;
Style::nowpagenum = idd;
Style::m_nowpagenum = idd;
// QDBusReply<bool> res = usrInterface->call("get_current_tabletmode");
for (int page = 1; page <= m_pagemanager->getAppPageVector().size(); page++) {

View File

@ -1,10 +1,10 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
* Copyright (C) 2022, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* the Free Software Foundation, either version 3 of the License, 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
@ -12,8 +12,7 @@
* 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;.
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TABLETWINDOW_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,13 +0,0 @@
#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

Some files were not shown because too many files have changed in this diff Show More