This commit is contained in:
2022-10-24 20:41:50 +03:00
commit 1245541a3b
9 changed files with 152 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
/build*
/bin
/release
CMakeLists.txt.user*
*.7z
.vscode
/logs

17
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,17 @@
pipeline {
agent none
stages {
stage('Windows x64') {
agent { docker { image 'windows-shstk' } }
steps {
sh 'mkdir -p build/windows'
sh "cd build/windows && rm -rf ./* && cmake -DCMAKE_TOOLCHAIN_FILE=/soft/toolchain-Windows.cmake -DBUILD_NUMBER=${env.BUILD_NUMBER} ../../src"
sh 'cd build/windows && make -j4'
sh 'cd build/windows && make install -j4'
sh 'cd build/windows && make deploy'
archiveArtifacts 'release/*.zip'
sh 'rm -rf ./build ./bin ./release'
}
}
}
}

34
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.12)
project(strata_test)
cmake_policy(SET CMP0020 NEW)
find_package(QAD REQUIRED)
qad_find_qt(Qt5 Core Gui Widgets OpenGL)
set(INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set(TARGET_SUFFIX_Qt5 "")
if(NOT DEFINED BUILD_NUMBER)
set(BUILD_NUMBER 9999)
endif()
set_version(${PROJECT_NAME}
MAJOR 0
MINOR 1
REVISION 0
BUILD ${BUILD_NUMBER})
set_deploy_property(${PROJECT_NAME}
LABEL "${PROJECT_NAME}"
FULLNAME "${PROJECT_NAME}"
COMPANY "Strata Solutions")
set_lang(${PROJECT_NAME} "ru")
make_rc(${PROJECT_NAME} out_RC)
qad_sources(SRC)
qad_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
qad_add_executable(${PROJECT_NAME} out_CPP ${out_RC} ${MSSDCPP} ${MSSDH})
qad_target_link_libraries(${PROJECT_NAME} QAD::Graphic)
qad_install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_DIR}/bin)
qad_install(LANG out_QM DESTINATION ${INSTALL_DIR}/bin/lang)
qad_install_lang(${PROJECT_NAME} DESTINATION ${INSTALL_DIR}/bin/lang)
deploy_target(${PROJECT_NAME}
DEPLOY_DIR ${INSTALL_DIR}/bin
DESTINATION ${INSTALL_DIR}/release
RESOURCES lang/
)

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
</TS>

1
src/lang/update.bat Normal file
View File

@@ -0,0 +1 @@
lupdate ../ -ts stata_test_ru.ts

29
src/main.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <QApplication>
#include <QDir>
#include <QTranslator>
#include <qad_locations.h>
#include <qad_types.h>
#include "mainwindow.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QAD_SETUP_APPLICATION
a.setWindowIcon(QIcon(":/icons/logo.ico"));
#if QT_VERSION >= 0x050000
a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
QStringList trs = QDir(a.applicationDirPath() + "/lang").entryList(QDir::Files);
for(const QString & i : trs) {
QTranslator * tr = new QTranslator();
if (tr->load("lang/" + i)) {
a.installTranslator(tr);
} else {
qDebug() << "Can`t load translation" << i;
delete tr;
}
}
MainWindow w;
w.show();
return a.exec();
}

14
src/mainwindow.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}

22
src/mainwindow.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

24
src/mainwindow.ui Normal file
View File

@@ -0,0 +1,24 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>MainWindow</class>
<widget name="MainWindow" class="QMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget name="menubar" class="QMenuBar"/>
<widget name="centralwidget" class="QWidget"/>
<widget name="statusbar" class="QStatusBar"/>
</widget>
<pixmapfunction/>
<connections/>
</ui>