From 50168f49908ad3e5d2f1693d219f230b7eabaf85 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 21 Feb 2019 13:54:02 +0300 Subject: [PATCH] =?UTF-8?q?main=20=D0=B2=20=D1=84=D0=B0=D0=B9=D0=BB=20main?= =?UTF-8?q?=5Fapp.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/cmlib | 2 +- cmake/find | 2 +- l10n/cmex_app_ru_RU.ts | 41 ++--------------------------------------- src/cmex/CMakeLists.txt | 1 + src/cmex/main.cpp | 30 +++--------------------------- src/cmex/main_app.cpp | 30 ++++++++++++++++++++++++++++++ src/cmex/main_app.hpp | 7 +++++++ 7 files changed, 45 insertions(+), 68 deletions(-) create mode 100644 src/cmex/main_app.cpp create mode 100644 src/cmex/main_app.hpp diff --git a/cmake/cmlib b/cmake/cmlib index e7b0f44..428dc84 160000 --- a/cmake/cmlib +++ b/cmake/cmlib @@ -1 +1 @@ -Subproject commit e7b0f44ef9cf7a10dc044a3f809de5708769df06 +Subproject commit 428dc84cfd3eda09bf615539f5f2b84e71bb5cb2 diff --git a/cmake/find b/cmake/find index 275d3f0..a0a786f 160000 --- a/cmake/find +++ b/cmake/find @@ -1 +1 @@ -Subproject commit 275d3f01ce0f1d6c7255ccb890412e6efd501e57 +Subproject commit a0a786f59030e6074dd85229df0506734f08e849 diff --git a/l10n/cmex_app_ru_RU.ts b/l10n/cmex_app_ru_RU.ts index df3b2cd..a04bf62 100644 --- a/l10n/cmex_app_ru_RU.ts +++ b/l10n/cmex_app_ru_RU.ts @@ -1,40 +1,3 @@ - - - - MyMainWindow - - - Main Window - Главное окно - - - - QObject - - - Compiler version: - Версия компилятора: - - - - Project version: - Версия проекта: - - - - Build type: - Тип сборки: - - - - libcmex function call: - Вызов функции из libcmex: - - - - libcmext function call: - Вызов функции из libcmext: - - - + + \ No newline at end of file diff --git a/src/cmex/CMakeLists.txt b/src/cmex/CMakeLists.txt index 5d24776..cf18f7c 100644 --- a/src/cmex/CMakeLists.txt +++ b/src/cmex/CMakeLists.txt @@ -4,6 +4,7 @@ set(current_target cmex_app) # Список файлов исходных текстов set(current_target_sources main.cpp + main_app.cpp my_main_window.cpp ) diff --git a/src/cmex/main.cpp b/src/cmex/main.cpp index 03a893d..9890c24 100644 --- a/src/cmex/main.cpp +++ b/src/cmex/main.cpp @@ -1,30 +1,6 @@ -#include "compiler_features.hpp" -#include "config.hpp" +#include "main_app.hpp" -#include -#include -#include -#include - -#include "cmex.hpp" -#include "my_main_window.hpp" - -int main(int argc, char **argv) { - QApplication app(argc, argv); - QTranslator translator; - - if (translator.load(QLocale(), "cmex_app", QLatin1String("_"), QLatin1String(":/qm"))) - { - app.installTranslator(&translator); - } - std::cout << QObject::tr("Compiler version: ").toStdString() << CMEX_COMPILER_VERSION_MAJOR << std::endl; // Значение из compiler_features.hpp - std::cout << QObject::tr("Project version: ").toStdString() << CMEX_VERSION_STR << std::endl; // Значение из config.hpp - std::cout << QObject::tr("Build type: ").toStdString() << BUILD_TYPE << std::endl; // Значение из config.hpp - std::cout << QObject::tr("libcmex function call: ").toStdString() << cmex_init(4) << std::endl; // Функция из внутренней библиотеки - std::cout << QObject::tr("libcmext function call: ").toStdString() << cmext_init(9) << std::endl; // Функция из внешней библиотеки - - MyMainWindow* mmw = new MyMainWindow(); - mmw->show(); - return app.exec(); +int main(int argc, char *argv[]) { + return main_app(argc, argv); } diff --git a/src/cmex/main_app.cpp b/src/cmex/main_app.cpp new file mode 100644 index 0000000..c9208cb --- /dev/null +++ b/src/cmex/main_app.cpp @@ -0,0 +1,30 @@ +#include "compiler_features.hpp" +#include "config.hpp" + +#include +#include +#include +#include + +#include "cmex.hpp" +#include "my_main_window.hpp" + +int main_app(int argc, char *argv[]) { + QApplication app(argc, argv); + QTranslator translator; + + if (translator.load(QLocale(), "cmex_app", QLatin1String("_"), QLatin1String(":/qm"))) + { + app.installTranslator(&translator); + } + std::cout << QObject::tr("Compiler version: ").toStdString() << CMEX_COMPILER_VERSION_MAJOR << std::endl; // Значение из compiler_features.hpp + std::cout << QObject::tr("Project version: ").toStdString() << CMEX_VERSION_STR << std::endl; // Значение из config.hpp + std::cout << QObject::tr("Build type: ").toStdString() << BUILD_TYPE << std::endl; // Значение из config.hpp + std::cout << QObject::tr("libcmex function call: ").toStdString() << cmex_init(4) << std::endl; // Функция из внутренней библиотеки + std::cout << QObject::tr("libcmext function call: ").toStdString() << cmext_init(9) << std::endl; // Функция из внешней библиотеки + + MyMainWindow* mmw = new MyMainWindow(); + mmw->show(); + return app.exec(); +} + diff --git a/src/cmex/main_app.hpp b/src/cmex/main_app.hpp new file mode 100644 index 0000000..af8146b --- /dev/null +++ b/src/cmex/main_app.hpp @@ -0,0 +1,7 @@ +#ifndef CMEX_MAIN_APP_HPP_ +#define CMEX_MAIN_APP_HPP_ + +int main_app(int argc, char *argv[]); + +#endif /* CMEX_MAIN_APP_HPP_ */ +