-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f43afea
Showing
24 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "mainwindow.h" | ||
#include "ui_mainwindow.h" | ||
|
||
MainWindow::MainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::MainWindow) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void MainWindow::on_pushButton_clicked() | ||
{ | ||
ui->textEdit->append( "Hello World!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# C++ objects and libs | ||
*.slo | ||
*.lo | ||
*.o | ||
*.a | ||
*.la | ||
*.lai | ||
*.so | ||
*.dll | ||
*.deb | ||
*.dylib | ||
|
||
# Qt-es | ||
object_script.*.Release | ||
object_script.*.Debug | ||
*_plugin_import.cpp | ||
/.qmake.cache | ||
/.qmake.stash | ||
*.pro.user | ||
*.pro.user.* | ||
*.qbs.user | ||
*.qbs.user.* | ||
*.moc | ||
moc_*.cpp | ||
moc_*.h | ||
qrc_*.cpp | ||
ui_*.h | ||
*.qmlc | ||
*.jsc | ||
Makefile* | ||
*build-* | ||
|
||
# Qt unit tests | ||
target_wrapper.* | ||
|
||
# QtCreator | ||
*.autosave | ||
|
||
# QtCreator Qml | ||
*.qmlproject.user | ||
*.qmlproject.user.* | ||
|
||
# QtCreator CMake | ||
CMakeLists.txt.user* | ||
build | ||
target | ||
.flatpak-builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM tefworkshop/qt5-gui | ||
|
||
MAINTAINER cetc15 | ||
|
||
#RUN apt-get update && apt-get install -y apt-utils sudo | ||
USER root | ||
|
||
COPY . /home/HelloWorldGui | ||
RUN tar xvf /home/HelloWorldGui/lib.tar -C /usr | ||
WORKDIR /home/HelloWorldGui | ||
RUN qmake HelloWorldGui.pro; make | ||
RUN chmod +x /home/HelloWorldGui/HelloWorldGui; ls /home/HelloWorldGui/ | ||
|
||
CMD /home/HelloWorldGui/HelloWorldGui | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
QT += core gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = HelloWorldGui | ||
TEMPLATE = app | ||
|
||
|
||
SOURCES += main.cpp\ | ||
mainwindow.cpp | ||
|
||
HEADERS += mainwindow.h | ||
|
||
FORMS += mainwindow.ui | ||
## Added by IDE : mylib | ||
EXT_LIBS += -lmylib | ||
## Added by IDE : mylib-ext | ||
EXT_LIBS += -lmylibExt | ||
LIBS += $${EXT_LIBS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## GUI应用说明 | ||
|
||
1. 这是使用QTCreator创建的一个图形界面程序 | ||
|
||
2. 程序中通过qt-plugin插件,引入了两个commLib: mylib, mylibExt | ||
|
||
3. 你可以使用docker方式构成镜像,来运行 | ||
|
||
4. 生成镜像后可以使用如下的脚本,来运行图形化界面 | ||
``` | ||
# 在宿主机器执行下面的命令,安装x11配置 | ||
sudo apt-get install x11-xserver-utils | ||
xhost + | ||
# 然后运行docker镜像 | ||
docker run -d \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
-v /tmp/.X11-unix:/tmp/.X11-unix \ | ||
-d \ | ||
-e LANG=C.UTF-8 \ | ||
-e DISPLAY=unix$DISPLAY \ | ||
-e GDK_SCALE \ | ||
-e GDK_DPI_SCALE \ | ||
--name <命名容器名> \ | ||
<镜像名字> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cd /app/SRC | ||
# apt install free | ||
tar xvf lib.tar -C /usr | ||
qmake HelloWorldGui.pro | ||
make | ||
mkdir -p /app/bin/ | ||
ls HelloWorldGui | ||
cp HelloWorldGui /app/bin/runApp | ||
chmod +x /app/bin/runApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dpkg -b mylib mylib.deb | ||
dpkg -b mylib-ext mylib-ext.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Package: mylib-ext | ||
Version: 1.0 | ||
Architecture: amd64 | ||
Maintainer: Kevin Wang | ||
Installed-Size: 128 | ||
Recommends: | ||
Suggests: | ||
Section: devel | ||
Priority: optional | ||
Multi-Arch: foreign | ||
Depends: mylib | ||
Description: just for test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#包含了软件在进行正常目录文件拷贝到系统后,所需要执行的配置工作 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#软件卸载后需要执行的脚本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#软件卸载前需要执行的脚本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MYLIBEXT_H | ||
#define MYLIBEXT_H | ||
|
||
#include <string> | ||
|
||
using std::string; | ||
|
||
class MyLibExt | ||
{ | ||
public: | ||
MyLibExt(); | ||
string sayHello(const char* name); | ||
string sayHelloExt(const char* name); | ||
}; | ||
|
||
#endif // MYLIBEXT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Package: mylib | ||
Version: 1.0 | ||
Architecture: amd64 | ||
Maintainer: Kevin Wang | ||
Installed-Size: 128 | ||
Recommends: | ||
Suggests: | ||
Section: devel | ||
Priority: optional | ||
Multi-Arch: foreign | ||
Description: just for test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#包含了软件在进行正常目录文件拷贝到系统后,所需要执行的配置工作 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#软件卸载后需要执行的脚本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#软件卸载前需要执行的脚本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MYLIB_H | ||
#define MYLIB_H | ||
|
||
#include <string> | ||
|
||
using std::string; | ||
|
||
class MyLib | ||
{ | ||
|
||
public: | ||
string sayHello(const char* name); | ||
MyLib(); | ||
}; | ||
|
||
#endif // MYLIB_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
import os | ||
|
||
|
||
import subprocess | ||
def excuteCommand(com): | ||
ex = subprocess.Popen(com, stdout=subprocess.PIPE, shell=True) | ||
out, err = ex.communicate() | ||
status = ex.wait() | ||
#print("cmd in:", com) | ||
#print("cmd out: ", out.decode()) | ||
return out.decode() | ||
|
||
com = 'ls *.deb > pkg.txt' | ||
print("com = ", com) | ||
tmp = excuteCommand(com) | ||
|
||
|
||
f = open('pkg.txt') | ||
pkg = f.read() | ||
f.close() | ||
print("pkg = ", pkg) | ||
pkg = pkg.split('\n') | ||
print("len = ", len(pkg)) | ||
com = '' | ||
i=0 | ||
|
||
for i in range(len(pkg)): | ||
if (pkg[i] != ""): | ||
com = "curl -v -u admin:admin -X POST http://192.168.0.27:8081/service/rest/v1/components?repository=apt-hosted -F apt.asset=@"+(pkg[i]) | ||
print("com = ", com) | ||
tmp = excuteCommand(com) | ||
i= i+1 | ||
|
||
|
||
com = 'rm pkg.txt' | ||
print("com = ", com) | ||
tmp = excuteCommand(com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git clone [email protected]:bplatform/helloworld-gui.git /app/SRC |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "mainwindow.h" | ||
#include <QApplication> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
MainWindow w; | ||
w.show(); | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "mainwindow.h" | ||
#include "ui_mainwindow.h" | ||
|
||
#include <mylib.h> | ||
#include <mylibext.h> | ||
|
||
MainWindow::MainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::MainWindow) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void test(){ | ||
|
||
} | ||
|
||
void MainWindow::on_pushButton_clicked() | ||
{ | ||
ui->textEdit->append( "Hello World! "); | ||
ui->textEdit->append( tr("测试中文")); | ||
|
||
MyLib mylib; | ||
MyLibExt mylibExt; | ||
ui->textEdit->append( "mylib.sayHello "); | ||
ui->textEdit->append(QString::fromStdString(mylib.sayHello("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->append( "mylibExt.sayHello "); | ||
ui->textEdit->append(QString::fromStdString(mylibExt.sayHello("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->append( "mylibExt.sayHelloExt "); | ||
ui->textEdit->append(QString::fromStdString(mylibExt.sayHelloExt("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->repaint(); | ||
} | ||
|
||
void MainWindow::on_pbLib_clicked() | ||
{ | ||
MyLib mylib; | ||
MyLibExt mylibExt; | ||
ui->textEdit->append( "mylib.sayHello "); | ||
ui->textEdit->append(QString::fromStdString(mylib.sayHello("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->append( "mylibExt.sayHello "); | ||
ui->textEdit->append(QString::fromStdString(mylibExt.sayHello("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->append( "mylibExt.sayHelloExt "); | ||
ui->textEdit->append(QString::fromStdString(mylibExt.sayHelloExt("wiseking"))); | ||
ui->textEdit->append( tr("")); | ||
ui->textEdit->repaint(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
|
||
#include <QMainWindow> | ||
|
||
extern void test(); | ||
|
||
namespace Ui { | ||
class MainWindow; | ||
} | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = 0); | ||
~MainWindow(); | ||
void test(); | ||
|
||
private slots: | ||
void on_pushButton_clicked(); | ||
void on_pbLib_clicked(); | ||
|
||
private: | ||
Ui::MainWindow *ui; | ||
}; | ||
|
||
#endif // MAINWINDOW_H |
Oops, something went wrong.