web assemble testing

This commit is contained in:
shouchih_chen 陳守志 2023-03-31 14:40:23 +08:00
parent d9d110ce04
commit 24639c50b0
10 changed files with 480 additions and 421 deletions

13
.gitignore vendored
View File

@ -1,6 +1,7 @@
*Debug/ *Debug/
*Release/ *Release/
/.vs/ /.vs/
/*.opendb /*.opendb
/*.db /*.db
/_bin /_bin
/web_build

View File

@ -1,12 +1,27 @@
#include "NameCreater.h" #include "NameCreater.h"
#include <QDebug> #include <QDebug>
#include <QFileDialog>
NameCreater::NameCreater(QWidget *parent)
: QMainWindow(parent)
{ NameCreater::NameCreater(QWidget *parent)
ui.setupUi(this); : QMainWindow(parent)
{
ui.setupUi(this);
qDebug() << ui.label->font().family(); connect(ui.openfile_btn, &QPushButton::released, this, &NameCreater::OnClickedReadBtn);
} qDebug() << ui.label->font().family();
}
void NameCreater::OnClickedReadBtn() {
auto fileContentReady = [](const QString &fileName, const QByteArray &fileContent) {
if (fileName.isEmpty()) {
// No file was selected
}
else {
// Use fileName and fileContent
//processCSV(fileName, font, font_color);
}
};
QFileDialog::getOpenFileContent("CSV (*.csv)", fileContentReady);
}

View File

@ -1,15 +1,18 @@
#pragma once #pragma once
#include <QtWidgets/QMainWindow> #include <QtWidgets/QMainWindow>
#include "ui_NameCreater.h" #include "ui_NameCreater.h"
class NameCreater : public QMainWindow class NameCreater : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
NameCreater(QWidget *parent = Q_NULLPTR); NameCreater(QWidget *parent = Q_NULLPTR);
private: private:
Ui::NameCreaterClass ui; Ui::NameCreaterClass ui;
};
private Q_SLOTS:
void OnClickedReadBtn();
};

View File

@ -1,14 +1,14 @@
# ---------------------------------------------------- # ----------------------------------------------------
# This file is generated by the Qt Visual Studio Tools. # This file is generated by the Qt Visual Studio Tools.
# ------------------------------------------------------ # ------------------------------------------------------
# This is a reminder that you are using a generated .pro file. # This is a reminder that you are using a generated .pro file.
# Remove it when you are finished editing this file. # Remove it when you are finished editing this file.
message("You are running qmake on a generated .pro file. This may not work!") message("You are running qmake on a generated .pro file. This may not work!")
HEADERS += ./NameCreater.h HEADERS += ./NameCreater.h
SOURCES += ./NameCreater.cpp \ SOURCES += ./NameCreater.cpp \
./main.cpp ./main.cpp
FORMS += ./NameCreater.ui FORMS += ./NameCreater.ui
RESOURCES += ./NameCreater.qrc RESOURCES += NameCreater.qrc

View File

@ -1,21 +1,21 @@
QT += core gui QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11 resources_big
# You can make your code fail to compile if it uses deprecated APIs. # You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
include(NameCreater.pri) include(NameCreater.pri)
# Default rules for deployment. # Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target

View File

@ -1,31 +1,32 @@
<RCC> <RCC>
<qresource prefix="/NameCreater"> <qresource prefix="/NameCreater">
<file>resource/background_sample.jpg</file> <file>_exp/DFYuanStd-W8.otf</file>
<file>resource/background_b.jpg</file> <file>resource/background_sample.jpg</file>
<file>resource/background_g.jpg</file> <file>resource/background_b.jpg</file>
<file>resource/background_r.jpg</file> <file>resource/background_g.jpg</file>
<file>resource/background_y.jpg</file> <file>resource/background_r.jpg</file>
<file>resource/two_word_sample.jpg</file> <file>resource/background_y.jpg</file>
<file>resource/background_1.jpg</file> <file>resource/two_word_sample.jpg</file>
<file>resource/background_2.jpg</file> <file>resource/background_1.jpg</file>
<file>resource/background_3.jpg</file> <file>resource/background_2.jpg</file>
<file>resource/background_4.jpg</file> <file>resource/background_3.jpg</file>
<file>resource/background_5.jpg</file> <file>resource/background_4.jpg</file>
<file>resource/background_6.jpg</file> <file>resource/background_5.jpg</file>
<file>resource/background_7.jpg</file> <file>resource/background_6.jpg</file>
<file>resource/background_8.jpg</file> <file>resource/background_7.jpg</file>
<file>resource/background_9.jpg</file> <file>resource/background_8.jpg</file>
<file>resource/background_10.jpg</file> <file>resource/background_9.jpg</file>
<file>resource/background_number_smaple.jpg</file> <file>resource/background_10.jpg</file>
<file>resource/background_11.jpg</file> <file>resource/background_number_smaple.jpg</file>
<file>resource/background_12.jpg</file> <file>resource/background_11.jpg</file>
<file>resource/background_13.jpg</file> <file>resource/background_12.jpg</file>
<file>resource/background_14.jpg</file> <file>resource/background_13.jpg</file>
<file>resource/background_15.jpg</file> <file>resource/background_14.jpg</file>
<file>resource/background_16.jpg</file> <file>resource/background_15.jpg</file>
<file>resource/background_17.jpg</file> <file>resource/background_16.jpg</file>
<file>resource/background_18.jpg</file> <file>resource/background_17.jpg</file>
<file>resource/background_19.jpg</file> <file>resource/background_18.jpg</file>
<file>resource/background_20.jpg</file> <file>resource/background_19.jpg</file>
</qresource> <file>resource/background_20.jpg</file>
</qresource>
</RCC> </RCC>

View File

@ -1,65 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>NameCreaterClass</class> <class>NameCreaterClass</class>
<widget class="QMainWindow" name="NameCreaterClass"> <widget class="QMainWindow" name="NameCreaterClass">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>977</width> <width>977</width>
<height>716</height> <height>716</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
<font/> <font/>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>NameCreater</string> <string>NameCreater</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <property name="styleSheet">
<widget class="QLabel" name="label"> <string notr="true">color: rgb(0, 0, 0);</string>
<property name="geometry"> </property>
<rect> <widget class="QWidget" name="centralWidget">
<x>240</x> <property name="styleSheet">
<y>220</y> <string notr="true">QWidget#centralWidget{
<width>441</width> background-color: rgb(0, 0, 0);
<height>261</height> }</string>
</rect> </property>
</property> <widget class="QLabel" name="label">
<property name="styleSheet"> <property name="geometry">
<string notr="true">font: 26pt &quot;華康圓體 Std W8&quot;;</string> <rect>
</property> <x>470</x>
<property name="text"> <y>40</y>
<string/> <width>441</width>
</property> <height>261</height>
<property name="pixmap"> </rect>
<pixmap resource="NameCreater.qrc">:/NameCreater/resource/background.jpg</pixmap> </property>
</property> <property name="styleSheet">
</widget> <string notr="true">font: 26pt &quot;華康圓體 Std W8&quot;;</string>
</widget> </property>
<widget class="QMenuBar" name="menuBar"> <property name="text">
<property name="geometry"> <string/>
<rect> </property>
<x>0</x> <property name="pixmap">
<y>0</y> <pixmap>:/NameCreater/resource/background.jpg</pixmap>
<width>977</width> </property>
<height>22</height> </widget>
</rect> <widget class="QPushButton" name="openfile_btn">
</property> <property name="geometry">
</widget> <rect>
<widget class="QToolBar" name="mainToolBar"> <x>150</x>
<attribute name="toolBarArea"> <y>470</y>
<enum>TopToolBarArea</enum> <width>181</width>
</attribute> <height>61</height>
<attribute name="toolBarBreak"> </rect>
<bool>false</bool> </property>
</attribute> <property name="text">
</widget> <string>Open File</string>
<widget class="QStatusBar" name="statusBar"/> </property>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> </widget>
<resources> <widget class="QMenuBar" name="menuBar">
<include location="NameCreater.qrc"/> <property name="geometry">
</resources> <rect>
<connections/> <x>0</x>
</ui> <y>0</y>
<width>977</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen_File"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionOpen_File">
<property name="text">
<string>Open File</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="NameCreater.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,187 +1,190 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{B66B108B-6DA8-408D-936D-988FF8B6B722}</ProjectGuid> <ProjectGuid>{B66B108B-6DA8-408D-936D-988FF8B6B722}</ProjectGuid>
<Keyword>QtVS_v304</Keyword> <Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Release|x64'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)'=='Release|x64'">10.0.19041.0</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> <QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
<Import Project="$(QtMsBuild)\qt_defaults.props" /> <Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
<QtInstall>$(DefaultQtVersion)</QtInstall> <QtInstall>5.8_msvc2015</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtInstall>$(DefaultQtVersion)</QtInstall> <QtInstall>$(DefaultQtVersion)</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
<QtInstall>$(DefaultQtVersion)</QtInstall> <QtInstall>$(DefaultQtVersion)</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>release</QtBuildConfig> <QtBuildConfig>release</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtInstall>$(DefaultQtVersion)</QtInstall> <QtInstall>$(DefaultQtVersion)</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets</QtModules>
<QtBuildConfig>release</QtBuildConfig> <QtBuildConfig>release</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target> </Target>
<ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" /> <ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" /> <Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" /> <Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" /> <Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(QtMsBuild)\Qt.props" /> <Import Project="$(QtMsBuild)\Qt.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
<OutDir>$(SolutionDir)_bin\</OutDir> <OutDir>$(SolutionDir)_bin\</OutDir>
<IntDir>$(Configuration)\</IntDir> <IntDir>$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
<OutDir>$(SolutionDir)_bin\</OutDir> <OutDir>$(SolutionDir)_bin\</OutDir>
<IntDir>$(Configuration)\</IntDir> <IntDir>$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command> <Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command>
</PreBuildEvent> </PreBuildEvent>
</ItemDefinitionGroup> <ClCompile>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <AdditionalOptions>/Zm1000</AdditionalOptions>
<PreBuildEvent> </ClCompile>
<Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command> </ItemDefinitionGroup>
</PreBuildEvent> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ItemDefinitionGroup> <PreBuildEvent>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command>
<PreBuildEvent> </PreBuildEvent>
<Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command> </ItemDefinitionGroup>
</PreBuildEvent> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ItemDefinitionGroup> <PreBuildEvent>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command>
<PreBuildEvent> </PreBuildEvent>
<Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command> </ItemDefinitionGroup>
</PreBuildEvent> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ItemDefinitionGroup> <PreBuildEvent>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <Command>xcopy /y "$(ProjectDir)_exp\*" "$(TargetDir)"</Command>
<ClCompile> </PreBuildEvent>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> </ItemDefinitionGroup>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <ClCompile>
<Optimization>Disabled</Optimization> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Link> <Optimization>Disabled</Optimization>
<SubSystem>Windows</SubSystem> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation> </ClCompile>
</Link> <Link>
</ItemDefinitionGroup> <SubSystem>Windows</SubSystem>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <GenerateDebugInformation>true</GenerateDebugInformation>
<ClCompile> </Link>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> </ItemDefinitionGroup>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <ClCompile>
<Optimization>Disabled</Optimization> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Link> <Optimization>Disabled</Optimization>
<SubSystem>Windows</SubSystem> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation> </ClCompile>
</Link> <Link>
</ItemDefinitionGroup> <SubSystem>Windows</SubSystem>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <GenerateDebugInformation>true</GenerateDebugInformation>
<ClCompile> </Link>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> </ItemDefinitionGroup>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
<DebugInformationFormat>None</DebugInformationFormat> <ClCompile>
<Optimization>MaxSpeed</Optimization> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> <DebugInformationFormat>None</DebugInformationFormat>
<Link> <Optimization>MaxSpeed</Optimization>
<SubSystem>Windows</SubSystem> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<GenerateDebugInformation>false</GenerateDebugInformation> </ClCompile>
</Link> <Link>
</ItemDefinitionGroup> <SubSystem>Windows</SubSystem>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <GenerateDebugInformation>false</GenerateDebugInformation>
<ClCompile> </Link>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> </ItemDefinitionGroup>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<DebugInformationFormat>None</DebugInformationFormat> <ClCompile>
<Optimization>MaxSpeed</Optimization> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> <DebugInformationFormat>None</DebugInformationFormat>
<Link> <Optimization>MaxSpeed</Optimization>
<SubSystem>Windows</SubSystem> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<GenerateDebugInformation>false</GenerateDebugInformation> </ClCompile>
</Link> <Link>
</ItemDefinitionGroup> <SubSystem>Windows</SubSystem>
<ItemGroup> <GenerateDebugInformation>false</GenerateDebugInformation>
<QtRcc Include="NameCreater.qrc" /> </Link>
<QtUic Include="NameCreater.ui" /> </ItemDefinitionGroup>
<QtMoc Include="NameCreater.h" /> <ItemGroup>
<ClCompile Include="NameCreater.cpp" /> <QtRcc Include="NameCreater.qrc" />
<ClCompile Include="main.cpp" /> <QtUic Include="NameCreater.ui" />
</ItemGroup> <QtMoc Include="NameCreater.h" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ClCompile Include="NameCreater.cpp" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')"> <ClCompile Include="main.cpp" />
<Import Project="$(QtMsBuild)\qt.targets" /> </ItemGroup>
</ImportGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
</ImportGroup> <Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project> </Project>

View File

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2022-02-09T21:34:52.5655210Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-02-07T09:42:35.8095077Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-02-09T21:34:52.5655210Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2022-02-09T21:34:52.5655210Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2022-02-09T21:34:53.9897137Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2022-02-09T21:34:53.9897137Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="QtSettings">
<QtLastBackgroundBuild>2022-02-09T21:34:53.9897137Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2022-02-09T21:34:53.9897137Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -13,10 +13,12 @@
#include <QFontDatabase> #include <QFontDatabase>
//#define BG_SAMPLE_PATH ":/NameCreater/resource/background_sample.jpg" //#define BG_SAMPLE_PATH ":/NameCreater/resource/background_sample.jpg"
#define BG_SAMPLE_PATH ":/NameCreater/resource/background_number_smaple.jpg" #define BG_SAMPLE_PATH ":/NameCreater/resource/background_number_smaple.jpg"
#define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg" #define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg"
#define FONT_NAME "DFYuanStd-W8.otf" #define FONT_NAME "DFYuanStd-W8.otf"
#define FONT_PATH ":/NameCreater/_exp/DFYuanStd-W8.otf"
#define FONT_SIZE 120 #define FONT_SIZE 120
//#define FONT_SIZE 74 //#define FONT_SIZE 74
@ -112,7 +114,7 @@ QList<NameInfo_t> getNameByFile(const QString& filename) {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QString root_path = QCoreApplication::applicationDirPath() + "/../../../"; QString root_path = QCoreApplication::applicationDirPath() + "/../../../";
#else #else
QString root_path = QCoreApplication::applicationDirPath() + "/"; QString root_path = "";//QCoreApplication::applicationDirPath() + "/";
#endif #endif
@ -161,38 +163,10 @@ QList<NameInfo_t> getNameByFile(const QString& filename) {
return nameList; return nameList;
} }
int main(int argc, char* argv[])
{ void processCSV(const QString& filename, const QFont& font, const QColor& font_color) {
int export_times = 0; int export_times = 0;
QList<NameInfo_t> nameList = getNameByFile(filename);
QApplication a(argc, argv);
// NameCreater w;
// w.show();
#ifdef Q_OS_MAC
QString root_path = QCoreApplication::applicationDirPath() + "/../../../";
#else
QString root_path = QCoreApplication::applicationDirPath() + "/";
#endif
QString font_path = root_path.append(FONT_NAME);
QFile font_res(font_path);
if (!font_res.open(QIODevice::ReadOnly)) {
QMessageBox msgBox;
msgBox.setText("Can not load font file!" + font_path);
msgBox.exec();
font_res.close();
return 0;
}
int id = QFontDatabase::addApplicationFontFromData(font_res.readAll());
QStringList family_list = QFontDatabase::applicationFontFamilies(id);
QFont font = QFont(family_list.at(0));
font.setPixelSize(FONT_SIZE);
QColor font_color(0, 0, 0);
QList<NameInfo_t> nameList = getNameByFile("name.csv");
if (nameList.isEmpty()) { if (nameList.isEmpty()) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(("Name is empty !")); msgBox.setText(("Name is empty !"));
@ -214,7 +188,7 @@ int main(int argc, char* argv[])
int idx = n % BG_POS_COUNT; int idx = n % BG_POS_COUNT;
NameInfo_t name_info = nameList.at(n); NameInfo_t name_info = nameList.at(n);
QImage name_image(name_info.bg_path); QImage name_image(name_info.bg_path);
if (idx == 0) { if (idx == 0) {
QGraphicsRectItem* bg_item = new QGraphicsRectItem(0, 0, 3508, 2482); QGraphicsRectItem* bg_item = new QGraphicsRectItem(0, 0, 3508, 2482);
bg_item->setBrush(QBrush(QColor(255, 255, 255))); bg_item->setBrush(QBrush(QColor(255, 255, 255)));
scene.addItem(bg_item); scene.addItem(bg_item);
@ -241,7 +215,7 @@ int main(int argc, char* argv[])
xscale = yscale = (j == 1) ? -1 : 1; xscale = yscale = (j == 1) ? -1 : 1;
QPointF pos = name_info.is_number_bg ? NAME_POS_NUMBER[pos_idx] : NAME_POS[pos_idx]; QPointF pos = name_info.is_number_bg ? NAME_POS_NUMBER[pos_idx] : NAME_POS[pos_idx];
int y_offset[2] = {0}; int y_offset[2] = { 0 };
if (name_len == 2) { if (name_len == 2) {
if (!rot) { if (!rot) {
pos.setY(pos.y() + 82 * xscale); pos.setY(pos.y() + 82 * xscale);
@ -250,7 +224,7 @@ int main(int argc, char* argv[])
pos.setX(pos.x() + 82 * xscale); pos.setX(pos.x() + 82 * xscale);
} }
y_offset[0] = 25; y_offset[0] = 25;
} }
@ -302,15 +276,15 @@ int main(int argc, char* argv[])
scene.addItem(textItem3); scene.addItem(textItem3);
} }
} }
bool is_export_page = ((idx + 1) % BG_POS_COUNT == 0); bool is_export_page = ((idx + 1) % BG_POS_COUNT == 0);
if (is_export_page || n == nameList.count()-1) { if (is_export_page || n == nameList.count() - 1) {
QString file_name = QString("%1_.jpg").arg(QString::number(export_times + 1)); QString file_name = QString("%1_.jpg").arg(QString::number(export_times + 1));
saveToImage(file_name, &scene); saveToImage(file_name, &scene);
export_times++; export_times++;
scene.clear(); scene.clear();
} }
} }
@ -320,9 +294,38 @@ int main(int argc, char* argv[])
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(QString().asprintf("Export Finshed. Count:%d", export_times)); msgBox.setText(QString().asprintf("Export Finshed. Count:%d", export_times));
msgBox.exec(); msgBox.exec();
}
int main(int argc, char* argv[])
font_res.close(); {
return 0;
QApplication a(argc, argv);
NameCreater w;
w.show();
#ifdef Q_OS_MAC
QString root_path = QCoreApplication::applicationDirPath() + "/../../../";
#else
//QString root_path = FONT_PATH;//QCoreApplication::applicationDirPath() + "/";
#endif
QString font_path = FONT_PATH; //root_path.append(FONT_NAME);
QFile font_res(font_path);
if (!font_res.open(QIODevice::ReadOnly)) {
QMessageBox msgBox;
msgBox.setText("Can not load font file!" + font_path);
msgBox.exec();
font_res.close();
return 0;
}
int id = QFontDatabase::addApplicationFontFromData(font_res.readAll());
QStringList family_list = QFontDatabase::applicationFontFamilies(id);
QFont font = QFont(family_list.at(0));
font.setPixelSize(FONT_SIZE);
QColor font_color(0, 0, 0);
//font_res.close();
return a.exec();
} }