-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
999ac3d
commit cba5ed5
Showing
39 changed files
with
2,713 additions
and
2 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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30711.63 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PDFCreator", "PDFCreator\PDFCreator.vcxproj", "{55B93590-F62C-405F-8F63-C36DFE36E80C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{55B93590-F62C-405F-8F63-C36DFE36E80C}.Debug|x64.ActiveCfg = Debug|x64 | ||
{55B93590-F62C-405F-8F63-C36DFE36E80C}.Debug|x64.Build.0 = Debug|x64 | ||
{55B93590-F62C-405F-8F63-C36DFE36E80C}.Release|x64.ActiveCfg = Release|x64 | ||
{55B93590-F62C-405F-8F63-C36DFE36E80C}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0CAC07F2-1A90-4D05-833C-B755E8003190} | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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,150 @@ | ||
#ifndef PDFCreator_H | ||
#define PDFCreator_H | ||
|
||
#define foreach | ||
|
||
#include<QtWidgets/QWidget> | ||
#include<QApplication> | ||
#include<QLabel> | ||
#include<QLineEdit> | ||
#include<QpushButton> | ||
#include<QGroupBox> | ||
#include<QBoxLayout> | ||
#include<QString> | ||
#include<QFileDialog> | ||
#include<QStandardPaths> | ||
#include<QDir> | ||
#include<QMessageBox> | ||
#include<QDesktopServices> | ||
#include<QCheckBox> | ||
#include<QButtonGroup> | ||
#include<QRadioButton> | ||
#include<QTextEdit> | ||
#include<QProgressBar> | ||
#include<QColor> | ||
#include<QStringList> | ||
#include<QAxObject> | ||
#include<QPrinter> | ||
#include<QFuture> | ||
#include<QtConcurrent> | ||
#include<QtGui/QPainter> | ||
#include<QMutex> | ||
#include<QtPrintSupport/QPrinter> | ||
|
||
//#include"PythonOffice.h" | ||
|
||
class PDFCreator : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
PDFCreator(QWidget *parent = Q_NULLPTR); | ||
~PDFCreator(); | ||
|
||
public: signals: void flushProgressBar(int value); | ||
public: signals: void sendOutput(QString tip, QString contain, int color); | ||
|
||
private: | ||
void InitGUI(); | ||
void InitObjects(); | ||
void connectSignalAndSlot(); | ||
QString confirmFoldName(QString path); | ||
int getLastPathSeparatorIndex(QString path); | ||
QString getFileName(QString path); | ||
QString getFatherPath(QString path); // 保留尾部分隔符 | ||
QString fixErrorPath(QString path); | ||
void runProcess(); // 实际处理文件 | ||
void recursionDealFile(QString sourcePath, QString destinationPath); | ||
int countTotalWorks(QString sourcePath); | ||
QString getRealName(QString name); | ||
|
||
// 转化核心函数 | ||
bool ppt_to_pdf(QString sourceFile, QString destinationFile); | ||
bool word_to_pdf(QString sourceFile, QString destinationFile); | ||
bool excel_to_pdf(QString sourceFile, QString destinationFile); | ||
bool picture_to_pdf(QString sourceFile, QString destinationFile); | ||
|
||
private slots: | ||
void selectSourceFlod(); // 选择源文件夹 | ||
void openSourceFold(); // 打开源文件夹 | ||
void selectDestinationFold(); | ||
void autoComputeDestinationFold(); | ||
void openDestinationFold(); // 打开源文件夹 | ||
bool ensureFoldExitst(QString path); | ||
void outputLine(QString tip, QString contain, int color=Qt::black); | ||
void startDealFiles(); | ||
void flushGUIProgressBar(int value); | ||
|
||
private: | ||
QFuture<void> thread; | ||
bool isRun = false; | ||
bool isPause = false; | ||
QMutex lock; | ||
int totalFilesCount; | ||
int dealFilesCount; | ||
|
||
private: | ||
QVBoxLayout* vBox = NULL; | ||
|
||
// 文件夹 | ||
QGroupBox* foldPathGroupBox = NULL; | ||
QVBoxLayout* foldPathVBoxLayout = NULL; | ||
// 选择源文件夹 | ||
QHBoxLayout* sourceHBoxLayout = NULL; | ||
QLabel* sourceTipLabel = NULL; | ||
QLineEdit* sourcePathLineEdit = NULL; | ||
QPushButton* sourceSelectFoldPushButton = NULL; | ||
QPushButton* sourceOpenPushButton = NULL; | ||
// 选择目标文件夹 | ||
QHBoxLayout* destinationHBoxLayout = NULL; | ||
QLabel* destinationTipLabel = NULL; | ||
QLineEdit* destinationPathLineEdit = NULL; | ||
QPushButton* destinationSelectFoldPushButton = NULL; | ||
QPushButton* destinationPathAutoComputePushButton = NULL; | ||
QPushButton* destinationOpenPushButton = NULL; | ||
|
||
// 文件类型 | ||
QGroupBox* fileTypeGroupBox = NULL; | ||
QHBoxLayout* fileTypeHBox = NULL; | ||
QCheckBox* pptCheckBox = NULL; | ||
QCheckBox* excelCheckBox = NULL; | ||
QCheckBox* wordCheckBox = NULL; | ||
QCheckBox* pictureCheckBox = NULL; | ||
|
||
// 输出设置 | ||
QHBoxLayout* outputSettingHBoxLayout = NULL; | ||
// 子文件 | ||
QGroupBox* subfoldersGroupBox = NULL; | ||
QVBoxLayout* subfoldersVBoxLayout = NULL; | ||
QButtonGroup* subfoldersButtonGroup = NULL; | ||
QRadioButton* enableSubfoldersRadioButton = NULL; | ||
QRadioButton* disableSubfoldersRadioButton = NULL; | ||
|
||
// 文件夹结构 | ||
QGroupBox* foldStructureGroupBox = NULL; | ||
QVBoxLayout* foldStructureVBoxLayout = NULL; | ||
QButtonGroup* foldStructureButtonGroup = NULL; | ||
QRadioButton* enableFoldStructureRadioButton = NULL; | ||
QRadioButton* disableFoldStructureRadioButton = NULL; | ||
|
||
// 拷贝无关文件 | ||
QGroupBox* ignoreGroupBox = NULL; | ||
QVBoxLayout* ignoreVBoxLayout = NULL; | ||
QButtonGroup* ignoreButtonGroup = NULL; | ||
QRadioButton* enableIgnoreRadioButton = NULL; | ||
QRadioButton* disableIgnoreRadioButton = NULL; | ||
|
||
// 程序输出 | ||
QGroupBox* outputGroupBox = NULL; | ||
QHBoxLayout* outputHBoxLayout = NULL; | ||
QTextEdit* outputTextEdit = NULL; | ||
|
||
// 程序控制 | ||
QHBoxLayout* runControlHBoxLayout = NULL; | ||
QProgressBar* runProgressBar = NULL; | ||
QLabel* runProgressTipLabel = NULL; | ||
QPushButton* runPushButton = NULL; | ||
|
||
}; | ||
|
||
#endif |
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,4 @@ | ||
<RCC> | ||
<qresource prefix="PDFCreator"> | ||
</qresource> | ||
</RCC> |
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 @@ | ||
<UI version="4.0" > | ||
<class>PDFCreatorClass</class> | ||
<widget class="QWidget" name="PDFCreatorClass" > | ||
<property name="objectName" > | ||
<string notr="true">PDFCreatorClass</string> | ||
</property> | ||
<property name="geometry" > | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>600</width> | ||
<height>400</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle" > | ||
<string>PDFCreator</string> | ||
</property>$centralwidget$ | ||
</widget> | ||
<layoutDefault spacing="6" margin="11" /> | ||
<pixmapfunction></pixmapfunction> | ||
<resources> | ||
<include location="PDFCreator.qrc"/> | ||
</resources> | ||
<connections/> | ||
</UI> |
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,133 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{55B93590-F62C-405F-8F63-C36DFE36E80C}</ProjectGuid> | ||
<Keyword>QtVS_v304</Keyword> | ||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0.18362.0</WindowsTargetPlatformVersion> | ||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0.18362.0</WindowsTargetPlatformVersion> | ||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CLRSupport>false</CLRSupport> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
<CLRSupport>false</CLRSupport> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> | ||
<Import Project="$(QtMsBuild)\qt_defaults.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings"> | ||
<QtInstall>msvc2017_64</QtInstall> | ||
<QtModules>axcontainer;concurrent;core;gui;printsupport;widgets</QtModules> | ||
<QtBuildConfig>debug</QtBuildConfig> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings"> | ||
<QtInstall>msvc2017_64</QtInstall> | ||
<QtModules>axcontainer;concurrent;core;gui;printsupport;widgets</QtModules> | ||
<QtBuildConfig>release</QtBuildConfig> | ||
</PropertyGroup> | ||
<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." /> | ||
</Target> | ||
<ImportGroup Label="ExtensionSettings" /> | ||
<ImportGroup Label="Shared" /> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="$(QtMsBuild)\Qt.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="$(QtMsBuild)\Qt.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<AdditionalOptions>/utf-8</AdditionalOptions> | ||
<AdditionalIncludeDirectories>C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalLibraryDirectories>C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<AdditionalDependencies>python37.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<AdditionalOptions>/utf-8</AdditionalOptions> | ||
<AdditionalIncludeDirectories>C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalLibraryDirectories>C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
<AdditionalDependencies>python37_d.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration"> | ||
<ClCompile> | ||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<Optimization>Disabled</Optimization> | ||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration"> | ||
<ClCompile> | ||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
<DebugInformationFormat>None</DebugInformationFormat> | ||
<Optimization>MaxSpeed</Optimization> | ||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="PythonOffice.cpp" /> | ||
<QtRcc Include="PDFCreator.qrc" /> | ||
<QtUic Include="PDFCreator.ui" /> | ||
<QtMoc Include="PDFCreator.h" /> | ||
<ClCompile Include="PDFCreator.cpp" /> | ||
<ClCompile Include="main.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="PythonOffice.h" /> | ||
<ClInclude Include="resource.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ResourceCompile Include="Resource.rc" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="cpp.hint" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')"> | ||
<Import Project="$(QtMsBuild)\qt.targets" /> | ||
</ImportGroup> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
Oops, something went wrong.