Optimize code.

This commit is contained in:
zhangjiaping 2021-08-16 16:54:12 +08:00
parent df6d30e66f
commit 06b0e4c513
13 changed files with 315 additions and 277 deletions

View File

@ -12,16 +12,27 @@ QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOptio
QSize size(0,40); QSize size(0,40);
if (const QStyleOptionTab *tab= qstyleoption_cast<const QStyleOptionTab *>(option)) { if (const QStyleOptionTab *tab= qstyleoption_cast<const QStyleOptionTab *>(option)) {
switch (tab->shape) { switch (tab->shape) {
case QTabBar::RoundedNorth: case QTabBar::RoundedSouth: case QTabBar::RoundedNorth:
case QTabBar::RoundedSouth: {
return size + QSize(50,0); return size + QSize(50,0);
case QTabBar::RoundedWest: case QTabBar::RoundedEast: break;
}
case QTabBar::RoundedWest:
case QTabBar::RoundedEast: {
return size + QSize(0,50); return size + QSize(0,50);
default: break; break;
}
default: {
break;
}
} }
} }
return size; return size;
} break; break;
default: break; }
default: {
break;
}
} }
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
} }
@ -38,7 +49,9 @@ void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption
// } // }
// break; // break;
// } // }
// default: break; // default: {
// break;
// }
// } // }
return QProxyStyle::drawControl(element, option, painter, widget); return QProxyStyle::drawControl(element, option, painter, widget);
} }

View File

@ -24,8 +24,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
*/ */
void MainWindow::showMainwindow() void MainWindow::showMainwindow()
{ {
if (!m_load_finished) { if (!m_loadFinished) {
m_secondary_start_timer->stop(); m_secondaryStartTimer->stop();
secondaryStart(); secondaryStart();
} }
this->resetWindowPosition(); this->resetWindowPosition();
@ -52,12 +52,12 @@ void MainWindow::firstlyStart()
initWindowTheme(); initWindowTheme();
initTrayIcon(); initTrayIcon();
installEventFilter(this); installEventFilter(this);
m_secondary_start_timer = new QTimer(this); m_secondaryStartTimer = new QTimer(this);
connect(m_secondary_start_timer, &QTimer::timeout, this, [ = ]() { connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
m_secondary_start_timer->stop(); m_secondaryStartTimer->stop();
secondaryStart();//满足条件后执行比较耗时的二级启动 secondaryStart();//满足条件后执行比较耗时的二级启动
}); });
m_secondary_start_timer->start(5 * 1000); m_secondaryStartTimer->start(5 * 1000);
} }
/** /**
@ -65,9 +65,9 @@ void MainWindow::firstlyStart()
*/ */
void MainWindow::secondaryStart() void MainWindow::secondaryStart()
{ {
if (m_load_finished) if (m_loadFinished)
return; return;
m_load_finished = true; m_loadFinished = true;
} }
/** /**
@ -91,13 +91,13 @@ void MainWindow::initWindowProperties()
*/ */
void MainWindow::initUI() void MainWindow::initUI()
{ {
m_central_widget = new QTabWidget(this); m_centralWidget = new QTabWidget(this);
this->setCentralWidget(m_central_widget); this->setCentralWidget(m_centralWidget);
m_central_widget->tabBar()->setFixedWidth(this->width()); m_centralWidget->tabBar()->setFixedWidth(this->width());
LanPage * m_lanWidget = new LanPage(m_central_widget); LanPage * m_lanWidget = new LanPage(m_centralWidget);
WlanPage * m_wlanWidget = new WlanPage(m_central_widget); WlanPage * m_wlanWidget = new WlanPage(m_centralWidget);
m_central_widget->addTab(m_lanWidget, QIcon::fromTheme("network-wired-connected-symbolic", QIcon::fromTheme("network-wired-symbolic", QIcon(":/res/l/network-online.svg"))), tr("LAN")); m_centralWidget->addTab(m_lanWidget, QIcon::fromTheme("network-wired-connected-symbolic", QIcon::fromTheme("network-wired-symbolic", QIcon(":/res/l/network-online.svg"))), tr("LAN"));
m_central_widget->addTab(m_wlanWidget, QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/x/wifi-list-bg.svg")), tr("WLAN")); m_centralWidget->addTab(m_wlanWidget, QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/x/wifi-list-bg.svg")), tr("WLAN"));
} }
/** /**
@ -105,22 +105,22 @@ void MainWindow::initUI()
*/ */
void MainWindow::initTrayIcon() void MainWindow::initTrayIcon()
{ {
m_tray_icon = new QSystemTrayIcon(); m_trayIcon = new QSystemTrayIcon();
m_tray_icon_menu = new QMenu(); m_trayIconMenu = new QMenu();
m_show_mainwindow_action = new QAction(tr("Show MainWindow"),this); m_showMainwindowAction = new QAction(tr("Show MainWindow"),this);
m_show_settings_action = new QAction(tr("Settings"),this); m_showSettingsAction = new QAction(tr("Settings"),this);
m_tray_icon->setToolTip(QString(tr("kylin-nm"))); m_trayIcon->setToolTip(QString(tr("kylin-nm")));
m_show_settings_action->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) ); m_showSettingsAction->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) );
m_tray_icon_menu->addAction(m_show_mainwindow_action); m_trayIconMenu->addAction(m_showMainwindowAction);
m_tray_icon_menu->addAction(m_show_settings_action); m_trayIconMenu->addAction(m_showSettingsAction);
m_tray_icon->setContextMenu(m_tray_icon_menu); m_trayIcon->setContextMenu(m_trayIconMenu);
m_tray_icon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic")); m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic"));
connect(m_tray_icon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated); connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated);
connect(m_show_mainwindow_action, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled); connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled);
connect(m_show_settings_action, &QAction::triggered, this, &MainWindow::onShowSettingsActionTriggled); connect(m_showSettingsAction, &QAction::triggered, this, &MainWindow::onShowSettingsActionTriggled);
m_tray_icon->show(); m_trayIcon->show();
} }
/** /**
@ -129,15 +129,19 @@ void MainWindow::initTrayIcon()
void MainWindow::resetWindowPosition() void MainWindow::resetWindowPosition()
{ {
#define MARGIN 4 #define MARGIN 4
if (!m_position_interface) { #define PANEL_TOP 1
m_position_interface = new QDBusInterface("org.ukui.panel", #define PANEL_LEFT 2
#define PANEL_RIGHT 3
//#define PANEL_BOTTOM 4
if (!m_positionInterface) {
m_positionInterface = new QDBusInterface("org.ukui.panel",
"/panel/position", "/panel/position",
"org.ukui.panel", "org.ukui.panel",
QDBusConnection::sessionBus()); QDBusConnection::sessionBus());
} }
QDBusReply<QVariantList> reply = m_position_interface->call("GetPrimaryScreenGeometry"); QDBusReply<QVariantList> reply = m_positionInterface->call("GetPrimaryScreenGeometry");
//reply获取的参数共5个分别是 主屏可用区域的起点x坐标主屏可用区域的起点y坐标主屏可用区域的宽度主屏可用区域高度任务栏位置 //reply获取的参数共5个分别是 主屏可用区域的起点x坐标主屏可用区域的起点y坐标主屏可用区域的宽度主屏可用区域高度任务栏位置
if (!m_position_interface->isValid() || !reply.isValid() || reply.value().size() < 5) { if (!m_positionInterface->isValid() || !reply.isValid() || reply.value().size() < 5) {
qCritical() << QDBusConnection::sessionBus().lastError().message(); qCritical() << QDBusConnection::sessionBus().lastError().message();
this->setGeometry(0, 0, this->width(), this->height()); this->setGeometry(0, 0, this->width(), this->height());
return; return;
@ -145,20 +149,20 @@ void MainWindow::resetWindowPosition()
QVariantList position_list = reply.value(); QVariantList position_list = reply.value();
int position = position_list.at(4).toInt(); int position = position_list.at(4).toInt();
switch(position){ switch(position){
case 1: case PANEL_TOP:
//任务栏位于上方 //任务栏位于上方
this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN, this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN,
position_list.at(1).toInt() + MARGIN, position_list.at(1).toInt() + MARGIN,
this->width(), this->height()); this->width(), this->height());
break; break;
//任务栏位于左边 //任务栏位于左边
case 2: case PANEL_LEFT:
this->setGeometry(position_list.at(0).toInt() + MARGIN, this->setGeometry(position_list.at(0).toInt() + MARGIN,
position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN, position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN,
this->width(), this->height()); this->width(), this->height());
break; break;
//任务栏位于右边 //任务栏位于右边
case 3: case PANEL_RIGHT:
this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN, this->setGeometry(position_list.at(0).toInt() + position_list.at(2).toInt() - this->width() - MARGIN,
position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN, position_list.at(1).toInt() + reply.value().at(3).toInt() - this->height() - MARGIN,
this->width(), this->height()); this->width(), this->height());
@ -205,14 +209,9 @@ void MainWindow::initWindowTheme()
{ {
const QByteArray style_id(THEME_SCHAME); const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id)) { if (QGSettings::isSchemaInstalled(style_id)) {
m_style_gsettings = new QGSettings(style_id); m_styleGsettings = new QGSettings(style_id);
resetWindowTheme(); resetWindowTheme();
connect(m_style_gsettings, &QGSettings::changed, this, [ = ](const QString &key) { connect(m_styleGsettings, &QGSettings::changed, this, &MainWindow::onThemeChanged);
if (key == COLOR_THEME) {
qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__;
resetWindowTheme();
}
});
} else { } else {
qWarning() << "Gsettings interface \"org.ukui.style\" is not exist!" << Q_FUNC_INFO << __LINE__; qWarning() << "Gsettings interface \"org.ukui.style\" is not exist!" << Q_FUNC_INFO << __LINE__;
} }
@ -223,8 +222,8 @@ void MainWindow::initWindowTheme()
*/ */
void MainWindow::resetWindowTheme() void MainWindow::resetWindowTheme()
{ {
if (!m_style_gsettings) return; if (!m_styleGsettings) { return; }
QString currentTheme = m_style_gsettings->get(COLOR_THEME).toString(); QString currentTheme = m_styleGsettings->get(COLOR_THEME).toString();
auto app = static_cast<QApplication*>(QCoreApplication::instance()); auto app = static_cast<QApplication*>(QCoreApplication::instance());
if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){ if(currentTheme == "ukui-dark" || currentTheme == "ukui-black"){
app->setStyle(new CustomStyle("ukui-dark")); app->setStyle(new CustomStyle("ukui-dark"));
@ -269,6 +268,16 @@ void MainWindow::onShowSettingsActionTriggled()
showControlCenter(); showControlCenter();
} }
void MainWindow::onThemeChanged(const QString &key)
{
if (key == COLOR_THEME) {
qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__;
resetWindowTheme();
} else {
qDebug() << "Received signal of theme changed, key=" << key << " will do nothing." << Q_FUNC_INFO << __LINE__;
}
}
/** /**
* @brief MainWindow::keyPressEvent esc键关闭主界面 * @brief MainWindow::keyPressEvent esc键关闭主界面
* @param event * @param event

View File

@ -23,14 +23,14 @@ signals:
public slots: public slots:
protected: protected:
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *event);
bool eventFilter(QObject *, QEvent *) override; bool eventFilter(QObject *watched, QEvent *event) override;
private: private:
void firstlyStart(); //一级启动 void firstlyStart(); //一级启动
void secondaryStart(); //二级启动 void secondaryStart(); //二级启动
bool m_load_finished = false; //是否二级启动已执行完 bool m_loadFinished = false; //是否二级启动已执行完
QTimer * m_secondary_start_timer = nullptr; //执行二级启动的倒计时 QTimer * m_secondaryStartTimer = nullptr; //执行二级启动的倒计时
void initWindowProperties(); void initWindowProperties();
void initUI(); void initUI();
void initTrayIcon(); void initTrayIcon();
@ -40,25 +40,26 @@ private:
void showControlCenter(); void showControlCenter();
//主窗口的主要构成控件 //主窗口的主要构成控件
QTabWidget * m_central_widget = nullptr; QTabWidget * m_centralWidget = nullptr;
//监听主题的Gsettings //监听主题的Gsettings
QGSettings * m_style_gsettings = nullptr; QGSettings * m_styleGsettings = nullptr;
//获取和重置窗口位置 //获取和重置窗口位置
void resetWindowPosition(); void resetWindowPosition();
QDBusInterface * m_position_interface = nullptr; QDBusInterface * m_positionInterface = nullptr;
//托盘图标,托盘图标右键菜单 //托盘图标,托盘图标右键菜单
QSystemTrayIcon * m_tray_icon = nullptr; QSystemTrayIcon * m_trayIcon = nullptr;
QMenu * m_tray_icon_menu = nullptr; QMenu * m_trayIconMenu = nullptr;
QAction * m_show_mainwindow_action = nullptr; QAction * m_showMainwindowAction = nullptr;
QAction * m_show_settings_action = nullptr; QAction * m_showSettingsAction = nullptr;
private slots: private slots:
void onTrayIconActivated(); void onTrayIconActivated();
void onShowMainwindowActionTriggled(); void onShowMainwindowActionTriggled();
void onShowSettingsActionTriggled(); void onShowSettingsActionTriggled();
void onThemeChanged(const QString &key);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -18,77 +18,77 @@ LanPage::LanPage(QWidget *parent) : QWidget(parent)
LanPage::~LanPage() LanPage::~LanPage()
{ {
delete m_title_divider; delete m_titleDivider;
delete m_activated_lan_divider; delete m_activatedLanDivider;
delete m_inactivated_lan_divider; delete m_inactivatedLanDivider;
} }
void LanPage::initUI() void LanPage::initUI()
{ {
m_main_layout = new QVBoxLayout(this); m_mainLayout = new QVBoxLayout(this);
m_main_layout->setContentsMargins(MAIN_LAYOUT_MARGINS); m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_main_layout->setSpacing(MAIN_LAYOUT_SPACING); m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
this->setLayout(m_main_layout); this->setLayout(m_mainLayout);
m_title_frame = new QFrame(this); m_titleFrame = new QFrame(this);
m_title_frame->setFixedHeight(TITLE_FRAME_HEIGHT); m_titleFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
m_title_layout = new QHBoxLayout(m_title_frame); m_titleLayout = new QHBoxLayout(m_titleFrame);
m_title_layout->setContentsMargins(TITLE_LAYOUT_MARGINS); m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS);
m_title_label = new QLabel(m_title_frame); m_titleLabel = new QLabel(m_titleFrame);
m_title_label->setText(tr("LAN")); m_titleLabel->setText(tr("LAN"));
m_lan_switch = new SwitchButton(m_title_frame); m_lanSwitch = new SwitchButton(m_titleFrame);
m_title_layout->addWidget(m_title_label); m_titleLayout->addWidget(m_titleLabel);
m_title_layout->addStretch(); m_titleLayout->addStretch();
m_title_layout->addWidget(m_lan_switch); m_titleLayout->addWidget(m_lanSwitch);
m_title_divider = new Divider(this); m_titleDivider = new Divider(this);
m_activated_lan_frame = new QFrame(this); m_activatedLanFrame = new QFrame(this);
m_activated_lan_layout = new QVBoxLayout(m_activated_lan_frame); m_activatedLanLayout = new QVBoxLayout(m_activatedLanFrame);
m_activated_lan_layout->setContentsMargins(LAN_LAYOUT_MARGINS); m_activatedLanLayout->setContentsMargins(LAN_LAYOUT_MARGINS);
m_activated_lan_layout->setSpacing(LAN_LAYOUT_SPACING); m_activatedLanLayout->setSpacing(LAN_LAYOUT_SPACING);
m_activated_lan_label = new QLabel(m_activated_lan_frame); m_activatedLanLabel = new QLabel(m_activatedLanFrame);
m_activated_lan_label->setContentsMargins(TEXT_MARGINS); m_activatedLanLabel->setContentsMargins(TEXT_MARGINS);
m_activated_lan_label->setText(tr("Activated LAN")); m_activatedLanLabel->setText(tr("Activated LAN"));
m_activated_lan_list_widget = new QListWidget(m_activated_lan_frame); m_activatedLanListWidget = new QListWidget(m_activatedLanFrame);
m_activated_lan_list_widget->setContentsMargins(MAIN_LAYOUT_MARGINS); m_activatedLanListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_activated_lan_list_widget->setSpacing(LAN_LIST_SPACING); m_activatedLanListWidget->setSpacing(LAN_LIST_SPACING);
m_activated_lan_layout->addWidget(m_activated_lan_label); m_activatedLanLayout->addWidget(m_activatedLanLabel);
m_activated_lan_layout->addWidget(m_activated_lan_list_widget); m_activatedLanLayout->addWidget(m_activatedLanListWidget);
m_activated_lan_divider = new Divider(this); m_activatedLanDivider = new Divider(this);
m_inactivated_lan_frame = new QFrame(this); m_inactivatedLanFrame = new QFrame(this);
m_inactivated_lan_layout = new QVBoxLayout(m_inactivated_lan_frame); m_inactivatedLanLayout = new QVBoxLayout(m_inactivatedLanFrame);
m_inactivated_lan_layout->setContentsMargins(LAN_LAYOUT_MARGINS); m_inactivatedLanLayout->setContentsMargins(LAN_LAYOUT_MARGINS);
m_inactivated_lan_layout->setSpacing(LAN_LAYOUT_SPACING); m_inactivatedLanLayout->setSpacing(LAN_LAYOUT_SPACING);
m_inactivated_lan_frame->setLayout(m_inactivated_lan_layout); m_inactivatedLanFrame->setLayout(m_inactivatedLanLayout);
m_inactivated_lan_label = new QLabel(m_inactivated_lan_frame); m_inactivatedLanLabel = new QLabel(m_inactivatedLanFrame);
m_inactivated_lan_label->setContentsMargins(TEXT_MARGINS); m_inactivatedLanLabel->setContentsMargins(TEXT_MARGINS);
m_inactivated_lan_label->setText(tr("Inactivated LAN")); m_inactivatedLanLabel->setText(tr("Inactivated LAN"));
m_inactivated_lan_list_area = new QScrollArea(m_inactivated_lan_frame); m_inactivatedLanListArea = new QScrollArea(m_inactivatedLanFrame);
m_inactivated_lan_list_widget = new QListWidget(m_inactivated_lan_list_area); m_inactivatedLanListWidget = new QListWidget(m_inactivatedLanListArea);
m_inactivated_lan_list_area->setWidget(m_inactivated_lan_list_widget); m_inactivatedLanListArea->setWidget(m_inactivatedLanListWidget);
m_inactivated_lan_list_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_inactivatedLanListArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_inactivated_lan_list_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_inactivatedLanListArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
m_inactivated_lan_list_widget->setContentsMargins(MAIN_LAYOUT_MARGINS); m_inactivatedLanListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_inactivated_lan_list_widget->setSpacing(LAN_LIST_SPACING); m_inactivatedLanListWidget->setSpacing(LAN_LIST_SPACING);
// m_inactivated_lan_list_area->setFixedHeight(SCROLL_AREA_HEIGHT); // m_inactivated_lan_list_area->setFixedHeight(SCROLL_AREA_HEIGHT);
m_inactivated_lan_layout->addWidget(m_inactivated_lan_label); m_inactivatedLanLayout->addWidget(m_inactivatedLanLabel);
m_inactivated_lan_layout->addWidget(m_inactivated_lan_list_area); m_inactivatedLanLayout->addWidget(m_inactivatedLanListArea);
m_inactivated_lan_divider = new Divider(this); m_inactivatedLanDivider = new Divider(this);
m_settings_frame = new QFrame(this); m_settingsFrame = new QFrame(this);
m_settings_layout = new QHBoxLayout(m_settings_frame); m_settingsLayout = new QHBoxLayout(m_settingsFrame);
m_settings_layout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
m_settings_label = new QLabel(m_settings_frame); m_settingsLabel = new QLabel(m_settingsFrame);
m_settings_label->setText(tr("Settings")); m_settingsLabel->setText(tr("Settings"));
m_settings_layout->addWidget(m_settings_label); m_settingsLayout->addWidget(m_settingsLabel);
m_settings_frame->setLayout(m_settings_layout); m_settingsFrame->setLayout(m_settingsLayout);
m_main_layout->addWidget(m_title_frame); m_mainLayout->addWidget(m_titleFrame);
m_main_layout->addWidget(m_title_divider); m_mainLayout->addWidget(m_titleDivider);
m_main_layout->addWidget(m_activated_lan_frame); m_mainLayout->addWidget(m_activatedLanFrame);
m_main_layout->addWidget(m_activated_lan_divider); m_mainLayout->addWidget(m_activatedLanDivider);
m_main_layout->addWidget(m_inactivated_lan_frame); m_mainLayout->addWidget(m_inactivatedLanFrame);
m_main_layout->addWidget(m_inactivated_lan_divider); m_mainLayout->addWidget(m_inactivatedLanDivider);
m_main_layout->addWidget(m_settings_frame); m_mainLayout->addWidget(m_settingsFrame);
} }

View File

@ -20,29 +20,29 @@ signals:
private: private:
void initUI(); void initUI();
QVBoxLayout * m_main_layout = nullptr; QVBoxLayout * m_mainLayout = nullptr;
QFrame * m_title_frame = nullptr; QFrame * m_titleFrame = nullptr;
QHBoxLayout * m_title_layout = nullptr; QHBoxLayout * m_titleLayout = nullptr;
QLabel * m_title_label = nullptr; QLabel * m_titleLabel = nullptr;
SwitchButton * m_lan_switch = nullptr; SwitchButton * m_lanSwitch = nullptr;
Divider * m_title_divider = nullptr; Divider * m_titleDivider = nullptr;
QFrame * m_activated_lan_frame = nullptr; QFrame * m_activatedLanFrame = nullptr;
QVBoxLayout * m_activated_lan_layout = nullptr; QVBoxLayout * m_activatedLanLayout = nullptr;
QLabel * m_activated_lan_label = nullptr; QLabel * m_activatedLanLabel = nullptr;
QListWidget * m_activated_lan_list_widget = nullptr; QListWidget * m_activatedLanListWidget = nullptr;
Divider * m_activated_lan_divider = nullptr; Divider * m_activatedLanDivider = nullptr;
QFrame * m_inactivated_lan_frame = nullptr; QFrame * m_inactivatedLanFrame = nullptr;
QVBoxLayout * m_inactivated_lan_layout = nullptr; QVBoxLayout * m_inactivatedLanLayout = nullptr;
QLabel * m_inactivated_lan_label = nullptr; QLabel * m_inactivatedLanLabel = nullptr;
QScrollArea * m_inactivated_lan_list_area = nullptr; QScrollArea * m_inactivatedLanListArea = nullptr;
QListWidget * m_inactivated_lan_list_widget = nullptr; QListWidget * m_inactivatedLanListWidget = nullptr;
Divider * m_inactivated_lan_divider = nullptr; Divider * m_inactivatedLanDivider = nullptr;
QFrame * m_settings_frame = nullptr; QFrame * m_settingsFrame = nullptr;
QHBoxLayout * m_settings_layout = nullptr; QHBoxLayout * m_settingsLayout = nullptr;
QLabel * m_settings_label = nullptr; QLabel * m_settingsLabel = nullptr;
}; };
#endif // LANPAGE_H #endif // LANPAGE_H

View File

@ -19,17 +19,17 @@ WlanPage::WlanPage(QWidget *parent) : QWidget(parent)
WlanPage::~WlanPage() WlanPage::~WlanPage()
{ {
delete m_title_divider; delete m_titleDivider;
delete m_activated_wlan_divider; delete m_activatedWlanDivider;
delete m_inactivated_wlan_divider; delete m_inactivatedWlanDivider;
} }
bool WlanPage::eventFilter(QObject *w, QEvent *e) bool WlanPage::eventFilter(QObject *w, QEvent *e)
{ {
if (e->type() == QEvent::MouseButtonPress) { if (e->type() == QEvent::MouseButtonPress) {
if (w == m_hidden_wlan_label) { if (w == m_hiddenWlanLabel) {
//ZJP_TODO 打开隐藏WiFi添加弹窗 //ZJP_TODO 打开隐藏WiFi添加弹窗
} else if (w == m_settings_label) { } else if (w == m_settingsLabel) {
//ZJP_TODO 打开控制面板 //ZJP_TODO 打开控制面板
} }
} }
@ -38,84 +38,84 @@ bool WlanPage::eventFilter(QObject *w, QEvent *e)
void WlanPage::initUI() void WlanPage::initUI()
{ {
m_main_layout = new QVBoxLayout(this); m_mainLayout = new QVBoxLayout(this);
m_main_layout->setContentsMargins(MAIN_LAYOUT_MARGINS); m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_main_layout->setSpacing(MAIN_LAYOUT_SPACING); m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
this->setLayout(m_main_layout); this->setLayout(m_mainLayout);
m_title_frame = new QFrame(this); m_titleFrame = new QFrame(this);
m_title_frame->setFixedHeight(TITLE_FRAME_HEIGHT); m_titleFrame->setFixedHeight(TITLE_FRAME_HEIGHT);
m_title_layout = new QHBoxLayout(m_title_frame); m_titleLayout = new QHBoxLayout(m_titleFrame);
m_title_layout->setContentsMargins(TITLE_LAYOUT_MARGINS); m_titleLayout->setContentsMargins(TITLE_LAYOUT_MARGINS);
m_title_label = new QLabel(m_title_frame); m_titleLabel = new QLabel(m_titleFrame);
m_title_label->setText(tr("WLAN")); m_titleLabel->setText(tr("WLAN"));
m_lan_switch = new SwitchButton(m_title_frame); m_lanSwitch = new SwitchButton(m_titleFrame);
m_title_layout->addWidget(m_title_label); m_titleLayout->addWidget(m_titleLabel);
m_title_layout->addStretch(); m_titleLayout->addStretch();
m_title_layout->addWidget(m_lan_switch); m_titleLayout->addWidget(m_lanSwitch);
m_title_divider = new Divider(this); m_titleDivider = new Divider(this);
m_activated_wlan_frame = new QFrame(this); m_activatedWlanFrame = new QFrame(this);
m_activated_wlan_layout = new QVBoxLayout(m_activated_wlan_frame); m_activatedWlanLayout = new QVBoxLayout(m_activatedWlanFrame);
m_activated_wlan_layout->setContentsMargins(LAN_LAYOUT_MARGINS); m_activatedWlanLayout->setContentsMargins(LAN_LAYOUT_MARGINS);
m_activated_wlan_layout->setSpacing(LAN_LAYOUT_SPACING); m_activatedWlanLayout->setSpacing(LAN_LAYOUT_SPACING);
m_activated_wlan_label = new QLabel(m_activated_wlan_frame); m_activatedWlanLabel = new QLabel(m_activatedWlanFrame);
m_activated_wlan_label->setContentsMargins(TEXT_MARGINS); m_activatedWlanLabel->setContentsMargins(TEXT_MARGINS);
m_activated_wlan_label->setText(tr("Activated WLAN")); m_activatedWlanLabel->setText(tr("Activated WLAN"));
m_activated_wlan_list_widget = new QListWidget(m_activated_wlan_frame); m_activatedWlanListWidget = new QListWidget(m_activatedWlanFrame);
m_activated_wlan_list_widget->setContentsMargins(MAIN_LAYOUT_MARGINS); m_activatedWlanListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_activated_wlan_list_widget->setSpacing(LAN_LIST_SPACING); m_activatedWlanListWidget->setSpacing(LAN_LIST_SPACING);
m_activated_wlan_layout->addWidget(m_activated_wlan_label); m_activatedWlanLayout->addWidget(m_activatedWlanLabel);
m_activated_wlan_layout->addWidget(m_activated_wlan_list_widget); m_activatedWlanLayout->addWidget(m_activatedWlanListWidget);
m_activated_wlan_divider = new Divider(this); m_activatedWlanDivider = new Divider(this);
m_inactivated_wlan_frame = new QFrame(this); m_inactivatedWlanFrame = new QFrame(this);
m_inactivated_wlan_layout = new QVBoxLayout(m_inactivated_wlan_frame); m_inactivatedWlanLayout = new QVBoxLayout(m_inactivatedWlanFrame);
m_inactivated_wlan_layout->setContentsMargins(LAN_LAYOUT_MARGINS); m_inactivatedWlanLayout->setContentsMargins(LAN_LAYOUT_MARGINS);
m_inactivated_wlan_layout->setSpacing(LAN_LAYOUT_SPACING); m_inactivatedWlanLayout->setSpacing(LAN_LAYOUT_SPACING);
m_inactivated_wlan_frame->setLayout(m_inactivated_wlan_layout); m_inactivatedWlanFrame->setLayout(m_inactivatedWlanLayout);
m_inactivated_wlan_label = new QLabel(m_inactivated_wlan_frame); m_inactivatedWlanLabel = new QLabel(m_inactivatedWlanFrame);
m_inactivated_wlan_label->setContentsMargins(TEXT_MARGINS); m_inactivatedWlanLabel->setContentsMargins(TEXT_MARGINS);
m_inactivated_wlan_label->setText(tr("Inactivated WLAN")); m_inactivatedWlanLabel->setText(tr("Inactivated WLAN"));
m_inactivated_wlan_list_area = new QScrollArea(m_inactivated_wlan_frame); m_inactivatedWlanListArea = new QScrollArea(m_inactivatedWlanFrame);
m_inactivated_wlan_list_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_inactivatedWlanListArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_inactivated_wlan_list_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_inactivatedWlanListArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
m_inactivated_wlan_list_area_central_widget = new QFrame(m_inactivated_wlan_list_area); m_inactivatedWlanListAreaCentralWidget = new QFrame(m_inactivatedWlanListArea);
m_inactivated_wlan_list_area->setWidget(m_inactivated_wlan_list_area_central_widget); m_inactivatedWlanListArea->setWidget(m_inactivatedWlanListAreaCentralWidget);
m_inactivated_wlan_list_area_layout = new QVBoxLayout(m_inactivated_wlan_list_area_central_widget); m_inactivatedWlanListAreaLayout = new QVBoxLayout(m_inactivatedWlanListAreaCentralWidget);
m_inactivated_wlan_list_area_central_widget->setLayout(m_inactivated_wlan_list_area_layout); m_inactivatedWlanListAreaCentralWidget->setLayout(m_inactivatedWlanListAreaLayout);
m_inactivated_wlan_list_area_layout->setContentsMargins(MAIN_LAYOUT_MARGINS); m_inactivatedWlanListAreaLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_inactivated_wlan_list_widget = new QListWidget(m_inactivated_wlan_list_area_central_widget); m_inactivatedWlanListWidget = new QListWidget(m_inactivatedWlanListAreaCentralWidget);
m_inactivated_wlan_list_widget->setContentsMargins(MAIN_LAYOUT_MARGINS); m_inactivatedWlanListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_inactivated_wlan_list_widget->setSpacing(LAN_LIST_SPACING); m_inactivatedWlanListWidget->setSpacing(LAN_LIST_SPACING);
m_hidden_wlan_widget = new QFrame(m_inactivated_wlan_list_area_central_widget); m_hiddenWlanWidget = new QFrame(m_inactivatedWlanListAreaCentralWidget);
m_hidden_wlan_layout = new QHBoxLayout(m_hidden_wlan_widget); m_hiddenWlanLayout = new QHBoxLayout(m_hiddenWlanWidget);
m_hidden_wlan_layout->setContentsMargins(MAIN_LAYOUT_MARGINS); m_hiddenWlanLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
m_hidden_wlan_label = new QLabel(m_hidden_wlan_widget); m_hiddenWlanLabel = new QLabel(m_hiddenWlanWidget);
m_hidden_wlan_label->setText(tr("More...")); m_hiddenWlanLabel->setText(tr("More..."));
m_hidden_wlan_layout->addWidget(m_hidden_wlan_label); m_hiddenWlanLayout->addWidget(m_hiddenWlanLabel);
m_hidden_wlan_layout->addStretch(); m_hiddenWlanLayout->addStretch();
m_inactivated_wlan_list_area_layout->addWidget(m_inactivated_wlan_list_widget); m_inactivatedWlanListAreaLayout->addWidget(m_inactivatedWlanListWidget);
m_inactivated_wlan_list_area_layout->addWidget(m_hidden_wlan_widget); m_inactivatedWlanListAreaLayout->addWidget(m_hiddenWlanWidget);
// m_inactivated_lan_list_area->setFixedHeight(SCROLL_AREA_HEIGHT); // m_inactivated_lan_list_area->setFixedHeight(SCROLL_AREA_HEIGHT);
m_inactivated_wlan_layout->addWidget(m_inactivated_wlan_label); m_inactivatedWlanLayout->addWidget(m_inactivatedWlanLabel);
m_inactivated_wlan_layout->addWidget(m_inactivated_wlan_list_area); m_inactivatedWlanLayout->addWidget(m_inactivatedWlanListArea);
m_inactivated_wlan_divider = new Divider(this); m_inactivatedWlanDivider = new Divider(this);
m_settings_frame = new QFrame(this); m_settingsFrame = new QFrame(this);
m_settings_layout = new QHBoxLayout(m_settings_frame); m_settingsLayout = new QHBoxLayout(m_settingsFrame);
m_settings_layout->setContentsMargins(SETTINGS_LAYOUT_MARGINS); m_settingsLayout->setContentsMargins(SETTINGS_LAYOUT_MARGINS);
m_settings_label = new QLabel(m_settings_frame); m_settingsLabel = new QLabel(m_settingsFrame);
m_settings_label->setText(tr("Settings")); m_settingsLabel->setText(tr("Settings"));
m_settings_layout->addWidget(m_settings_label); m_settingsLayout->addWidget(m_settingsLabel);
m_settings_frame->setLayout(m_settings_layout); m_settingsFrame->setLayout(m_settingsLayout);
m_main_layout->addWidget(m_title_frame); m_mainLayout->addWidget(m_titleFrame);
m_main_layout->addWidget(m_title_divider); m_mainLayout->addWidget(m_titleDivider);
m_main_layout->addWidget(m_activated_wlan_frame); m_mainLayout->addWidget(m_activatedWlanFrame);
m_main_layout->addWidget(m_activated_wlan_divider); m_mainLayout->addWidget(m_activatedWlanDivider);
m_main_layout->addWidget(m_inactivated_wlan_frame); m_mainLayout->addWidget(m_inactivatedWlanFrame);
m_main_layout->addWidget(m_inactivated_wlan_divider); m_mainLayout->addWidget(m_inactivatedWlanDivider);
m_main_layout->addWidget(m_settings_frame); m_mainLayout->addWidget(m_settingsFrame);
} }

View File

@ -19,38 +19,38 @@ public:
signals: signals:
protected: protected:
bool eventFilter(QObject *, QEvent *); bool eventFilter(QObject *watched, QEvent *event);
private: private:
void initUI(); void initUI();
QVBoxLayout * m_main_layout = nullptr; QVBoxLayout * m_mainLayout = nullptr;
QFrame * m_title_frame = nullptr; QFrame * m_titleFrame = nullptr;
QHBoxLayout * m_title_layout = nullptr; QHBoxLayout * m_titleLayout = nullptr;
QLabel * m_title_label = nullptr; QLabel * m_titleLabel = nullptr;
SwitchButton * m_lan_switch = nullptr; SwitchButton * m_lanSwitch = nullptr;
Divider * m_title_divider = nullptr; Divider * m_titleDivider = nullptr;
QFrame * m_activated_wlan_frame = nullptr; QFrame * m_activatedWlanFrame = nullptr;
QVBoxLayout * m_activated_wlan_layout = nullptr; QVBoxLayout * m_activatedWlanLayout = nullptr;
QLabel * m_activated_wlan_label = nullptr; QLabel *m_activatedWlanLabel = nullptr;
QListWidget * m_activated_wlan_list_widget = nullptr; QListWidget * m_activatedWlanListWidget = nullptr;
Divider * m_activated_wlan_divider = nullptr; Divider * m_activatedWlanDivider = nullptr;
QFrame * m_inactivated_wlan_frame = nullptr; QFrame * m_inactivatedWlanFrame = nullptr;
QVBoxLayout * m_inactivated_wlan_layout = nullptr; QVBoxLayout * m_inactivatedWlanLayout = nullptr;
QLabel * m_inactivated_wlan_label = nullptr; QLabel * m_inactivatedWlanLabel = nullptr;
QScrollArea * m_inactivated_wlan_list_area = nullptr; QScrollArea * m_inactivatedWlanListArea = nullptr;
QFrame * m_inactivated_wlan_list_area_central_widget = nullptr; QFrame * m_inactivatedWlanListAreaCentralWidget = nullptr;
QVBoxLayout * m_inactivated_wlan_list_area_layout = nullptr; QVBoxLayout * m_inactivatedWlanListAreaLayout = nullptr;
QListWidget * m_inactivated_wlan_list_widget = nullptr; QListWidget * m_inactivatedWlanListWidget = nullptr;
QFrame * m_hidden_wlan_widget = nullptr; QFrame * m_hiddenWlanWidget = nullptr;
QHBoxLayout * m_hidden_wlan_layout = nullptr; QHBoxLayout * m_hiddenWlanLayout = nullptr;
QLabel * m_hidden_wlan_label = nullptr; QLabel * m_hiddenWlanLabel = nullptr;
Divider * m_inactivated_wlan_divider = nullptr; Divider * m_inactivatedWlanDivider = nullptr;
QFrame * m_settings_frame = nullptr; QFrame * m_settingsFrame = nullptr;
QHBoxLayout * m_settings_layout = nullptr; QHBoxLayout * m_settingsLayout = nullptr;
QLabel * m_settings_label = nullptr; QLabel * m_settingsLabel = nullptr;
}; };
#endif // WLANPAGE_H #endif // WLANPAGE_H

View File

@ -9,7 +9,7 @@ public:
~Divider() = default; ~Divider() = default;
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *event);
}; };
#endif // DIVIDER_H #endif // DIVIDER_H

View File

@ -13,9 +13,9 @@ private:
void initUI(); void initUI();
protected: protected:
virtual void enterEvent(QEvent *); virtual void enterEvent(QEvent *event);
virtual void leaveEvent(QEvent *); virtual void leaveEvent(QEvent *event);
bool eventFilter(QObject *, QEvent *); bool eventFilter(QObject *watched, QEvent *event);
}; };
#endif // INFOBUTTON_H #endif // INFOBUTTON_H

View File

@ -4,10 +4,10 @@ NetButton::NetButton(bool isActivated, QWidget *parent) : QPushButton(parent)
{ {
connect(this, &NetButton::requestStartLoading, this, &NetButton::onLoadingStarted); connect(this, &NetButton::requestStartLoading, this, &NetButton::onLoadingStarted);
connect(this, &NetButton::requestStopLoading, this, &NetButton::onLoadingStopped); connect(this, &NetButton::requestStopLoading, this, &NetButton::onLoadingStopped);
m_is_activated = isActivated; m_isActivated = isActivated;
this->setAutoFillBackground(false); this->setAutoFillBackground(false);
m_icon_label = new QLabel(this); m_iconLabel = new QLabel(this);
m_icon_label->setScaledContents(true); m_iconLabel->setScaledContents(true);
} }
void NetButton::startLoading() void NetButton::startLoading()
@ -23,7 +23,7 @@ void NetButton::stopLoading()
void NetButton::setPressed() void NetButton::setPressed()
{ {
//ZJP_TODO 设置颜色为点击颜色,注意区分已连接/未连接 //ZJP_TODO 设置颜色为点击颜色,注意区分已连接/未连接
if (m_is_activated) if (m_isActivated)
; ;
; ;
} }
@ -31,15 +31,15 @@ void NetButton::setPressed()
void NetButton::setReleased() void NetButton::setReleased()
{ {
//ZJP_TODO 设置颜色为未点击颜色,注意区分已连接/未连接 //ZJP_TODO 设置颜色为未点击颜色,注意区分已连接/未连接
if (m_is_activated) if (m_isActivated)
; ;
; ;
} }
void NetButton::setButtonIcon(QIcon *icon) void NetButton::setButtonIcon(QIcon *icon)
{ {
if (!icon) return; if (!icon) { return; }
m_icon_label->setPixmap(icon->pixmap(this->size())); m_iconLabel->setPixmap(icon->pixmap(this->size()));
} }
void NetButton::onLoadingStarted() void NetButton::onLoadingStarted()

View File

@ -23,8 +23,8 @@ signals:
void requestStopLoading(); void requestStopLoading();
private: private:
bool m_is_activated = INACTIVATED; bool m_isActivated = INACTIVATED;
QLabel * m_icon_label = nullptr; QLabel * m_iconLabel = nullptr;
private slots: private slots:
void onLoadingStarted(); void onLoadingStarted();

View File

@ -28,13 +28,15 @@
static XAtomHelper *global_instance = nullptr; static XAtomHelper *global_instance = nullptr;
XAtomHelper *XAtomHelper::getInstance() { XAtomHelper *XAtomHelper::getInstance()
{
if(!global_instance) if(!global_instance)
global_instance = new XAtomHelper; global_instance = new XAtomHelper;
return global_instance; return global_instance;
} }
bool XAtomHelper::isFrameLessWindow(int winId) { bool XAtomHelper::isFrameLessWindow(int winId)
{
auto hints = getInstance()->getWindowMotifHint(winId); auto hints = getInstance()->getWindowMotifHint(winId);
if(hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) { if(hints.flags == MWM_HINTS_DECORATIONS && hints.functions == 1) {
return true; return true;
@ -42,7 +44,8 @@ bool XAtomHelper::isFrameLessWindow(int winId) {
return false; return false;
} }
bool XAtomHelper::isWindowDecorateBorderOnly(int winId) { bool XAtomHelper::isWindowDecorateBorderOnly(int winId)
{
return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId)); return isWindowMotifHintDecorateBorderOnly(getInstance()->getWindowMotifHint(winId));
} }
@ -55,12 +58,14 @@ bool XAtomHelper::isWindowMotifHintDecorateBorderOnly(const MotifWmHints &hint)
return isDeco; return isDeco;
} }
bool XAtomHelper::isUKUICsdSupported() { bool XAtomHelper::isUKUICsdSupported()
{
// fixme: // fixme:
return false; return false;
} }
bool XAtomHelper::isUKUIDecorationWindow(int winId) { bool XAtomHelper::isUKUIDecorationWindow(int winId)
{
if(m_ukuiDecorationAtion == None) if(m_ukuiDecorationAtion == None)
return false; return false;
@ -87,7 +92,8 @@ bool XAtomHelper::isUKUIDecorationWindow(int winId) {
return isUKUIDecoration; return isUKUIDecoration;
} }
UnityCorners XAtomHelper::getWindowBorderRadius(int winId) { UnityCorners XAtomHelper::getWindowBorderRadius(int winId)
{
UnityCorners corners; UnityCorners corners;
Atom type; Atom type;
@ -117,7 +123,8 @@ UnityCorners XAtomHelper::getWindowBorderRadius(int winId) {
return corners; return corners;
} }
void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data) { void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data)
{
if(m_unityBorderRadiusAtom == None) if(m_unityBorderRadiusAtom == None)
return; return;
@ -127,7 +134,8 @@ void XAtomHelper::setWindowBorderRadius(int winId, const UnityCorners &data) {
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0])); 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0]));
} }
void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight) { void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, int bottomLeft, int bottomRight)
{
if(m_unityBorderRadiusAtom == None) if(m_unityBorderRadiusAtom == None)
return; return;
@ -137,14 +145,16 @@ void XAtomHelper::setWindowBorderRadius(int winId, int topLeft, int topRight, in
32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0])); 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &corners, sizeof(corners) / sizeof(corners[0]));
} }
void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set) { void XAtomHelper::setUKUIDecoraiontHint(int winId, bool set)
{
if(m_ukuiDecorationAtion == None) if(m_ukuiDecorationAtion == None)
return; return;
XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1); XChangeProperty(QX11Info::display(), winId, m_ukuiDecorationAtion, m_ukuiDecorationAtion, 32, XCB_PROP_MODE_REPLACE, (const unsigned char *) &set, 1);
} }
void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints) { void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints)
{
if(m_unityBorderRadiusAtom == None) if(m_unityBorderRadiusAtom == None)
return; return;
@ -152,7 +162,8 @@ void XAtomHelper::setWindowMotifHint(int winId, const MotifWmHints &hints) {
32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof(MotifWmHints) / sizeof(ulong)); 32, XCB_PROP_MODE_REPLACE, (const unsigned char *)&hints, sizeof(MotifWmHints) / sizeof(ulong));
} }
MotifWmHints XAtomHelper::getWindowMotifHint(int winId) { MotifWmHints XAtomHelper::getWindowMotifHint(int winId)
{
MotifWmHints hints; MotifWmHints hints;
if(m_unityBorderRadiusAtom == None) if(m_unityBorderRadiusAtom == None)
@ -177,7 +188,8 @@ MotifWmHints XAtomHelper::getWindowMotifHint(int winId) {
return hints; return hints;
} }
XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent) { XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent)
{
if(!QX11Info::isPlatformX11()) if(!QX11Info::isPlatformX11())
return; return;
@ -186,11 +198,13 @@ XAtomHelper::XAtomHelper(QObject *parent) : QObject(parent) {
m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false); m_ukuiDecorationAtion = XInternAtom(QX11Info::display(), "_KWIN_UKUI_DECORAION", false);
} }
Atom XAtomHelper::registerUKUICsdNetWmSupportAtom() { Atom XAtomHelper::registerUKUICsdNetWmSupportAtom()
{
// fixme: // fixme:
return None; return None;
} }
void XAtomHelper::unregisterUKUICsdNetWmSupportAtom() { void XAtomHelper::unregisterUKUICsdNetWmSupportAtom()
{
// fixme: // fixme:
} }

View File

@ -74,7 +74,8 @@ namespace UKUI {
class Decoration; class Decoration;
} }
class XAtomHelper : public QObject { class XAtomHelper : public QObject
{
// friend class UKUI::Decoration; // friend class UKUI::Decoration;
Q_OBJECT Q_OBJECT
public: public: