修改打包器包名生成机制以及文本提示

This commit is contained in:
gfdgd xi 2024-07-14 18:27:01 +08:00
parent de98af8c99
commit ebb6c2c5fa
9 changed files with 238 additions and 14 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ VM-source/Makefile
*.rpm
*.pro.user
.vscode
build-*-Debug

74
ExePreview/.gitignore vendored Normal file
View File

@ -0,0 +1,74 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
CMakeLists.txt.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

View File

@ -0,0 +1,3 @@
{
"Keys": ["application/x-ms-dos-executable", "application/x-msi", "application/x-ms-shortcut"]
}

31
ExePreview/ExePreview.pro Normal file
View File

@ -0,0 +1,31 @@
QT += gui
TEMPLATE = lib
CONFIG += plugin core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
INCLUDEPATH += /usr/include/dde-file-manager/
DISTFILES += dfmpreview-wine-runner-plugin.json
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
dfmexepreview.cpp \
main.cpp
HEADERS += \
dfmexepreview.h \
main.h
DISTFILES += ExePreview.json
# Default rules for deployment.
unix {
target.path = $$[QT_INSTALL_PLUGINS]/generic
}
!isEmpty(target.path): INSTALLS += target

View File

@ -0,0 +1,59 @@
#include "dfmexepreview.h"
#include <dfileservices.h>
DFMExePreview::DFMExePreview(QObject *parent) : DFMFilePreview(parent)
{
}
DFMExePreview::~DFMExePreview()
{
if (m_view) {
m_view->deleteLater();
m_view = NULL;
}
if (m_statusBar) {
m_statusBar->deleteLater();
m_statusBar = NULL;
}
}
void DFMExePreview::initialize(QWidget *window, QWidget *statusBar)
{
Q_UNUSED(window)
Q_UNUSED(statusBar)
if (!m_view) {
m_view = new QLabel();
}
if (!m_statusBar) {
m_statusBar = new QLabel();
}
}
bool DFMExePreview::setFileUrl(const DUrl &url)
{
m_url = url;
m_view->setText("114514");
return 1;
}
DUrl DFMExePreview::fileUrl() const
{
return m_url;
}
QWidget *DFMExePreview::contentWidget() const
{
return m_view;
}
QWidget *DFMExePreview::statusBarWidget() const
{
return m_statusBar;
}
QString DFMExePreview::title() const
{
return m_title;
}

View File

@ -0,0 +1,28 @@
#ifndef DFMEXEPREVIEW_H
#define DFMEXEPREVIEW_H
#include <QObject>
#include <dfmfilepreview.h>
#include <QLabel>
class DFMExePreview : public DFM_NAMESPACE::DFMFilePreview
{
Q_OBJECT
public:
explicit DFMExePreview(QObject *parent = NULL);
~DFMExePreview();
virtual void initialize(QWidget *window, QWidget *statusBar) Q_DECL_OVERRIDE;
virtual bool setFileUrl(const DUrl &url) Q_DECL_OVERRIDE;
virtual DUrl fileUrl() const Q_DECL_OVERRIDE;
virtual QWidget *contentWidget() const Q_DECL_OVERRIDE;
virtual QWidget *statusBarWidget() const Q_DECL_OVERRIDE;
virtual QString title() const Q_DECL_OVERRIDE;
protected:
DUrl m_url;
QLabel *m_view = NULL;
QLabel *m_statusBar = NULL;
QString m_title;
};
#endif // DFMEXEPREVIEW_H

17
ExePreview/main.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "main.h"
#include "dfmexepreview.h"
GenericPlugin::GenericPlugin(QObject *parent)
: DFM_NAMESPACE::DFMFilePreviewPlugin(parent)
{
}
/*QObject *GenericPlugin::create(const QString &name, const QString &spec)
{
}*/
DFM_NAMESPACE::DFMFilePreview *GenericPlugin::create(const QString &key)
{
Q_UNUSED(key);
return new DFMExePreview;
}

22
ExePreview/main.h Normal file
View File

@ -0,0 +1,22 @@
#define DFMFilePreviewFactoryInterface_ood "com.deepin.filemanager.DFMFilePreviewFactoryInterface_WineRunner"
#ifndef MAIN_H
#define MAIN_H
#include <QGenericPlugin>
#include <dfmfilepreviewplugin.h>
class GenericPlugin : public DFM_NAMESPACE::DFMFilePreviewPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QGenericPluginFactoryInterface_iid FILE "ExePreview.json")
public:
explicit GenericPlugin(QObject *parent = nullptr);
virtual DFM_NAMESPACE::DFMFilePreview *create(const QString &key);
};
#endif // MAIN_H

View File

@ -2255,20 +2255,10 @@ def ChangeBottleName():
if len(e2_text.text()) > 0:
if ord(e2_text.text()[0]) < 48 or ord(e2_text.text()[0]) > 57:
e2_text.setText(e2_text.text()[1:])
if bottleNameLock:
return
if os.path.basename(e6_text.text()) == ".wine" or e6_text.text() == "":
bottleNameChangeLock = True
e5_text.setText(e1_text.text())
return
# 调整逻辑,容器名默认与包名相同
bottleNameChangeLock = True
e5_text.setText(os.path.basename(e6_text.text().replace(" ", "")))
e5_text.setText(e1_text.text())
def LockBottleName():
global bottleNameLock
if bottleNameChangeLock:
return
bottleNameLock = True
# 获取当前语言
def get_now_lang()->"获取当前语言":
@ -2419,14 +2409,13 @@ installDeb.clicked.connect(InstallDeb)
wineFrame.addWidget(wineVersion)
e1_text.textChanged.connect(ChangeBottleName)
e2_text.textChanged.connect(ChangeBottleName)
e5_text.textChanged.connect(LockBottleName)
e6_text.textChanged.connect(ChangeBottleName)
e7_text.textChanged.connect(ChangeTapTitle)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包版本号(※必填):")), 1, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包说明(※必填):")), 2, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包维护者(※必填):")), 3, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要解压 wine 容器的名称(※必填")), 4, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "Wine 容器名称(※必填,推荐默认")), 4, 0, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包 wine 容器的路径(※必填):")), 5, 0, 1, 1)
desktopIconTab = QtWidgets.QTabWidget()
controlWidget = QtWidgets.QWidget()