fix:适配sdk接口
Signed-off-by: zhoudisi <zhoudisi@kylinos.cn>
This commit is contained in:
parent
4d1d8e453c
commit
568ab24632
|
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
MainDialog w;
|
||||
// 居中窗口
|
||||
centerToScreen(&w);
|
||||
// centerToScreen(&w);
|
||||
a.setWindowIcon(QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS, QIcon(":/images/yhkylin-backup-tools.png")));
|
||||
a.setActivationWindow(&w, true);
|
||||
a.setApplicationName(QObject::tr("Backup & Restore"));
|
||||
|
@ -68,6 +68,9 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(&a,SIGNAL(messageReceived(const QString&)),&w,SLOT(sltMessageReceived(const QString&)));
|
||||
|
||||
w.show();
|
||||
kdk::WindowManager::setGeometry(w.windowHandle(),
|
||||
QRect(qApp->desktop()->geometry().center() - w.geometry().center(),
|
||||
QSize(w.size())));
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,12 @@ MainDialog::MainDialog(QWidget *parent)
|
|||
// 或使用设置毛玻璃属性的方式实现毛玻璃背景(两者都行,可使用其一)
|
||||
this->setProperty("useSystemStyleBlur", true);
|
||||
this->setAutoFillBackground(true);
|
||||
connect(kdk::WindowManager::self(), &kdk::WindowManager::windowAdded, this, [=](const kdk::WindowId& window_id){
|
||||
if (getpid() == kdk::WindowManager::getPid(window_id) && m_window_id == 0)
|
||||
{
|
||||
m_window_id = window_id.toULongLong();
|
||||
}
|
||||
});
|
||||
|
||||
// 去除窗管标题栏,传入参数为QWidget *
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
|
@ -202,6 +208,13 @@ void MainDialog::initConnect()
|
|||
// 关于
|
||||
connect(m_backupAbout, &QAction::triggered, this, [=] {
|
||||
AboutDialog *about = new AboutDialog(this);
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(about);
|
||||
if(!GlobelBackupInfo::instance().isWayland()){
|
||||
about->setModal(true);
|
||||
about->show();
|
||||
about->move(width()/2-about->width()/2+x(),height()/2-about->height()/2+y());
|
||||
kdk::WindowManager::setGeometry(about->windowHandle(),about->geometry());
|
||||
}
|
||||
about->exec();
|
||||
about->deleteLater();
|
||||
});
|
||||
|
@ -213,14 +226,16 @@ void MainDialog::initConnect()
|
|||
});
|
||||
|
||||
//最小化按钮
|
||||
connect(m_minBtn, &QPushButton::clicked, this, &MainDialog::showMinimized);
|
||||
connect(m_minBtn, &QPushButton::clicked, this, [=](){
|
||||
kdk::WindowManager::minimizeWindow(m_window_id);
|
||||
});
|
||||
|
||||
//最大化按钮
|
||||
connect(m_maxBtn, &QPushButton::clicked, this, [=] {
|
||||
if (isMaximized()) {
|
||||
showNormal();
|
||||
} else {
|
||||
showMaximized();
|
||||
kdk::WindowManager::maximizeWindow(m_window_id);
|
||||
}
|
||||
});
|
||||
connect(m_titleWidget, &DoubleClickWidget::doubleClicked, m_maxBtn, &QPushButton::click);
|
||||
|
@ -429,7 +444,7 @@ void MainDialog::resizeEvent(QResizeEvent *event) {
|
|||
void MainDialog::closeBtn()
|
||||
{
|
||||
if (this->close()) {
|
||||
qApp->quit();
|
||||
kdk::WindowManager::closeWindow(m_window_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include <QDBusReply>
|
||||
#include "leftsiderbarwidget.h"
|
||||
#include "component/doubleclickwidget.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainDialog; }
|
||||
|
@ -71,6 +74,8 @@ private:
|
|||
// 监控是否平板的dbus接口
|
||||
QDBusInterface * m_statusSessionDbus = nullptr;
|
||||
|
||||
quint64 m_window_id;
|
||||
|
||||
Ui::MainDialog *ui;
|
||||
};
|
||||
#endif // MAINDIALOG_H
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
#include "globalsignals.h"
|
||||
#include "globalbackupinfo.h"
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
#include <ukuistylehelper/ukuistylehelper.h>
|
||||
#include <QDebug>
|
||||
#include <windowmanager/windowmanager.h>
|
||||
MyMessageBox::MyMessageBox(QWidget *parent) :
|
||||
QMessageBox(parent)
|
||||
{
|
||||
setThemeIcon(THEME_YHKYLIN_BACKUP_TOOLS);
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(this);
|
||||
}
|
||||
|
||||
MyMessageBox::~MyMessageBox()
|
||||
|
@ -51,6 +53,7 @@ void MessageBoxUtils::QMESSAGE_BOX_INFORMATION(QWidget* q_parent, const QString&
|
|||
box->setText(message);
|
||||
QPushButton * okbtn = box->addButton(label, QMessageBox::AcceptRole);
|
||||
box->setDefaultButton(okbtn);
|
||||
box->show();
|
||||
box->exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../gsettingswrapper.h"
|
||||
#include "kwidget.h"
|
||||
#include "kborderbutton.h"
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
using namespace kdk;
|
||||
|
||||
|
@ -206,6 +207,9 @@ void DataBackup::initHomePage()
|
|||
this->m_prefixDestPath = backupPoint.m_path;
|
||||
this->m_isLocal = backupPoint.m_iPosition == BackupPosition::UDISK || backupPoint.m_iPosition == BackupPosition::OTHER ? false : true;
|
||||
});
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
selectDialog->move(position.x()-100+parentWidget()->width()/2-selectDialog->width()/2,position.y()-20+parentWidget()->height()/2-selectDialog->height()/2);
|
||||
kdk::WindowManager::setGeometry(selectDialog->windowHandle(),selectDialog->geometry());
|
||||
|
||||
if (QDialog::Accepted == selectDialog->exec()) {
|
||||
this->m_isIncrement = true;
|
||||
|
@ -239,6 +243,9 @@ void DataBackup::initHomePage()
|
|||
|
||||
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
||||
ManageBackupPointList backupManager(homePage, ManageBackupPointList::DATA);
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
backupManager.move(position.x()-100+parentWidget()->width()/2-backupManager.width()/2,position.y()-20+parentWidget()->height()/2-backupManager.height()/2);
|
||||
kdk::WindowManager::setGeometry(backupManager.windowHandle(),backupManager.geometry());
|
||||
backupManager.exec();
|
||||
});
|
||||
connect(GlobelBackupInfo::instance().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "messageboxutils.h"
|
||||
#include "selectrestorepoint.h"
|
||||
#include "kborderbutton.h"
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
using namespace kdk;
|
||||
// bigTitle控件前面的宽度:24+spacing
|
||||
|
@ -191,6 +192,9 @@ void DataRestore::on_button_beginRestore_clicked(bool checked)
|
|||
this->m_devPath = backupPoint.m_path;
|
||||
this->m_iPosition = backupPoint.m_iPosition;
|
||||
});
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
selectRestoreDialog->move(position.x()-100+parentWidget()->width()/2-selectRestoreDialog->width()/2,position.y()-20+parentWidget()->height()/2-selectRestoreDialog->height()/2);
|
||||
kdk::WindowManager::setGeometry(selectRestoreDialog->windowHandle(),selectRestoreDialog->geometry());
|
||||
|
||||
if (QDialog::Rejected == selectRestoreDialog->exec()) {
|
||||
selectRestoreDialog->deleteLater();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "selectrestorepoint.h"
|
||||
#include "messageboxutils.h"
|
||||
#include "kborderbutton.h"
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
using namespace kdk;
|
||||
// bigTitle控件前面的宽度:24+spacing
|
||||
|
@ -176,6 +177,9 @@ void GhostImage::initHomePage()
|
|||
this->m_backupName = backupPoint.m_backupName;
|
||||
this->m_iPosition = backupPoint.m_iPosition;
|
||||
});
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
selectDialog->move(position.x()-100+parentWidget()->width()/2-selectDialog->width()/2,position.y()-20+parentWidget()->height()/2-selectDialog->height()/2);
|
||||
kdk::WindowManager::setGeometry(selectDialog->windowHandle(),selectDialog->geometry());
|
||||
|
||||
if (QDialog::Accepted == selectDialog->exec()) {
|
||||
this->m_isLocal = true;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "managebackuppointlist.h"
|
||||
#include "messageboxutils.h"
|
||||
#include "kborderbutton.h"
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
using namespace kdk;
|
||||
// bigTitle控件前面的宽度:24+spacing
|
||||
|
@ -181,6 +182,9 @@ void SystemBackup::initHomePage()
|
|||
|
||||
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
||||
ManageBackupPointList backupManager(homePage, ManageBackupPointList::SYSTEM);
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
backupManager.move(position.x()-100+parentWidget()->width()/2-backupManager.width()/2,position.y()-20+parentWidget()->height()/2-backupManager.height()/2);
|
||||
kdk::WindowManager::setGeometry(backupManager.windowHandle(),backupManager.geometry());
|
||||
backupManager.exec();
|
||||
});
|
||||
connect(GlobelBackupInfo::instance().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "messageboxutils.h"
|
||||
#include "selectrestorepoint.h"
|
||||
#include "kborderbutton.h"
|
||||
#include <windowmanager/windowmanager.h>
|
||||
|
||||
using namespace kdk;
|
||||
// bigTitle控件前面的宽度:24+spacing
|
||||
|
@ -244,6 +245,9 @@ void SystemRestore::on_button_beginRestore_clicked(bool checked)
|
|||
this->m_isOtherMachine = backupPoint.m_iPosition == BackupPosition::OTHER ? true : false;
|
||||
this->m_iPosition = backupPoint.m_iPosition == BackupPosition::OTHER ? BackupPosition::UDISK : backupPoint.m_iPosition;
|
||||
});
|
||||
QPointF position = parentWidget()->mapToGlobal(QPoint(0,0));
|
||||
selectRestoreDialog->move(position.x()-100+parentWidget()->width()/2-selectRestoreDialog->width()/2,position.y()-20+parentWidget()->height()/2-selectRestoreDialog->height()/2);
|
||||
kdk::WindowManager::setGeometry(selectRestoreDialog->windowHandle(),selectRestoreDialog->geometry());
|
||||
|
||||
if (QDialog::Rejected == selectRestoreDialog->exec()) {
|
||||
selectRestoreDialog->deleteLater();
|
||||
|
|
Loading…
Reference in New Issue