Remove TaskUzOnline, because addresses are same with TaskTasix now.

This commit is contained in:
Nodir Temirkhodjaev 2018-08-28 06:33:35 +05:00
parent f9e472b61f
commit 5b91b571be
8 changed files with 1 additions and 96 deletions

View File

@ -42,7 +42,6 @@ SOURCES += \
task/taskmanager.cpp \ task/taskmanager.cpp \
task/tasktasix.cpp \ task/tasktasix.cpp \
task/taskupdatechecker.cpp \ task/taskupdatechecker.cpp \
task/taskuzonline.cpp \
task/taskworker.cpp \ task/taskworker.cpp \
translationmanager.cpp \ translationmanager.cpp \
util/conf/addressrange.cpp \ util/conf/addressrange.cpp \
@ -100,7 +99,6 @@ HEADERS += \
task/taskmanager.h \ task/taskmanager.h \
task/tasktasix.h \ task/tasktasix.h \
task/taskupdatechecker.h \ task/taskupdatechecker.h \
task/taskuzonline.h \
task/taskworker.h \ task/taskworker.h \
translationmanager.h \ translationmanager.h \
util/conf/addressrange.h \ util/conf/addressrange.h \

Binary file not shown.

View File

@ -167,11 +167,6 @@
<source>TAS-IX Addresses Downloader</source> <source>TAS-IX Addresses Downloader</source>
<translation>Загрузчик TAS-IX адресов</translation> <translation>Загрузчик TAS-IX адресов</translation>
</message> </message>
<message>
<location filename="../task/taskinfo.cpp" line="52"/>
<source>UzOnline Addresses Downloader</source>
<translation>Загрузчик UzOnline адресов</translation>
</message>
</context> </context>
<context> <context>
<name>TaskTasix</name> <name>TaskTasix</name>
@ -189,14 +184,6 @@
<translation>Новая версия!</translation> <translation>Новая версия!</translation>
</message> </message>
</context> </context>
<context>
<name>TaskUzonline</name>
<message>
<location filename="../task/taskuzonline.h" line="23"/>
<source>UzOnline addresses updated!</source>
<translation>UzOnline адреса обновлены!</translation>
</message>
</context>
<context> <context>
<name>qml</name> <name>qml</name>
<message> <message>

View File

@ -6,7 +6,6 @@
#include "../util/dateutil.h" #include "../util/dateutil.h"
#include "tasktasix.h" #include "tasktasix.h"
#include "taskupdatechecker.h" #include "taskupdatechecker.h"
#include "taskuzonline.h"
#define TASK_INFO_VERSION 1 #define TASK_INFO_VERSION 1
@ -48,8 +47,6 @@ QString TaskInfo::title() const
return tr("Update Checker"); return tr("Update Checker");
case Tasix: case Tasix:
return tr("TAS-IX Addresses Downloader"); return tr("TAS-IX Addresses Downloader");
case Uzonline:
return tr("UzOnline Addresses Downloader");
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return QString(); return QString();
@ -199,8 +196,6 @@ TaskWorker *TaskInfo::createWorker()
return new TaskUpdateChecker(this); return new TaskUpdateChecker(this);
case Tasix: case Tasix:
return new TaskTasix(this); return new TaskTasix(this);
case Uzonline:
return new TaskUzonline(this);
default: default:
Q_UNREACHABLE(); Q_UNREACHABLE();
return nullptr; return nullptr;

View File

@ -21,8 +21,7 @@ public:
enum TaskType : qint16 { enum TaskType : qint16 {
TypeNone = -1, TypeNone = -1,
UpdateChecker = 0, UpdateChecker = 0,
Tasix, Tasix
Uzonline
}; };
Q_ENUM(TaskType) Q_ENUM(TaskType)

View File

@ -28,7 +28,6 @@ void TaskManager::setupTasks()
{ {
appendTaskInfo(new TaskInfo(TaskInfo::UpdateChecker, this)); appendTaskInfo(new TaskInfo(TaskInfo::UpdateChecker, this));
appendTaskInfo(new TaskInfo(TaskInfo::Tasix, this)); appendTaskInfo(new TaskInfo(TaskInfo::Tasix, this));
appendTaskInfo(new TaskInfo(TaskInfo::Uzonline, this));
} }
void TaskManager::appendTaskInfo(TaskInfo *taskInfo) void TaskManager::appendTaskInfo(TaskInfo *taskInfo)

View File

@ -1,46 +0,0 @@
#include "taskuzonline.h"
#include <QRegularExpression>
#include <QVector>
#include "../util/net/netdownloader.h"
TaskUzonline::TaskUzonline(QObject *parent) :
TaskTasix(parent)
{
}
void TaskUzonline::setupDownloader()
{
downloader()->setUrl("https://alltor.me/viewtopic.php?p=1345405");
}
QStringList TaskUzonline::parseUzonlineBuffer(const QByteArray &buffer)
{
const int startPos = buffer.indexOf("=UZONLINE=START=");
const int endPos = buffer.indexOf("=UZONLINE=END=", startPos + 1);
if (startPos < 0 || endPos < 0)
return QStringList();
const QRegularExpression re(R"(([\d.]+)[^\d.]*-[^\d.]*([\d.]+))");
QStringList list;
// Parse lines
const QString text = QString::fromLatin1(buffer.constData() + startPos,
endPos - startPos);
foreach (const QStringRef &line, text.splitRef(
"<br", QString::SkipEmptyParts)) {
const QRegularExpressionMatch match = re.match(line);
if (!match.hasMatch())
continue;
const QString ip1 = match.captured(1);
const QString ip2 = match.captured(2);
list.append(ip1 + '-' + ip2);
}
return list;
}

View File

@ -1,27 +0,0 @@
#ifndef TASKUZONLINE_H
#define TASKUZONLINE_H
#include "tasktasix.h"
class TaskUzonline : public TaskTasix
{
Q_OBJECT
public:
explicit TaskUzonline(QObject *parent = nullptr);
static QStringList parseUzonlineBuffer(const QByteArray &buffer);
protected:
void setupDownloader() override;
virtual QStringList parseCustomBuffer(const QByteArray &buffer) const override {
return parseUzonlineBuffer(buffer);
}
QString successMessage() const override {
return tr("UzOnline addresses updated!");
}
};
#endif // TASKUZONLINE_H