add update historywidget and fix some bugs
This commit is contained in:
parent
3f8e58e05d
commit
1901460fa9
|
@ -5,11 +5,12 @@
|
||||||
HistoryInfoLoad::HistoryInfoLoad(const QString &date, QObject *parent)
|
HistoryInfoLoad::HistoryInfoLoad(const QString &date, QObject *parent)
|
||||||
{
|
{
|
||||||
m_historytime = date;
|
m_historytime = date;
|
||||||
|
m_filepath = QDir::homePath() + "/.cache/theme-build/" + m_historytime;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HistoryInfoLoad::getCover()
|
QString HistoryInfoLoad::getCover()
|
||||||
{
|
{
|
||||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime + "/config/preview";
|
QString filePath = m_filepath + "/config/preview";
|
||||||
QString previewFilePath;
|
QString previewFilePath;
|
||||||
|
|
||||||
QFileInfo pngFileInfo(filePath + ".png");
|
QFileInfo pngFileInfo(filePath + ".png");
|
||||||
|
@ -29,7 +30,7 @@ QString HistoryInfoLoad::getCover()
|
||||||
|
|
||||||
QString HistoryInfoLoad::getThemeName()
|
QString HistoryInfoLoad::getThemeName()
|
||||||
{
|
{
|
||||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime + "/debian/control";
|
QString filePath = m_filepath + "/debian/control";
|
||||||
|
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
||||||
|
@ -56,7 +57,7 @@ QString HistoryInfoLoad::getThemeName()
|
||||||
|
|
||||||
QString HistoryInfoLoad::getThemeType()
|
QString HistoryInfoLoad::getThemeType()
|
||||||
{
|
{
|
||||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime;
|
QString filePath = m_filepath;
|
||||||
QDir themeDir(filePath);
|
QDir themeDir(filePath);
|
||||||
|
|
||||||
if (themeDir.exists("globalTheme")) {
|
if (themeDir.exists("globalTheme")) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_filepath = nullptr;
|
||||||
QString m_historytime = nullptr;
|
QString m_historytime = nullptr;
|
||||||
QString m_coverpath = nullptr;
|
QString m_coverpath = nullptr;
|
||||||
QString m_themename = nullptr;
|
QString m_themename = nullptr;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QDesktopServices>
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
|
@ -59,36 +60,25 @@ void MainWindow::initUI()
|
||||||
layout->addWidget(m_cursorbtn);
|
layout->addWidget(m_cursorbtn);
|
||||||
|
|
||||||
|
|
||||||
QWidget *guideWidget = new QWidget();
|
m_guideWidget = new QWidget();
|
||||||
|
|
||||||
QHBoxLayout *labellayout = new QHBoxLayout();
|
QHBoxLayout *labellayout = new QHBoxLayout();
|
||||||
QLabel *Label = new QLabel(guideWidget);
|
QLabel *Label = new QLabel(m_guideWidget);
|
||||||
Label->setText("主题打包上传工具 ");
|
Label->setText("主题打包上传工具 ");
|
||||||
QLabel *guideLabel = new QLabel(guideWidget);
|
// QPushButton *guideLabel = new QPushButton(m_guideWidget);
|
||||||
QString str = "<a href=\" \">"+tr("使用指南") + "</a>";
|
QLabel *guideLabel = new QLabel(m_guideWidget);
|
||||||
|
QString str = "<a href=\"https://gitee.com/openkylin/community/tree/master/sig/UKUITheme\">" + tr("使用指南") + "</a>";
|
||||||
guideLabel->setText(str);
|
guideLabel->setText(str);
|
||||||
guideLabel->setTextFormat(Qt::RichText);
|
guideLabel->setTextFormat(Qt::RichText);
|
||||||
guideLabel->setCursor(Qt::PointingHandCursor);
|
guideLabel->setCursor(Qt::PointingHandCursor);
|
||||||
guideLabel->setOpenExternalLinks(false);
|
guideLabel->setOpenExternalLinks(true); // 将此属性设置为 true
|
||||||
|
|
||||||
|
|
||||||
labellayout->addStretch(1);
|
labellayout->addStretch(1);
|
||||||
labellayout->addWidget(Label);
|
labellayout->addWidget(Label);
|
||||||
labellayout->addWidget(guideLabel);
|
labellayout->addWidget(guideLabel);
|
||||||
labellayout->addStretch(1);
|
labellayout->addStretch(1);
|
||||||
|
|
||||||
guideWidget->setLayout(labellayout);
|
m_guideWidget->setLayout(labellayout);
|
||||||
|
|
||||||
connect(guideLabel, &QLabel::linkActivated,this, [=]() {
|
|
||||||
QDialog* helpDialog = new QDialog(this);
|
|
||||||
helpDialog->setWindowTitle("帮助");
|
|
||||||
QLabel* helpText = new QLabel(helpDialog);
|
|
||||||
helpText->setText("这是帮助信息");
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(helpDialog);
|
|
||||||
layout->addWidget(helpText);
|
|
||||||
helpDialog->setLayout(layout);
|
|
||||||
helpDialog->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_historywidget = new HistoryWidget();
|
m_historywidget = new HistoryWidget();
|
||||||
m_historywidget->setMinimumHeight(2000);
|
m_historywidget->setMinimumHeight(2000);
|
||||||
|
@ -98,13 +88,13 @@ void MainWindow::initUI()
|
||||||
alllayout->addStretch(1);
|
alllayout->addStretch(1);
|
||||||
alllayout->addLayout(layout);
|
alllayout->addLayout(layout);
|
||||||
alllayout->addStretch(1);
|
alllayout->addStretch(1);
|
||||||
alllayout->addWidget(guideWidget);
|
alllayout->addWidget(m_guideWidget);
|
||||||
alllayout->addStretch(1);
|
alllayout->addStretch(1);
|
||||||
}else{
|
}else{
|
||||||
alllayout->addStretch(1);
|
alllayout->addStretch(1);
|
||||||
alllayout->addLayout(layout);
|
alllayout->addLayout(layout);
|
||||||
alllayout->addStretch(1);
|
alllayout->addStretch(1);
|
||||||
alllayout->addWidget(guideWidget);
|
alllayout->addWidget(m_guideWidget);
|
||||||
alllayout->addWidget(m_historywidget);
|
alllayout->addWidget(m_historywidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +143,29 @@ void MainWindow::initUI()
|
||||||
m_infoCreateWidget->show();
|
m_infoCreateWidget->show();
|
||||||
m_bridge->createFileManager(FileProcess::g_date);
|
m_bridge->createFileManager(FileProcess::g_date);
|
||||||
}
|
}
|
||||||
|
if (m_historywidget == nullptr) {
|
||||||
|
m_historywidget = new HistoryWidget();
|
||||||
|
m_historywidget->setMinimumHeight(2000);
|
||||||
|
alllayout->removeWidget(m_guideWidget);
|
||||||
|
alllayout->addWidget(m_guideWidget);
|
||||||
|
alllayout->addWidget(m_historywidget);
|
||||||
|
}
|
||||||
m_historywidget->updateHistoryDir();
|
m_historywidget->updateHistoryDir();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QFileSystemWatcher* watcher = new QFileSystemWatcher(this);
|
||||||
|
watcher->addPath(builderDir.absolutePath());
|
||||||
|
connect(watcher, &QFileSystemWatcher::directoryChanged, this, [=](const QString& path) {
|
||||||
|
if (!builderDir.exists() || builderDir.isEmpty()) {
|
||||||
|
alllayout->removeWidget(m_guideWidget);
|
||||||
|
alllayout->removeItem(alllayout->itemAt(alllayout->count()-1));
|
||||||
|
delete m_historywidget;
|
||||||
|
m_historywidget = nullptr;
|
||||||
|
alllayout->addStretch(1);
|
||||||
|
alllayout->addWidget(m_guideWidget);
|
||||||
|
alllayout->addStretch(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onGoHomeClicked()
|
void MainWindow::onGoHomeClicked()
|
||||||
|
|
|
@ -77,5 +77,8 @@ private:
|
||||||
TitleBar*m_titlebar;
|
TitleBar*m_titlebar;
|
||||||
QPoint m_dragStartPosition;
|
QPoint m_dragStartPosition;
|
||||||
QPoint m_dragPosition;
|
QPoint m_dragPosition;
|
||||||
|
|
||||||
|
QWidget *m_guideWidget;
|
||||||
|
bool m_isHistoryDirUpdated = false;
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -206,7 +206,6 @@ void HistoryButton::initUI()
|
||||||
|
|
||||||
connect(btn_menu, &QPushButton::clicked, this, [=]() {
|
connect(btn_menu, &QPushButton::clicked, this, [=]() {
|
||||||
m_menu->exec(btn_menu->mapToGlobal(btn_menu->rect().bottomLeft()));
|
m_menu->exec(btn_menu->mapToGlobal(btn_menu->rect().bottomLeft()));
|
||||||
qDebug()<<"aaaaaaaaaaaaa";
|
|
||||||
});
|
});
|
||||||
// 连接菜单选项的槽函数
|
// 连接菜单选项的槽函数
|
||||||
connect(action1, &QAction::triggered, this, [=]() {
|
connect(action1, &QAction::triggered, this, [=]() {
|
||||||
|
|
Loading…
Reference in New Issue