1
0
forked from BRT/arc

Refactor project naming and executable targets, enhance UI with no-devices label, tutorial handling, and app branding updates.

- Renamed project and executable from `ARCDesktopProject` to `ARC`, updating CMake files accordingly.
- Introduced dynamic no-devices label with scaling and visibility handling.
- Added tutorial display logic for first-time users with `SettingsDAO`.
- Updated application name, window title, and icon for improved branding.
- Removed unused endpoints from `config.ini`.
This commit is contained in:
slava 2026-03-24 14:03:39 +07:00
parent b42fb5eea9
commit 8f416b3303
8 changed files with 79 additions and 38 deletions

View File

@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(ARCDesktopProject LANGUAGES CXX) project(ARC LANGUAGES CXX)
#mkdir build #mkdir build
#cd build #cd build
#cmake .. -A x64 -DCMAKE_PREFIX_PATH="C:/Qt/6.9.0/msvc2022_64" -DCMAKE_BUILD_TYPE=Release #cmake .. -A x64 -DCMAKE_PREFIX_PATH="C:/Qt/6.9.0/msvc2022_64" -DCMAKE_BUILD_TYPE=Release
#cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="C:/Qt/6.9.0/msvc2022_64" -DCMAKE_BUILD_TYPE=Release #cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="C:/Qt/6.9.0/msvc2022_64" -DCMAKE_BUILD_TYPE=Release
#cmake --build . --config Release #cmake --build . --config Release
#"C:\Qt\6.9.0\msvc2022_64\bin\windeployqt.exe" .\Release\ARCDesktopProject.exe #"C:\Qt\6.9.0\msvc2022_64\bin\windeployqt.exe" .\Release\ARC.exe
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -83,8 +83,9 @@ file(GLOB_RECURSE ANDROID_SOURCES
) )
if (WIN32) if (WIN32)
add_executable(ARCDesktopProject WIN32 add_executable(ARC WIN32
main.cpp main.cpp
app.rc
${VIEW_SOURCES} ${VIEW_SOURCES}
${SERVICES_SOURCES} ${SERVICES_SOURCES}
${DB_SOURCES} ${DB_SOURCES}
@ -98,7 +99,7 @@ add_executable(ARCDesktopProject WIN32
database/dao/GeneralLogDAO.h database/dao/GeneralLogDAO.h
) )
elseif (APPLE) elseif (APPLE)
add_executable(ARCDesktopProject add_executable(ARC
main.cpp main.cpp
${VIEW_SOURCES} ${VIEW_SOURCES}
${SERVICES_SOURCES} ${SERVICES_SOURCES}
@ -115,7 +116,7 @@ elseif (APPLE)
endif () endif ()
if (WIN32) if (WIN32)
target_link_libraries(ARCDesktopProject target_link_libraries(ARC
Qt6::Widgets Qt6::Widgets
Qt6::Xml Qt6::Xml
Qt6::Sql Qt6::Sql
@ -132,37 +133,37 @@ if (WIN32)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/config.ini" DESTINATION "${CMAKE_BINARY_DIR}") file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/config.ini" DESTINATION "${CMAKE_BINARY_DIR}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tools/adb/windows" DESTINATION "${CMAKE_BINARY_DIR}/tools/adb") file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tools/adb/windows" DESTINATION "${CMAKE_BINARY_DIR}/tools/adb")
add_custom_command(TARGET ARCDesktopProject POST_BUILD add_custom_command(TARGET ARC POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:ARCDesktopProject>/database" "$<TARGET_FILE_DIR:ARC>/database"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/tutorials" "${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
"$<TARGET_FILE_DIR:ARCDesktopProject>/tutorials" "$<TARGET_FILE_DIR:ARC>/tutorials"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/images" "${CMAKE_CURRENT_SOURCE_DIR}/images"
"$<TARGET_FILE_DIR:ARCDesktopProject>/images" "$<TARGET_FILE_DIR:ARC>/images"
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/rus.traineddata" "${CMAKE_CURRENT_SOURCE_DIR}/rus.traineddata"
"$<TARGET_FILE_DIR:ARCDesktopProject>/rus.traineddata" "$<TARGET_FILE_DIR:ARC>/rus.traineddata"
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/eng.traineddata" "${CMAKE_CURRENT_SOURCE_DIR}/eng.traineddata"
"$<TARGET_FILE_DIR:ARCDesktopProject>/eng.traineddata" "$<TARGET_FILE_DIR:ARC>/eng.traineddata"
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/config.ini" "${CMAKE_CURRENT_SOURCE_DIR}/config.ini"
"$<TARGET_FILE_DIR:ARCDesktopProject>/config.ini" "$<TARGET_FILE_DIR:ARC>/config.ini"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_SOURCE_DIR}/tools/adb/windows" "${CMAKE_CURRENT_SOURCE_DIR}/tools/adb/windows"
"$<TARGET_FILE_DIR:ARCDesktopProject>/tools/adb/windows" "$<TARGET_FILE_DIR:ARC>/tools/adb/windows"
) )
elseif (APPLE) elseif (APPLE)
target_link_libraries(ARCDesktopProject target_link_libraries(ARC
Qt6::Widgets Qt6::Widgets
Qt6::Sql Qt6::Sql
Qt6::Xml Qt6::Xml
@ -172,7 +173,7 @@ elseif (APPLE)
) )
endif () endif ()
target_include_directories(ARCDesktopProject PRIVATE target_include_directories(ARC PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/views ${CMAKE_CURRENT_SOURCE_DIR}/views
${CMAKE_CURRENT_SOURCE_DIR}/database ${CMAKE_CURRENT_SOURCE_DIR}/database
${CMAKE_CURRENT_SOURCE_DIR}/services ${CMAKE_CURRENT_SOURCE_DIR}/services

BIN
arc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
arc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -9,11 +9,7 @@ version=0.0.1
dbPath=~/CLionProjects/ARCDeskProject/ARCDeskProject/database/app_data.db dbPath=~/CLionProjects/ARCDeskProject/ARCDeskProject/database/app_data.db
[net] [net]
accountUpdate=http://localhost:9999/api/v1/account/update
apiBase=http://93.183.75.134:8005 apiBase=http://93.183.75.134:8005
appInfoUpdate=http://localhost:9999/api/v1/device/update
appStatusUpdate=http://localhost:9999/api/v1/application/update
eventStatusUpdate=http://localhost:9999/api/v1/event/update
pathAuthLogin=/api/v1/auth/login pathAuthLogin=/api/v1/auth/login
pathAuthRefresh=/api/v1/auth/refresh_token pathAuthRefresh=/api/v1/auth/refresh_token
pathBankProfile=/api/v1/profile/bank_profile pathBankProfile=/api/v1/profile/bank_profile
@ -21,9 +17,6 @@ pathDesktopCreate=/api/v1/desktop/
pathDevice=/api/v1/device/ pathDevice=/api/v1/device/
pathDeviceScreenshot=/api/v1/device/add_screenshot/ pathDeviceScreenshot=/api/v1/device/add_screenshot/
pathMaterial=/api/v1/profile/material pathMaterial=/api/v1/profile/material
paymentsGet=http://localhost:9999/api/v1/payments
transactionInsert=http://localhost:9999/api/v1/transaction/insert
transactionUpdate=http://localhost:9999/api/v1/transaction/update
[black] [black]
android_package_name=app.blackwallet.ar android_package_name=app.blackwallet.ar

View File

@ -16,6 +16,7 @@
#include <thread> #include <thread>
#include <chrono> #include <chrono>
#include <QFile> #include <QFile>
#include <QIcon>
#include <QSettings> #include <QSettings>
#include "AppLogger.h" #include "AppLogger.h"
@ -221,6 +222,8 @@ void messageHandler(
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QApplication app(argc, argv); QApplication app(argc, argv);
app.setApplicationName("ARC");
app.setWindowIcon(QIcon("arc.png"));
// Выбрать стиль Fusion + принудительная светлая тема // Выбрать стиль Fusion + принудительная светлая тема
QApplication::setStyle(QStyleFactory::create("Fusion")); QApplication::setStyle(QStyleFactory::create("Fusion"));

BIN
no_devices.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -2,6 +2,8 @@
#include "bank/AccountWindow.h" #include "bank/AccountWindow.h"
#include <QLabel> #include <QLabel>
#include <QPixmap>
#include <QResizeEvent>
#include <QScrollArea> #include <QScrollArea>
#include <QMenuBar> #include <QMenuBar>
#include <QStackedWidget> #include <QStackedWidget>
@ -14,9 +16,13 @@
#include "db/DeviceInfo.h" #include "db/DeviceInfo.h"
#include "device/DeviceWidget.h" #include "device/DeviceWidget.h"
#include "dao/DeviceDAO.h" #include "dao/DeviceDAO.h"
#include "dao/SettingsDAO.h"
#include <QTimer>
#include "widget/common/FlowLayout.h" #include "widget/common/FlowLayout.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
setWindowTitle("ARC");
// Инициализируем таймер обновления // Инициализируем таймер обновления
timer = new QTimer(this); timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &MainWindow::loadDevices); connect(timer, &QTimer::timeout, this, &MainWindow::loadDevices);
@ -109,12 +115,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
m_fileLogWindow->activateWindow(); m_fileLogWindow->activateWindow();
}); });
// m_tutorialWindow = new TutorialWindow(this); if (SettingsDAO::get("tutorial_shown").isEmpty()) {
// m_tutorialWindow->show(); QTimer::singleShot(0, this, [this]() {
// QTimer::singleShot(0, m_tutorialWindow, [w = m_tutorialWindow]() { m_tutorialWindow = new TutorialWindow(this);
// w->raise(); m_tutorialWindow->show();
// w->activateWindow(); m_tutorialWindow->raise();
// }); m_tutorialWindow->activateWindow();
SettingsDAO::set("tutorial_shown", "1");
});
}
} }
@ -123,27 +132,46 @@ void MainWindow::createDevicePage() {
return; return;
} }
auto *scrollArea = new QScrollArea(this); auto *container = new QWidget(this);
auto *containerLayout = new QVBoxLayout(container);
containerLayout->setContentsMargins(0, 0, 0, 0);
m_noDevicesLabel = new QLabel(container);
m_noDevicesPixmap = QPixmap("no_devices.png");
m_noDevicesLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
m_noDevicesLabel->setAlignment(Qt::AlignCenter);
containerLayout->addWidget(m_noDevicesLabel);
m_scrollArea = new QScrollArea(container);
auto *contentWidget = new QWidget; auto *contentWidget = new QWidget;
flowLayout = new FlowLayout(contentWidget, 0, 0, 0); flowLayout = new FlowLayout(contentWidget, 0, 0, 0);
// flowLayout->setContentsMargins(0, 0, 0, 0);
// flowLayout->setSpacing(0);
QVector<DeviceInfo> devices = DeviceDAO::getAllDevices(false); QVector<DeviceInfo> devices = DeviceDAO::getAllDevices(false);
for (const auto &device: devices) { for (const auto &device: devices) {
auto *deviceWidget = new DeviceWidget(device); flowLayout->addWidget(new DeviceWidget(device));
// deviceWidget->setFixedSize(220, 400);
flowLayout->addWidget(deviceWidget);
} }
contentWidget->setLayout(flowLayout); contentWidget->setLayout(flowLayout);
scrollArea->setWidget(contentWidget); static_cast<QScrollArea*>(m_scrollArea)->setWidget(contentWidget);
scrollArea->setWidgetResizable(true); static_cast<QScrollArea*>(m_scrollArea)->setWidgetResizable(true);
containerLayout->addWidget(m_scrollArea);
m_devicesWindow = scrollArea; m_noDevicesLabel->setVisible(devices.isEmpty());
m_scrollArea->setVisible(!devices.isEmpty());
m_devicesWindow = container;
stackedWidget->addWidget(m_devicesWindow); stackedWidget->addWidget(m_devicesWindow);
timer->start(1000); timer->start(1000);
if (devices.isEmpty()) {
QTimer::singleShot(0, this, [this]() {
if (m_noDevicesLabel && !m_noDevicesPixmap.isNull()) {
m_noDevicesLabel->setPixmap(m_noDevicesPixmap.scaled(
m_noDevicesLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
});
}
} }
void MainWindow::deleteDevicePage() { void MainWindow::deleteDevicePage() {
@ -177,4 +205,15 @@ void MainWindow::loadDevices() {
for (const auto &device: devices) { for (const auto &device: devices) {
flowLayout->addWidget(new DeviceWidget(device)); flowLayout->addWidget(new DeviceWidget(device));
} }
m_noDevicesLabel->setVisible(devices.isEmpty());
m_scrollArea->setVisible(!devices.isEmpty());
}
void MainWindow::resizeEvent(QResizeEvent *event) {
QMainWindow::resizeEvent(event);
if (m_noDevicesLabel && m_noDevicesLabel->isVisible() && !m_noDevicesPixmap.isNull()) {
m_noDevicesLabel->setPixmap(m_noDevicesPixmap.scaled(
m_noDevicesLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
} }

View File

@ -3,6 +3,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QStackedWidget> #include <QStackedWidget>
#include <QTimer> #include <QTimer>
#include <QLabel>
#include <QPixmap>
#include "TutorialWindow.h" #include "TutorialWindow.h"
#include "bank/AccountWindow.h" #include "bank/AccountWindow.h"
@ -23,6 +25,9 @@ private:
QTimer *timer; QTimer *timer;
QStackedWidget *stackedWidget; QStackedWidget *stackedWidget;
QLabel *m_noDevicesLabel = nullptr;
QPixmap m_noDevicesPixmap;
QWidget *m_scrollArea = nullptr;
QWidget *m_devicesWindow = nullptr; QWidget *m_devicesWindow = nullptr;
QWidget *m_accountsWindow = nullptr; QWidget *m_accountsWindow = nullptr;
QWidget *m_tutorialWindow = nullptr; QWidget *m_tutorialWindow = nullptr;
@ -32,6 +37,6 @@ private:
QWidget *m_eventWindow = nullptr; QWidget *m_eventWindow = nullptr;
void createDevicePage(); void createDevicePage();
void deleteDevicePage(); void deleteDevicePage();
void resizeEvent(QResizeEvent *event) override;
}; };