!29 add update historywidget and fix some bugs
Merge pull request !29 from likehomedream/my-2.0-devel
This commit is contained in:
commit
69d86b4d3d
|
@ -5,11 +5,12 @@
|
|||
HistoryInfoLoad::HistoryInfoLoad(const QString &date, QObject *parent)
|
||||
{
|
||||
m_historytime = date;
|
||||
m_filepath = QDir::homePath() + "/.cache/theme-build/" + m_historytime;
|
||||
}
|
||||
|
||||
QString HistoryInfoLoad::getCover()
|
||||
{
|
||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime + "/config/preview";
|
||||
QString filePath = m_filepath + "/config/preview";
|
||||
QString previewFilePath;
|
||||
|
||||
QFileInfo pngFileInfo(filePath + ".png");
|
||||
|
@ -29,7 +30,7 @@ QString HistoryInfoLoad::getCover()
|
|||
|
||||
QString HistoryInfoLoad::getThemeName()
|
||||
{
|
||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime + "/debian/control";
|
||||
QString filePath = m_filepath + "/debian/control";
|
||||
|
||||
QFile file(filePath);
|
||||
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
||||
|
@ -56,7 +57,7 @@ QString HistoryInfoLoad::getThemeName()
|
|||
|
||||
QString HistoryInfoLoad::getThemeType()
|
||||
{
|
||||
QString filePath = QDir::homePath() + "/.cache/theme-build/" + m_historytime;
|
||||
QString filePath = m_filepath;
|
||||
QDir themeDir(filePath);
|
||||
|
||||
if (themeDir.exists("globalTheme")) {
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
signals:
|
||||
|
||||
private:
|
||||
QString m_filepath = nullptr;
|
||||
QString m_historytime = nullptr;
|
||||
QString m_coverpath = nullptr;
|
||||
QString m_themename = nullptr;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDesktopServices>
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
@ -59,36 +60,25 @@ void MainWindow::initUI()
|
|||
layout->addWidget(m_cursorbtn);
|
||||
|
||||
|
||||
QWidget *guideWidget = new QWidget();
|
||||
m_guideWidget = new QWidget();
|
||||
|
||||
QHBoxLayout *labellayout = new QHBoxLayout();
|
||||
QLabel *Label = new QLabel(guideWidget);
|
||||
QLabel *Label = new QLabel(m_guideWidget);
|
||||
Label->setText("主题打包上传工具 ");
|
||||
QLabel *guideLabel = new QLabel(guideWidget);
|
||||
QString str = "<a href=\" \">"+tr("使用指南") + "</a>";
|
||||
// QPushButton *guideLabel = new QPushButton(m_guideWidget);
|
||||
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->setTextFormat(Qt::RichText);
|
||||
guideLabel->setCursor(Qt::PointingHandCursor);
|
||||
guideLabel->setOpenExternalLinks(false);
|
||||
|
||||
guideLabel->setOpenExternalLinks(true); // 将此属性设置为 true
|
||||
|
||||
labellayout->addStretch(1);
|
||||
labellayout->addWidget(Label);
|
||||
labellayout->addWidget(guideLabel);
|
||||
labellayout->addStretch(1);
|
||||
|
||||
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_guideWidget->setLayout(labellayout);
|
||||
|
||||
m_historywidget = new HistoryWidget();
|
||||
m_historywidget->setMinimumHeight(2000);
|
||||
|
@ -98,13 +88,13 @@ void MainWindow::initUI()
|
|||
alllayout->addStretch(1);
|
||||
alllayout->addLayout(layout);
|
||||
alllayout->addStretch(1);
|
||||
alllayout->addWidget(guideWidget);
|
||||
alllayout->addWidget(m_guideWidget);
|
||||
alllayout->addStretch(1);
|
||||
}else{
|
||||
alllayout->addStretch(1);
|
||||
alllayout->addLayout(layout);
|
||||
alllayout->addStretch(1);
|
||||
alllayout->addWidget(guideWidget);
|
||||
alllayout->addWidget(m_guideWidget);
|
||||
alllayout->addWidget(m_historywidget);
|
||||
}
|
||||
|
||||
|
@ -153,8 +143,29 @@ void MainWindow::initUI()
|
|||
m_infoCreateWidget->show();
|
||||
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();
|
||||
});
|
||||
|
||||
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()
|
||||
|
|
|
@ -77,5 +77,8 @@ private:
|
|||
TitleBar*m_titlebar;
|
||||
QPoint m_dragStartPosition;
|
||||
QPoint m_dragPosition;
|
||||
|
||||
QWidget *m_guideWidget;
|
||||
bool m_isHistoryDirUpdated = false;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -206,7 +206,6 @@ void HistoryButton::initUI()
|
|||
|
||||
connect(btn_menu, &QPushButton::clicked, this, [=]() {
|
||||
m_menu->exec(btn_menu->mapToGlobal(btn_menu->rect().bottomLeft()));
|
||||
qDebug()<<"aaaaaaaaaaaaa";
|
||||
});
|
||||
// 连接菜单选项的槽函数
|
||||
connect(action1, &QAction::triggered, this, [=]() {
|
||||
|
|
Loading…
Reference in New Issue