From edd8e52b2d709f33de87d91b3608779f019c6fb9 Mon Sep 17 00:00:00 2001
From: GhostWriterTNCS
Date: Sat, 29 Apr 2017 09:04:47 +0200
Subject: [PATCH] Bugfix.
---
README.md | 2 +-
StoryToEbook.sln | 9 -----
StoryToEbook/MainWindow.cpp | 2 +-
StoryToEbook/MyCurl | 2 +-
StoryToEbook/{MyQtUtils.cpp => MyUtils.cpp} | 6 ++--
StoryToEbook/{MyQtUtils.h => MyUtils.h} | 4 +--
StoryToEbook/StoryToEbook.vcxproj | 4 +--
StoryToEbook/StoryToEbook.vcxproj.filters | 8 ++---
StoryToEbook/Website.cpp | 8 ++---
StoryToEbook/websites/EFP.cpp | 24 ++++++-------
StoryToEbook/websites/Wattpad.cpp | 38 ++++++++++-----------
11 files changed, 49 insertions(+), 58 deletions(-)
rename StoryToEbook/{MyQtUtils.cpp => MyUtils.cpp} (96%)
rename StoryToEbook/{MyQtUtils.h => MyUtils.h} (90%)
diff --git a/README.md b/README.md
index 21fd00c..09a2e6c 100644
--- a/README.md
+++ b/README.md
@@ -12,4 +12,4 @@ Requires [Calibre](https://calibre-ebook.com/) to convert the stories in ebook.
### Release notices
-Made with [Qt5.8](https://www.qt.io/download-open-source/)
\ No newline at end of file
+Made with [Qt5.8](https://www.qt.io/download-open-source/)
diff --git a/StoryToEbook.sln b/StoryToEbook.sln
index 147b737..2f652bc 100644
--- a/StoryToEbook.sln
+++ b/StoryToEbook.sln
@@ -5,15 +5,6 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StoryToEbook", "StoryToEbook\StoryToEbook.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{09262069-B147-4887-8004-9621DA64B5FB}"
- ProjectSection(SolutionItems) = preProject
- .gitattributes = .gitattributes
- .gitignore = .gitignore
- curl LICENSE.txt = curl LICENSE.txt
- LICENSE = LICENSE
- README.md = README.md
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
diff --git a/StoryToEbook/MainWindow.cpp b/StoryToEbook/MainWindow.cpp
index ec74942..39f5a24 100644
--- a/StoryToEbook/MainWindow.cpp
+++ b/StoryToEbook/MainWindow.cpp
@@ -6,7 +6,7 @@
#include
#include
#include "MainWindow.h"
-#include "MyQtUtils.h"
+#include "MyUtils.h"
#include "Website.h"
// Websites:
diff --git a/StoryToEbook/MyCurl b/StoryToEbook/MyCurl
index 6d3f526..aae9396 160000
--- a/StoryToEbook/MyCurl
+++ b/StoryToEbook/MyCurl
@@ -1 +1 @@
-Subproject commit 6d3f526854745ccb63deff672e751a9393f47b2e
+Subproject commit aae939677c0ef90b9dbf46880cf484e3c1b5f6dc
diff --git a/StoryToEbook/MyQtUtils.cpp b/StoryToEbook/MyUtils.cpp
similarity index 96%
rename from StoryToEbook/MyQtUtils.cpp
rename to StoryToEbook/MyUtils.cpp
index 899725c..f59d89a 100644
--- a/StoryToEbook/MyQtUtils.cpp
+++ b/StoryToEbook/MyUtils.cpp
@@ -1,7 +1,7 @@
#include "MyCurl.h"
-#include "MyQtUtils.h"
+#include "MyUtils.h"
-namespace MyQtUtils {
+namespace MyUtils {
QString readFile(QString filename) {
QFile file(filename);
@@ -65,4 +65,4 @@ QString redirectedUrlQt(QString url) {
return QString::fromLocal8Bit(MyCurl::redirectedUrl(url.toStdString()).c_str());
}
-} // namespace MyQtUtils
+} // namespace MyUtils
diff --git a/StoryToEbook/MyQtUtils.h b/StoryToEbook/MyUtils.h
similarity index 90%
rename from StoryToEbook/MyQtUtils.h
rename to StoryToEbook/MyUtils.h
index d0c322a..cc0e09d 100644
--- a/StoryToEbook/MyQtUtils.h
+++ b/StoryToEbook/MyUtils.h
@@ -4,7 +4,7 @@
#include
#include
-namespace MyQtUtils {
+namespace MyUtils {
QString readFile(QString filename);
QString validateFilename(QString filename);
@@ -16,4 +16,4 @@ QString advancedReplace(QString str, QString startReplace, QString endReplace, Q
QString urlToQString(QString url);
QString redirectedUrlQt(QString url);
-} // namespace MyQtUtils
+} // namespace MyUtils
diff --git a/StoryToEbook/StoryToEbook.vcxproj b/StoryToEbook/StoryToEbook.vcxproj
index 00f6357..5acf83b 100644
--- a/StoryToEbook/StoryToEbook.vcxproj
+++ b/StoryToEbook/StoryToEbook.vcxproj
@@ -84,7 +84,7 @@
-
+
true
@@ -127,7 +127,7 @@
-
+
diff --git a/StoryToEbook/StoryToEbook.vcxproj.filters b/StoryToEbook/StoryToEbook.vcxproj.filters
index 58ad5c8..18adf1d 100644
--- a/StoryToEbook/StoryToEbook.vcxproj.filters
+++ b/StoryToEbook/StoryToEbook.vcxproj.filters
@@ -64,10 +64,10 @@
Source Files
-
+
Source Files
-
+
Source Files
@@ -98,10 +98,10 @@
Header Files
-
+
Header Files
-
+
Header Files
diff --git a/StoryToEbook/Website.cpp b/StoryToEbook/Website.cpp
index 255deb4..51de492 100644
--- a/StoryToEbook/Website.cpp
+++ b/StoryToEbook/Website.cpp
@@ -1,5 +1,5 @@
#include
-#include "MyQtUtils.h"
+#include "MyUtils.h"
#include "Wattpad.h"
#include "Website.h"
@@ -17,15 +17,15 @@ QString Website::createEbook(QString extension, bool downloadCover, QString fold
folder = folder.replace("/", "\\");
}
- Website::title = MyQtUtils::validateFilename(Website::title);
+ Website::title = MyUtils::validateFilename(Website::title);
if (extension == "html") {
- MyQtUtils::writeFile(Website::title + ".html", Website::story);
+ MyUtils::writeFile(Website::title + ".html", Website::story);
} else {
int i = 0;
QFile file;
while (file.exists(QString::number(i) + ".htm"))
i++;
- MyQtUtils::writeFile(QString::number(i) + ".htm", Website::story);
+ MyUtils::writeFile(QString::number(i) + ".htm", Website::story);
if (downloadCover && !Website::cover.isEmpty()) {
Website::cover = Website::cover.replace(" ", "%20");
diff --git a/StoryToEbook/websites/EFP.cpp b/StoryToEbook/websites/EFP.cpp
index b173e86..9653d2a 100644
--- a/StoryToEbook/websites/EFP.cpp
+++ b/StoryToEbook/websites/EFP.cpp
@@ -1,17 +1,17 @@
#include "EFP.h"
-#include "MyQtUtils.h"
+#include "MyUtils.h"
void EFP::downloadStoryInfo(QString url) {
if (url.contains("sid=")) {
- QString id = MyQtUtils::substring(url, "sid=", "&");
+ QString id = MyUtils::substring(url, "sid=", "&");
url = "http://www.efpfanfic.net/viewstory.php?sid=" + id;
- QString s = MyQtUtils::urlToQString(url);
- Website::intro = MyQtUtils::substring(s, "", "
");
+ QString s = MyUtils::urlToQString(url);
+ Website::intro = MyUtils::substring(s, "", "
");
Website::intro = "\n\nIntroduzione
***
\n" +
Website::intro + "
\n";
Website::title =
- MyQtUtils::substring(s, "", "");
+ MyUtils::substring(s, "", "");
if (s.contains("printsave.php?action=printall&sid="))
list.append("http://www.efpfanfic.net/printsave.php?action=printall&sid=" + id);
@@ -24,15 +24,15 @@ void EFP::downloadStoryInfo(QString url) {
}
bool EFP::downloadChapter(int chapterIndex) {
- QString s = MyQtUtils::urlToQString(list[chapterIndex]);
+ QString s = MyUtils::urlToQString(list[chapterIndex]);
s.replace(s.indexOf("***
") + 21, 15, "");
s.replace(s.indexOf("
") + 21, 0, Website::intro);
Website::author = s;
- Website::author = MyQtUtils::substring(Website::author, "uid=", "");
- Website::author = MyQtUtils::substring(Website::author, ">");
+ Website::author = MyUtils::substring(Website::author, "uid=", "");
+ Website::author = MyUtils::substring(Website::author, ">");
- s = MyQtUtils::advancedReplace(s, "\nRitorna "
"all'indice
",
@@ -46,11 +46,11 @@ bool EFP::downloadChapter(int chapterIndex) {
s;
if (s.contains("
");
+ Website::cover = MyUtils::substring(s, "
");
if (Website::cover.contains("src='"))
- Website::cover = MyQtUtils::substring(Website::cover, "src='", "'");
+ Website::cover = MyUtils::substring(Website::cover, "src='", "'");
else
- Website::cover = MyQtUtils::substring(Website::cover, "src=\"", "\"");
+ Website::cover = MyUtils::substring(Website::cover, "src=\"", "\"");
}
return true;
diff --git a/StoryToEbook/websites/Wattpad.cpp b/StoryToEbook/websites/Wattpad.cpp
index 302872c..771dda7 100644
--- a/StoryToEbook/websites/Wattpad.cpp
+++ b/StoryToEbook/websites/Wattpad.cpp
@@ -1,13 +1,13 @@
-#include "MyQtUtils.h"
+#include "MyUtils.h"
#include "Wattpad.h"
void Wattpad::downloadStoryInfo(QString url) {
if (url[24].isDigit()) {
- url = MyQtUtils::urlToQString(url);
+ url = MyUtils::urlToQString(url);
if (!url.contains("data-story-id=\"")) {
return;
}
- url = MyQtUtils::substring(url, "data-story-id=\"", "\"");
+ url = MyUtils::substring(url, "data-story-id=\"", "\"");
url = "https://www.wattpad.com/story/" + url + "/parts";
} else if (!url.startsWith("https://www.wattpad.com/story/")) {
return;
@@ -16,28 +16,28 @@ void Wattpad::downloadStoryInfo(QString url) {
if (!url.contains("/parts")) {
url += "/parts";
}
- QString caps = MyQtUtils::urlToQString(url);
+ QString caps = MyUtils::urlToQString(url);
if (!caps.isEmpty()) {
Website::intro =
- (MyQtUtils::substring(caps, "