Merge branch '3.1-mavis' into 'dbus-interface'
3.1 mavis See merge request kylin-desktop/kylin-nm!573
This commit is contained in:
commit
0eef6207e6
|
@ -23,6 +23,7 @@ Build-Depends: debhelper (>=9),
|
||||||
libgtk-3-dev,
|
libgtk-3-dev,
|
||||||
libukcc-dev (>= 3.1.1+1217),
|
libukcc-dev (>= 3.1.1+1217),
|
||||||
libukui-log4qt-dev,
|
libukui-log4qt-dev,
|
||||||
|
libukui-common-dev,
|
||||||
Standards-Version: 4.5.0
|
Standards-Version: 4.5.0
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
Homepage: https://github.com/ukui/kylin-nm
|
Homepage: https://github.com/ukui/kylin-nm
|
||||||
|
|
|
@ -197,10 +197,10 @@ private:
|
||||||
public:
|
public:
|
||||||
static KyNetworkResourceManager* m_pInstance;
|
static KyNetworkResourceManager* m_pInstance;
|
||||||
|
|
||||||
NetworkManager::ActiveConnection::List m_activeConns;
|
NetworkManager::ActiveConnection::List m_activeConns; //已连接资源类
|
||||||
NetworkManager::Connection::List m_connections;
|
NetworkManager::Connection::List m_connections; //配置文件资源类
|
||||||
NetworkManager::Device::List m_devices;
|
NetworkManager::Device::List m_devices; //设备类
|
||||||
NetworkManager::WirelessNetwork::List m_wifiNets;
|
NetworkManager::WirelessNetwork::List m_wifiNets; //无线热点类
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,10 @@ QStringList DbusAdaptor::getApInfoBySsid(QString devName, QString ssid)
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::showKylinNM(int type)
|
||||||
|
{
|
||||||
|
parent()->onShowMainWindow(type);
|
||||||
|
}
|
||||||
|
|
||||||
//扫描
|
//扫描
|
||||||
void DbusAdaptor::reScan()
|
void DbusAdaptor::reScan()
|
||||||
|
|
|
@ -86,6 +86,8 @@ public Q_SLOTS: // METHODS
|
||||||
//keyring
|
//keyring
|
||||||
void keyRingInit();
|
void keyRingInit();
|
||||||
void keyRingClear();
|
void keyRingClear();
|
||||||
|
//just show
|
||||||
|
void showKylinNM(int type);
|
||||||
Q_SIGNALS: // SIGNALS
|
Q_SIGNALS: // SIGNALS
|
||||||
// void wirelessActivating(QString devName, QString ssid);
|
// void wirelessActivating(QString devName, QString ssid);
|
||||||
// void wiredActivating(QString devName, QString ssid);
|
// void wiredActivating(QString devName, QString ssid);
|
||||||
|
|
|
@ -234,7 +234,7 @@ void WlanListItem::initWlanUI()
|
||||||
|
|
||||||
m_pwdLineEdit = new QLineEdit(m_pwdFrame);
|
m_pwdLineEdit = new QLineEdit(m_pwdFrame);
|
||||||
m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH);
|
m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH);
|
||||||
m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);
|
// m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||||
m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
m_pwdLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
|
|
||||||
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
QRegExp rx("^[A-Za-z0-9`~!@#$%^&*()_-+=<>,.\\\/]+$");
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
#define THEME_SCHAME "org.ukui.style"
|
#define THEME_SCHAME "org.ukui.style"
|
||||||
#define COLOR_THEME "styleName"
|
#define COLOR_THEME "styleName"
|
||||||
|
|
||||||
#define LAN_PAGE_INDEX 0
|
const QString v10Sp1 = "V10SP1";
|
||||||
#define WLAN_PAGE_INDEX 1
|
const QString intel = "V10SP1-edu";
|
||||||
|
|
||||||
|
#define KEY_PRODUCT_FEATURES "PRODUCT_FEATURES"
|
||||||
|
|
||||||
#include <kwindowsystem.h>
|
#include <kwindowsystem.h>
|
||||||
#include <kwindowsystem_export.h>
|
#include <kwindowsystem_export.h>
|
||||||
|
@ -89,6 +91,7 @@ void MainWindow::firstlyStart()
|
||||||
initDbusConnnect();
|
initDbusConnnect();
|
||||||
initWindowTheme();
|
initWindowTheme();
|
||||||
initTrayIcon();
|
initTrayIcon();
|
||||||
|
initPlatform();
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
m_secondaryStartTimer = new QTimer(this);
|
m_secondaryStartTimer = new QTimer(this);
|
||||||
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
|
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
|
||||||
|
@ -113,6 +116,23 @@ void MainWindow::secondaryStart()
|
||||||
m_loadFinished = true;
|
m_loadFinished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MainWindow::initWindowProperties 初始化平台信息
|
||||||
|
*/
|
||||||
|
void MainWindow::initPlatform()
|
||||||
|
{
|
||||||
|
if(v10Sp1.compare(KDKGetPrjCodeName().c_str(),Qt::CaseInsensitive) == 0) {
|
||||||
|
QString feature = KDKGetOSRelease(KEY_PRODUCT_FEATURES).c_str();
|
||||||
|
if (feature.toInt() == 3) {
|
||||||
|
m_isShowInCenter = true;
|
||||||
|
}
|
||||||
|
} else if (intel.compare(KDKGetPrjCodeName().c_str(),Qt::CaseInsensitive) == 0) {
|
||||||
|
m_isShowInCenter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << KDKGetPrjCodeName().c_str() << KDKGetOSRelease(KEY_PRODUCT_FEATURES).c_str() << "m_isShowInCenter" << m_isShowInCenter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MainWindow::initWindowProperties 初始化一些窗口属性
|
* @brief MainWindow::initWindowProperties 初始化一些窗口属性
|
||||||
*/
|
*/
|
||||||
|
@ -277,8 +297,14 @@ void MainWindow::initDbusConnnect()
|
||||||
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
|
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
|
||||||
connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange);
|
connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange);
|
||||||
connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate);
|
connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate);
|
||||||
connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowByWlanPage);
|
connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowMainWindow);
|
||||||
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
|
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
|
||||||
|
|
||||||
|
//模式切换
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"),
|
||||||
|
QString("/"),
|
||||||
|
QString("com.kylin.statusmanager.interface"),
|
||||||
|
QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,6 +312,13 @@ void MainWindow::initDbusConnnect()
|
||||||
*/
|
*/
|
||||||
void MainWindow::resetWindowPosition()
|
void MainWindow::resetWindowPosition()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (m_isShowInCenter) {
|
||||||
|
QRect availableGeometry = qApp->primaryScreen()->availableGeometry();
|
||||||
|
this->move((availableGeometry.width() - this->width())/2, (availableGeometry.height() - this->height())/2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#define MARGIN 4
|
#define MARGIN 4
|
||||||
#define PANEL_TOP 1
|
#define PANEL_TOP 1
|
||||||
#define PANEL_LEFT 2
|
#define PANEL_LEFT 2
|
||||||
|
@ -518,16 +551,20 @@ void MainWindow::onWlanConnectStatusToChangeTrayIcon(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onShowByWlanPage()
|
void MainWindow::onTabletModeChanged(bool mode)
|
||||||
{
|
{
|
||||||
m_centralWidget->setCurrentIndex(WLAN_PAGE_INDEX);
|
qDebug() << "TabletMode change" << mode;
|
||||||
|
Q_UNUSED(mode)
|
||||||
|
//模式切换时,隐藏主界面
|
||||||
|
hideMainwindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowMainWindow(int type)
|
||||||
|
{
|
||||||
|
m_centralWidget->setCurrentIndex(type);
|
||||||
|
|
||||||
if(QApplication::activeWindow() != this) {
|
if(QApplication::activeWindow() != this) {
|
||||||
this->resetWindowPosition();
|
this->showMainwindow();
|
||||||
this->showNormal();
|
|
||||||
this->raise();
|
|
||||||
this->activateWindow();
|
|
||||||
emit this->mainWindowVisibleChanged(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QScreen>
|
||||||
#include "lanpage.h"
|
#include "lanpage.h"
|
||||||
#include "wlanpage.h"
|
#include "wlanpage.h"
|
||||||
#include "netdetails/netdetail.h"
|
#include "netdetails/netdetail.h"
|
||||||
|
#include <ukuisdk/kylin-com4cxx.h>
|
||||||
|
|
||||||
enum IconActiveType {
|
enum IconActiveType {
|
||||||
NOT_CONNECTED = 0,
|
NOT_CONNECTED = 0,
|
||||||
|
@ -108,6 +110,7 @@ private:
|
||||||
void secondaryStart(); //二级启动
|
void secondaryStart(); //二级启动
|
||||||
bool m_loadFinished = false; //是否二级启动已执行完
|
bool m_loadFinished = false; //是否二级启动已执行完
|
||||||
QTimer * m_secondaryStartTimer = nullptr; //执行二级启动的倒计时
|
QTimer * m_secondaryStartTimer = nullptr; //执行二级启动的倒计时
|
||||||
|
void initPlatform();
|
||||||
void initWindowProperties();
|
void initWindowProperties();
|
||||||
void initTransparency();
|
void initTransparency();
|
||||||
void paintWithTrans();
|
void paintWithTrans();
|
||||||
|
@ -149,10 +152,15 @@ private:
|
||||||
bool m_lanIsLoading = false;
|
bool m_lanIsLoading = false;
|
||||||
bool m_wlanIsLoading = false;
|
bool m_wlanIsLoading = false;
|
||||||
|
|
||||||
|
bool m_isShowInCenter = false;
|
||||||
|
|
||||||
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
||||||
|
|
||||||
QMap<QString, NetDetail*> m_createPagePtrMap;
|
QMap<QString, NetDetail*> m_createPagePtrMap;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void onShowMainWindow(int type);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTransChanged();
|
void onTransChanged();
|
||||||
void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
|
@ -163,8 +171,8 @@ private slots:
|
||||||
void onSetTrayIconLoading();
|
void onSetTrayIconLoading();
|
||||||
void onLanConnectStatusToChangeTrayIcon(int state);
|
void onLanConnectStatusToChangeTrayIcon(int state);
|
||||||
void onWlanConnectStatusToChangeTrayIcon(int state);
|
void onWlanConnectStatusToChangeTrayIcon(int state);
|
||||||
void onShowByWlanPage();
|
|
||||||
void onConnectivityChanged(NetworkManager::Connectivity connectivity);
|
void onConnectivityChanged(NetworkManager::Connectivity connectivity);
|
||||||
|
void onTabletModeChanged(bool mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -1292,7 +1292,7 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString&
|
||||||
|
|
||||||
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||||
QApplication::postEvent(p_wlanItem, event);
|
QApplication::postEvent(p_wlanItem, event);
|
||||||
emit showMainWindow();
|
emit showMainWindow(WLAN_PAGE_INDEX);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName;
|
qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
#define MORE_TEXT_MARGINS 16,0,0,0
|
#define MORE_TEXT_MARGINS 16,0,0,0
|
||||||
#define SCROLLAREA_HEIGHT 200
|
#define SCROLLAREA_HEIGHT 200
|
||||||
|
|
||||||
|
#define LAN_PAGE_INDEX 0
|
||||||
|
#define WLAN_PAGE_INDEX 1
|
||||||
|
|
||||||
class WlanListItem;
|
class WlanListItem;
|
||||||
|
|
||||||
class WlanPage : public TabPage
|
class WlanPage : public TabPage
|
||||||
|
@ -64,7 +67,7 @@ signals:
|
||||||
void wlanConnectChanged(int state);
|
void wlanConnectChanged(int state);
|
||||||
void timeToUpdate();
|
void timeToUpdate();
|
||||||
|
|
||||||
void showMainWindow();
|
void showMainWindow(int type);
|
||||||
|
|
||||||
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
||||||
|
|
||||||
|
|
31
src/main.cpp
31
src/main.cpp
|
@ -88,14 +88,35 @@ int main(int argc, char *argv[])
|
||||||
// QApplication a(argc, argv);
|
// QApplication a(argc, argv);
|
||||||
QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));
|
QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));
|
||||||
QtSingleApplication a(id, argc, argv);
|
QtSingleApplication a(id, argc, argv);
|
||||||
// qInstallMessageHandler(messageOutput);
|
|
||||||
if (a.isRunning()) {
|
|
||||||
a.sendMessage("raise_window_noop");
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
|
|
||||||
|
QCommandLineParser parser;
|
||||||
|
parser.setApplicationDescription(QCoreApplication::translate("main", "kylinnm"));
|
||||||
|
parser.addHelpOption();
|
||||||
|
parser.addVersionOption();
|
||||||
|
|
||||||
|
QCommandLineOption swOption(QStringLiteral("sw"),QCoreApplication::translate("main", "show kylin-nm wifi page"));
|
||||||
|
QCommandLineOption snOption(QStringLiteral("sn"),QCoreApplication::translate("main", "show kylin-nm lan page"));
|
||||||
|
|
||||||
|
parser.addOptions({swOption,snOption});
|
||||||
|
parser.process(a);
|
||||||
|
|
||||||
|
QDBusInterface interface("com.kylin.network",
|
||||||
|
"/com/kylin/network",
|
||||||
|
"com.kylin.network",
|
||||||
|
QDBusConnection::sessionBus());
|
||||||
|
if(interface.isValid()) {
|
||||||
|
if (parser.isSet(swOption))
|
||||||
|
{
|
||||||
|
interface.call(QStringLiteral("showKylinNM"),1);
|
||||||
|
} else {
|
||||||
|
interface.call(QStringLiteral("showKylinNM"),0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QThread thread;
|
QThread thread;
|
||||||
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
|
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
|
||||||
p_networkResource->moveToThread(&thread);
|
p_networkResource->moveToThread(&thread);
|
||||||
|
|
|
@ -18,7 +18,7 @@ PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libnm libnma libsecret-1 gtk+-3.0 gset
|
||||||
|
|
||||||
INCLUDEPATH += /usr/include/KF5/NetworkManagerQt
|
INCLUDEPATH += /usr/include/KF5/NetworkManagerQt
|
||||||
|
|
||||||
LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt -lukui-log4qt
|
LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt -lukui-log4qt -lukui-com4c -lukui-com4cxx
|
||||||
#LIBS += -lkysec
|
#LIBS += -lkysec
|
||||||
target.path = /usr/bin
|
target.path = /usr/bin
|
||||||
target.source += $$TARGET
|
target.source += $$TARGET
|
||||||
|
|
Loading…
Reference in New Issue