0 Star 2 Fork 1

Cadaqs/XStudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
PackageViewer.xcsm 28.55 KB
一键复制 编辑 原始数据 按行查看 历史
Cadaqs 提交于 2021-07-13 17:34 . 10751
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
//xlang Source, Name:PackageViewer.xcsm
//Date: Fri Dec 22:58:50 2018
class PackageViewer : QDialog{
QTreeWidget pcklist;
QPushButton btnInstall, btnDelete, btnAdd, btnExport, loadpack, editsrc;
QLineEdit keyedit;
QLabel labstatus;
QProgressBar progressBar;
String pkgSource = "http://112.124.120.113:8080/dcbinterface/api/getpackages";
PackageManager.PackageInfo [] net_cache_pis;
PackageManager pm = new PackageManager();
bool loadingInProgress = false;
static PackageViewer _viewer = nilptr;
static Object prog_lock = new Object();
static Map<String, int> dllist = new Map<String, int>();
public void updateProgress(){
int total_prog = 0;
int task_count = 0;
synchronized(dllist){
Map.Iterator<String, int> iter = dllist.iterator();
while (iter.hasNext()){
String key = iter.getKey();
total_prog += DownloadCenter.getTaskProgress(key);
task_count++;
iter.next();
}
}
if (task_count != 0){
progressBar.setValue(total_prog / task_count);
}else{
progressBar.setValue(100);
}
if (task_count > 0){
labstatus.setText("共有 " + task_count + " 个任务正在进行中.");
}else{
labstatus.setText("就绪.");
}
}
public void loadPackages(){
JsonObject root;
try{
HttpRequest req = new HttpRequest();
if (req.get(pkgSource, 300000, pkgSource.upper().startsWith("HTTPS://"))){
if (req.getResponseCode() >= 200){
byte [] data = new byte[4096];
String jsondata = "";
while (req.available(true) > 0){
int readlen = req.readData(data,0,data.length);
jsondata = jsondata + new String(data, 0, readlen);
}
root = new JsonObject(jsondata);
}
}
}catch(Exception e){
root = nilptr;
}
if (root == nilptr){
runOnUi(new Runnable(){
void run() override{
QMessageBox.Critical("错误","从网络加载时发生错误!",QMessageBox.Ok,QMessageBox.Ok);
labstatus.setText("加载 " + pkgSource + " 失败!");
loadingInProgress = false;
}
});
return ;
}else{
Vector<PackageManager.PackageInfo> dlpkgs = new Vector<PackageManager.PackageInfo>();
int error = root.getInt("error");
if (error == 0){
JsonArray pkgs = (JsonArray)root.get("data");
if (pkgs != nilptr){
for (int i = 0, c = pkgs.length(); i < c; i++){
JsonObject item = (JsonObject)pkgs.get(i);
if (item != nilptr){
PackageManager.PackageInfo pinfo = new PackageManager.PackageInfo(item);
dlpkgs.add(pinfo);
}
}
runOnUi( new Runnable(){
void run() override{
onloadSuccess(dlpkgs.toArray(new PackageManager.PackageInfo[0]));
}
});
}
runOnUi( new Runnable(){
void run() override{
labstatus.setText("加载 " + pkgSource + " 成功!");
loadingInProgress = false;
}
});
}else{
runOnUi(new Runnable(){
void run() override{
QMessageBox.Critical("错误","包数据错误!",QMessageBox.Ok,QMessageBox.Ok);
labstatus.setText("加载 " + pkgSource + " 失败!");
loadingInProgress = false;
}
});
}
}
}
public void onloadSuccess(@NotNilptr PackageManager.PackageInfo [] pkgs){
loadList();
loadNetList(pkgs);
}
public void onAttach() override {
//setFixedSize(width(), height());
pcklist = (QTreeWidget)attachByName(new QTreeWidget(), "pcklist");
pcklist.setWhatsThis("显示当前开发环境中已安装的包");
btnInstall = (QPushButton)attachByName(new QPushButton(), "btnInstall");
btnInstall.setWhatsThis("从文件安装一个包到开发环境中");
btnDelete = (QPushButton)attachByName(new QPushButton(), "btnDelete");
btnDelete.setWhatsThis("删除选择的包");
btnAdd = (QPushButton)attachByName(new QPushButton(), "btnAdd");
btnAdd.setWhatsThis("将选择的包添加到当前的项目中");
btnExport = (QPushButton)attachByName(new QPushButton(), "btnExport");
btnExport.setWhatsThis("将选择的包导出到文件");
keyedit = (QLineEdit)attachByName(new QLineEdit(), "keyedit");
keyedit.setWhatsThis("输入包名或者描述关键字,支持模糊搜索");
labstatus = (QLabel)attachByName(new QLabel(), "labstatus");
labstatus.setWhatsThis("显示当前状态");
progressBar = (QProgressBar)attachByName(new QProgressBar(), "progressBar");
progressBar.setWhatsThis("显示当前总进度");
btnExport = (QPushButton)attachByName(new QPushButton(), "btnExport");
btnExport.setWhatsThis("将选择的包导出到文件");
loadpack = (QPushButton)attachByName(new QPushButton(), "loadpack");
loadpack.setWhatsThis("加载包");
editsrc = (QPushButton)attachByName(new QPushButton(), "editsrc");
editsrc.setWhatsThis("更改软件源");
String [] columns = {"名称", "版本", "描述", "状态", "发布者"};
pcklist.setColumns(columns);
pcklist.setColumnWidth(0,220);
pcklist.setColumnWidth(1,80);
pcklist.setColumnWidth(2,550);
pcklist.setColumnWidth(3,80);
pcklist.setColumnWidth(4,150);
pcklist.setOnTreeViewItemEvent( new onTreeViewItemEvent(){
void onItemClicked(@NotNilptr QTreeWidget tree,long item, int column){
if (column == 4){
String txt = tree.getItemText(item, column);
if (txt.upper().startsWith("HTTP")){
if (QMessageBox.Question("提示","是否转到发布者网站: <b>" + txt + "</b> ?",QMessageBox.Ok | QMessageBox.No,QMessageBox.Ok) == QMessageBox.Ok){
openUrl(txt);
}
}
}
}
});
if (pm.load() == false){
QMessageBox.Critical("错误", "加载包时出现故障", QMessageBox.Ok, QMessageBox.Ok);
}else{
loadList();
}
if (XWorkspace.workspace != nilptr){
btnAdd.setEnabled(XWorkspace.workspace.isCurrentProjectEmpty() == false);
}else{
btnAdd.setEnabled(false);
}
loadpack.setOnClickListener(new onClickListener(){
void onClick(QObject obj, bool checked)override{
loadNetinfo();
}
});
editsrc.setOnClickListener(new onClickListener(){
void onClick(QObject obj, bool checked)override{
editSrcaddress();
}
});
btnInstall.setOnClickListener(new onClickListener(){
void onClick(QObject obj, bool checked)override{
String file = QFileDialog.getOpenFileName("添加包", nilptr, "X 包 (*.xp)", PackageViewer.this);
if (file != nilptr && file.length() > 0){
install(file);
}
}
});
btnAdd.setOnClickListener(new onClickListener(){
void onClick(QObject obj, bool checked)override{
importToProject();
}
});
btnDelete.setOnClickListener( new onClickListener(){
void onClick(QObject obj,bool checked)override{
deletePackage();
}
});
btnExport.setOnClickListener( new onClickListener(){
void onClick(QObject obj,bool checked)override{
exportPackage();
}
});
setWindowIcon("./res/package64.png");
createContextMenu();
keyedit.setOnKeyEventListener(new onKeyEventListener() {
bool onKeyPress(QObject obj,int key,bool repeat,int count,String text,int scanCode,int virtualKey,int modifier)override {
if (key == Constant.Key_Escape) {
keyedit.setText("");
}
return true;
}
});
keyedit.setOnEditEventListener(new onEditEventListener() {
void onTextChanged(QObject, @NotNilptr String text)override {
String key = text.upper();
long [] items = pcklist.getTopItems();
int c = pcklist.getTopLevelCount();
try{
for (int i = 0; i < c; i++){
bool visible = false;
for (int x = 0; x < 5; x ++){
String itemtext = pcklist.getItemText(items[i],x);
if (Pattern.test(itemtext.upper(), key, 0, false)){
visible = true;
break;
}
}
pcklist.setItemVisible(items[i],visible);
}
}catch(Exception e){
}
}
});
synchronized(prog_lock){
_viewer = this;
}
loadNetinfo();
}
public void loadNetinfo(){
loadingInProgress = true;
labstatus.setText("正在从 " + pkgSource + " 加载包信息...");
new Thread(){
void run()override{
loadPackages();
}
}.start();
}
public void editSrcaddress()
{
InputDialog.requestInput(new InputDialog.onInputListener() {
bool onInputOk(@NotNilptr String text)override {
if (text.length() == 0) {
QMessageBox.Critical("错误", "输入了不正确的地址", QMessageBox.Ok, QMessageBox.Ok);
return false;
}
pkgSource = text;
loadNetinfo();
return true;
}
bool onInputCancel()override {
return true;
}
String getTitle()override {
return "更改源";
}
String getTips()override {
return "输入源地址:";
}
String getDefault()override {
return pkgSource;
}
});
}
public void installSelPkgs(){
long []items = pcklist.getSelectedItems();
if (items != nilptr && items.length > 0){
for (int i =0; i < items.length; i++){
long dlid = pcklist.getItemTag(items[i], 3);
if (dlid > 0 && dlid < net_cache_pis.length){
int nid = dlid - 1;
PackageManager.PackageInfo pinfo = net_cache_pis[nid];
if (pinfo != nilptr && pinfo.detectCache()){
install(pinfo.cacheFile);
}else{
QMessageBox.Critical("注意","未获取完成,无法进行安装",QMessageBox.Ok,QMessageBox.Ok);
}
}
}
}
}
public void downloadSelPkgs(){
long []items = pcklist.getSelectedItems();
if (items != nilptr && items.length > 0){
for (int i =0; i < items.length; i++){
long dlid = pcklist.getItemTag(items[i], 3);
if (dlid > 0){
int nid = dlid - 1;
PackageManager.PackageInfo pinfo = net_cache_pis[nid];
if (pinfo != nilptr && pinfo.detectCache()){
install(pinfo.cacheFile);
}else{
DownloadCenter.createDownload(net_cache_pis[nid].name, net_cache_pis[nid].url, net_cache_pis[nid].cacheFile, net_cache_pis[nid].dlsize, new DownloadListener(){
void onStatus(DownloadStatus status, int prog, Object tag){
synchronized(prog_lock){
if (_viewer != nilptr){
_viewer.runOnUi(new Runnable(){
void run() override{
synchronized(prog_lock){
_viewer.onUpdateProgress(status, prog, tag);
}
}
});
}
}
if ((status == DownloadStatus.DL_DONE) || (status == DownloadStatus.DL_CANCEL)){
synchronized(dllist){
dllist.remove(net_cache_pis[nid].name);
}
}
}
},net_cache_pis[nid]);
synchronized(dllist){
dllist.put(net_cache_pis[nid].name, 0);
}
}
}
}
}
}
public void onUpdateProgress(DownloadStatus status, int prog, Object tag){
long [] items = pcklist.getTopItems();
int c = pcklist.getTopLevelCount();
PackageManager.PackageInfo pinfo = (PackageManager.PackageInfo)tag;
if (pinfo != nilptr){
for (int i = 0; i < c; i++){
bool visible = false;
String itemtext = pcklist.getItemText(items[i],0);
if (pinfo.name.equals(itemtext)){
switch(status){
case DownloadStatus.DL_BEGIN:
pcklist.setItemText(items[i],3,"开始下载...");
break;
case DownloadStatus.DL_INPROCESSING:
pcklist.setItemText(items[i],3,"已下载:" + prog + "%...");
break;
case DownloadStatus.DL_DONE:
if (prog == 100){
pcklist.setItemText(items[i],3,"下载完成");
install(pinfo.cacheFile);
}else{
pcklist.setItemText(items[i],3,"下载失败");
}
break;
}
break;
}
}
}
updateProgress();
}
public void exportPackage(){
long []items = pcklist.getSelectedItems();
if (items != nilptr && items.length > 0){
for (int i = 0; i < items.length; i++){
int id = pcklist.getItemTag(items[i], 0);
PackageManager.PackageInfo pi = pm.get(id);
if (pi != nilptr){
String floder = QFileDialog.getFolderPath("选择导出目录","" ,"", this);
if (floder != nilptr && floder.length() > 0){
floder = String.formatPath(floder.appendPath(pi.name + pi.version + ".xp"), false);
PackageManager.copyFile(floder, pi.filepath);
}
}
}
}
}
public ContextMenu _contextMenu = new ContextMenu();
public void createContextMenu(){
QTreeWidget list = pcklist;
onEventListener menuListener = new onEventListener(){
public void onTrigger(QObject obj) override{
if (obj == _contextMenu.actions[0]){
if (btnInstall._clicklistener != nilptr){
btnInstall._clicklistener.onClick(btnInstall,false);
}
}else
if (obj == _contextMenu.actions[2]){
loadNetinfo();
}else
if (obj == _contextMenu.actions[4]){
importToProject();
}else
if (obj == _contextMenu.actions[6]){
downloadSelPkgs();
}else
if (obj == _contextMenu.actions[7]){
installSelPkgs();
}else
if (obj == _contextMenu.actions[8]){
exportPackage();
}else
if (obj == _contextMenu.actions[10]){
deletePackage();
}
}
};
if (list != nilptr){
String []acts = {"从文件安装...","-", "刷新","-", "添加到当前项目", "-", "获取包", "安装", "导出", "-", "删除"};
_contextMenu.create(list, acts, menuListener, nilptr);
for (int i =0; i < acts.length; i++){
_contextMenu.setEnable(i, true);
}
}
}
public void deletePackage(){
long []items = pcklist.getSelectedItems();
String tips = "将删除包:\n";
if (items != nilptr && items.length > 0){
int count = 0;
for (int i = 0; i < items.length; i++){
int id = pcklist.getItemTag(items[i], 0);
PackageManager.PackageInfo pi = pm.get(id);
if (pi != nilptr){
tips = tips + "\t" + pi.name + " " + pi.version;
count++;
}
}
if (count > 0){
int r = QMessageBox.Question("注意",tips,QMessageBox.Ok | QMessageBox.Cancel ,QMessageBox.Ok );
if (r == QMessageBox.Ok ){
for (int i = 0; i < items.length; i++){
int id = pcklist.getItemTag(items[items.length - (i + 1)], 0);
PackageManager.PackageInfo pi = pm.get(id);
if (pi != nilptr){
pm.deletePackage(pi);
}
}
}
}
pm.save();
reloadList();
}
}
public void install(@NotNilptr String file){
PackageManager.PackageInfo pi = pm.previewPackage(file);
if (pi == nilptr){
QMessageBox.Critical("错误", file + " 不是一个有效的X包.", QMessageBox.Ok, QMessageBox.Ok);
return;
}
long newVersion = Utils.getVersionValue(pi.version);
Vector<PackageManager.PackageInfo> pl = pm.findPackages(pi.name, nilptr);
if (pl.size() == 0){
if (QMessageBox.Information("提示", "将安装包 " + pi.name + " " + pi.version + "?" + "<br /><br />简介:<br /><b>" + pi.descr + "</b><br /><br />发布者:<a href=\"" + pi.author + "\">" + pi.author + "<em>", QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Ok) == QMessageBox.Ok){
if (pm.installPackage(pi)){
reloadList();
}else{
QMessageBox.Critical("提示", "安装包 " + pi.name + " " + pi.version + "失败!", QMessageBox.Ok, QMessageBox.Ok);
}
}
}else{
bool bExists = false, bUpgrade = false, bDowngrade = false;
for (int i = 0, c = pl.size(); i < c; i ++){
PackageManager.PackageInfo pe = pl.get(i);
if (pe != nilptr ){
long v = Utils.getVersionValue(pe.version);
if (v == newVersion){
bExists = true;
}else
if (v < newVersion){
bUpgrade = true;
}else{
bDowngrade = true;
}
}
}
if (bExists){
if (QMessageBox.Question("包已存在","此包已存在,是否重新安装?",QMessageBox.Yes | QMessageBox.Cancel,QMessageBox.Cancel) == QMessageBox.Cancel){
return ;
}
PackageManager.PackageInfo pe = pm.findPackage(pi.name, pi.version);
while (pe != nilptr){
pm.deletePackage(pe);
pe = pm.findPackage(pi.name, pi.version);
}
if (QMessageBox.Information("提示", "将安装包 " + pi.name + " " + pi.version + "?" + "<br /><br />简介:<br /><b>" + pi.descr + "</b><br /><br />发布者:<a href=\"" + pi.author + "\">" + pi.author + "<em>", QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Ok) == QMessageBox.Ok){
if (pm.installPackage(pi)){
reloadList();
}else{
QMessageBox.Critical("提示", "安装包 " + pi.name + " " + pi.version + "失败!", QMessageBox.Ok, QMessageBox.Ok);
}
}
}else
if (bUpgrade){
if (QMessageBox.Question("升级包","是否删除旧版包?",QMessageBox.Yes | QMessageBox.Cancel,QMessageBox.Yes) == QMessageBox.Yes){
PackageManager.PackageInfo pe = pm.findPackage(pi.name, nilptr);
while (pe != nilptr){
long v = Utils.getVersionValue(pe.version);
if (v < newVersion){
pm.deletePackage(pe);
}
pe = pm.findPackage(pi.name, pi.version);
}
}
if (QMessageBox.Information("提示", "将安装包 " + pi.name + " " + pi.version + "?" + "<br /><br />简介:<br /><b>" + pi.descr + "</b><br /><br />发布者:<a href=\"" + pi.author + "\">" + pi.author + "<em>", QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Ok) == QMessageBox.Ok){
if (pm.installPackage(pi)){
reloadList();
}else{
QMessageBox.Critical("提示", "安装包 " + pi.name + " " + pi.version + "失败!", QMessageBox.Ok, QMessageBox.Ok);
}
}
}else{
if (QMessageBox.Question("注意","将安装一个更低版的包,系统中已存在比此包更高版本的包,已经是否继续安装?",QMessageBox.Yes | QMessageBox.Cancel,QMessageBox.Yes) == QMessageBox.Cancel){
return;
}
if (QMessageBox.Information("提示", "将安装包 " + pi.name + " " + pi.version + "?" + "<br /><br />简介:<br /><b>" + pi.descr + "</b><br /><br />发布者:<a href=\"" + pi.author + "\">" + pi.author + "<em>", QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Ok) == QMessageBox.Ok){
if (pm.installPackage(pi)){
reloadList();
}else{
QMessageBox.Critical("提示", "安装包 " + pi.name + " " + pi.version + "失败!", QMessageBox.Ok, QMessageBox.Ok);
}
}
}
}
}
public void importToProject(){
if (XWorkspace.workspace.isCurrentProjectEmpty()){
QMessageBox.Critical("错误","当前工作区没有载入一个有效的项目",QMessageBox.Ok,QMessageBox.Ok);
return ;
}
ProgressView pv = ProgressView.showWait(-1);
if (pv != nilptr){
pv.setTitleText("正在导入...");
pv.EnableProgress(true , 0);
pv.centerScreen();
long []items = pcklist.getSelectedItems();
if (items != nilptr && items.length > 0){
PackageManager.PackageInfo [] pis = new PackageManager.PackageInfo[items.length];
for (int i = 0; i < items.length; i++){
int id = pcklist.getItemTag(items[i], 0);
pis[i] = pm.get(id);
}
btnAdd.setEnabled(false);
new Thread(){
void run()override{
for (int i = 0; i < pis.length; i++){
pv.setTitleText("正在导入 " + (i + 1) + "/" + pis.length);
PackageManager.PackageInfo pi = pis[i];
if (pi != nilptr){
XWndOutput.Output("\n导入 " + pi.name + " 版本:" + pi.version + " ....\n", 0);
Project cproj = XWorkspace.workspace.getCurrentProject();
if (cproj != nilptr){
cproj.importPkg(pi);
}
}else{
XWndOutput.Output("\n第 " + (i + 1) + " 是无效的包.\n", 0);
}
pv.EnableProgress(true, (double)i + 1 / (double)items.length);
}
pv.EnableProgress(true, 1.f);
pv.showResult(true, true);
pv.setTitleText("已导入");
pv.dismissAfter(2000);
XWndOutput.Output("\n已全部导入完毕\n", 0);
runOnUi(new Runnable(){
void run()override{
btnAdd.setEnabled(true);
XWorkspace.workspace.XIntelliSense();
}
});
}
}.start();
}
}
}
public void reloadList(){
loadList();
if (net_cache_pis != nilptr){
loadNetList(net_cache_pis);
}
}
public void loadList(){
pcklist.clear();
int c = pm.getCount();
for (int i =0; i < c; i++){
PackageManager.PackageInfo pi = pm.get(i);
if (pi != nilptr){
String icon = pi.iconFile;
if (icon == nilptr || icon.length() == 0){
icon = "res/package64.png";
}
long item = pcklist.addItem(icon, pi.name);
pcklist.modifyItemFlags(item, QTreeWidget.ItemIsUserCheckable, 0);
pcklist.setItemText(item, 1, pi.version);
pcklist.setItemText(item, 2, pi.descr);
pcklist.setItemText(item, 3, "已安装");
pcklist.setItemText(item, 4, pi.author);
pcklist.setItemTag(item, 0, i);
}
}
}
public void loadNetList(@NotNilptr PackageManager.PackageInfo [] pis){
int c = pis.length;
net_cache_pis = pis;
for (int i =0; i < c; i++){
PackageManager.PackageInfo pi = pis[i];
if (pi != nilptr){
if (nilptr != pm.findPackage(pi.name, pi.version)){
continue;
}
String icon = pi.iconFile;
if (icon == nilptr || icon.length() == 0){
icon = "res/package64.png";
}
long item = pcklist.addItem(icon, pi.name);
pcklist.setItemTag(item,3,i + 1);
pcklist.modifyItemFlags(item, QTreeWidget.ItemIsUserCheckable, 0);
pcklist.setItemText(item, 1, pi.version);
pcklist.setItemText(item, 2, pi.descr);
if (pi.detectCache()){
pcklist.setItemText(item, 3, String.format("已下载,待安装", pi.dlsize));
}else{
pcklist.setItemText(item, 3, String.format("未安装[大小:%d]", pi.dlsize));
}
pcklist.setItemText(item, 4, pi.author);
pcklist.setItemTag(item, 0, -1);
}
}
}
public bool onClose()override{
synchronized(prog_lock){
_viewer = nilptr;
}
if (loadingInProgress){
QMessageBox.Information("提示", "请稍候, 正在从远程仓库加载可用的包信息...", QMessageBox.Ok, QMessageBox.Ok);
return false;
}
return true;
}
public static bool Show(){
QDialog newDlg = new QDialog();
if (newDlg.load(UIManager.getUIData(__xPackageResource("ui/packagemgr.ui"))) == false){
return false;
}
PackageViewer viewer = new PackageViewer();
viewer.attach(newDlg);
viewer.setModal(true);
viewer.show();
return true;
}
public static bool Install(@NotNilptr String file){
QDialog newDlg = new QDialog();
if (newDlg.load(UIManager.getUIData(__xPackageResource("ui/packagemgr.ui"))) == false){
return false;
}
PackageViewer viewer = new PackageViewer();
viewer.attach(newDlg);
viewer.setModal(true);
viewer.show();
viewer.install(file);
return true;
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/ixlang/XStudio.git
[email protected]:ixlang/XStudio.git
ixlang
XStudio
XStudio
master

搜索帮助