Skip to content

Commit

Permalink
Moved MyCurl to a separate repistory.
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostWriterTNCS committed Apr 1, 2017
1 parent a27f01a commit f356ad9
Show file tree
Hide file tree
Showing 26 changed files with 422 additions and 4,854 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "StoryToEbook/MyCurl"]
path = StoryToEbook/MyCurl
url = https://github.com/GhostWriterTNCS/MyCurl.git
3 changes: 1 addition & 2 deletions StoryToEbook/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include <QString>
#include <QTextStream>
#include "MainWindow.h"
#include "MyCurl.h"
#include "MyUtils.h"
#include "MyQtUtils.h"
#include "Website.h"

MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
Expand Down
2 changes: 1 addition & 1 deletion StoryToEbook/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Paste here the url of the story or of a chapter</string>
<string>Paste here the url of the story or of a chapter:</string>
</property>
</widget>
</item>
Expand Down
1 change: 1 addition & 0 deletions StoryToEbook/MyCurl
Submodule MyCurl added at 3a59a2
50 changes: 0 additions & 50 deletions StoryToEbook/MyCurl.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions StoryToEbook/MyCurl.h

This file was deleted.

15 changes: 12 additions & 3 deletions StoryToEbook/MyUtils.cpp → StoryToEbook/MyQtUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "MyUtils.h"
#include "MyCurl.h"
#include "MyQtUtils.h"

namespace MyUtils {
namespace MyQtUtils {

QString readFile(QString filename) {
QFile file(filename);
Expand Down Expand Up @@ -56,4 +57,12 @@ QString advancedReplace(QString str, QString startReplace, QString endReplace, Q
return str;
}

} // namespace MyUtils
QString urlToQString(QString url) {
return QString::fromLocal8Bit(MyCurl::urlToString(url.toStdString()).c_str());
}

QString redirectedUrlQt(QString url) {
return QString::fromLocal8Bit(MyCurl::redirectedUrl(url.toStdString()).c_str());
}

} // namespace MyQtUtils
8 changes: 6 additions & 2 deletions StoryToEbook/MyUtils.h → StoryToEbook/MyQtUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
#include <QString>
#include <QTextStream>

namespace MyUtils {
namespace MyQtUtils {

QString readFile(QString filename);
QString validateFilename(QString filename);
bool writeFile(QString filename, QString content);

QString substring(QString str, QString start, QString end = "");
QString advancedReplace(QString str, QString startReplace, QString endReplace, QString newText);

} // namespace MyUtils
QString urlToQString(QString url);
QString redirectedUrlQt(QString url);

} // namespace MyQtUtils
18 changes: 9 additions & 9 deletions StoryToEbook/StoryToEbook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\include;$(ProjectDir)\websites</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(ProjectDir)\lib</LibraryPath>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\MyCurl;$(ProjectDir)\websites</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(ProjectDir)\MyCurl</LibraryPath>
<SourcePath>$(VC_SourcePath);$(ProjectDir)\websites</SourcePath>
<TargetName>Story to ebook</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\bin\$(Configuration)\</OutDir>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\include;$(ProjectDir)\websites</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(ProjectDir)\lib</LibraryPath>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\MyCurl;$(ProjectDir)\websites</IncludePath>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(ProjectDir)\MyCurl</LibraryPath>
<SourcePath>$(VC_SourcePath);$(ProjectDir)\websites</SourcePath>
<TargetName>Story to ebook</TargetName>
</PropertyGroup>
Expand Down Expand Up @@ -83,8 +83,8 @@
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MyCurl.cpp" />
<ClCompile Include="MyUtils.cpp" />
<ClCompile Include="MyCurl\MyCurl.cpp" />
<ClCompile Include="MyQtUtils.cpp" />
<ClCompile Include="QtGeneratedFiles\Debug\moc_MainWindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
Expand Down Expand Up @@ -126,8 +126,8 @@
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MyCurl.h" />
<ClInclude Include="MyUtils.h" />
<ClInclude Include="MyCurl\MyCurl.h" />
<ClInclude Include="MyQtUtils.h" />
<ClInclude Include="QtGeneratedFiles\ui_MainWindow.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Website.h" />
Expand All @@ -150,7 +150,7 @@
<ResourceCompile Include="StoryToEbook.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="Resources\icon.ico" />
<Image Include="resources\icon.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
26 changes: 13 additions & 13 deletions StoryToEbook/StoryToEbook.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
<ClCompile Include="MainWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyCurl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="websites\Wattpad.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -70,6 +64,12 @@
<ClCompile Include="websites\EFP.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyQtUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyCurl\MyCurl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MainWindow.h">
Expand All @@ -86,12 +86,6 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyCurl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="websites\Wattpad.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -104,11 +98,17 @@
<ClInclude Include="websites\EFP.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyQtUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyCurl\MyCurl.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="StoryToEbook.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="Resources\icon.ico" />
<Image Include="resources\icon.ico" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions StoryToEbook/Website.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <QFileInfo>
#include "MyUtils.h"
#include "MyQtUtils.h"
#include "Wattpad.h"
#include "Website.h"

Expand Down Expand Up @@ -47,15 +47,15 @@ QString Website::createEbook(QString extension, bool downloadCover, QString fold
folder = folder.replace("/", "\\");
}

Website::title = MyUtils::validateFilename(Website::title);
Website::title = MyQtUtils::validateFilename(Website::title);
if (extension == "html") {
MyUtils::writeFile(Website::title + ".html", Website::story);
MyQtUtils::writeFile(Website::title + ".html", Website::story);
} else {
int i = 0;
QFile file;
while (file.exists(QString::number(i) + ".htm"))
i++;
MyUtils::writeFile(QString::number(i) + ".htm", Website::story);
MyQtUtils::writeFile(QString::number(i) + ".htm", Website::story);

if (downloadCover && !Website::cover.isEmpty()) {
Website::cover = Website::cover.replace(" ", "%20");
Expand Down
Loading

0 comments on commit f356ad9

Please sign in to comment.