File indexing completed on 2024-04-28 04:55:52

0001 /*
0002     This file is part of Choqok, the KDE micro-blogging client
0003 
0004     SPDX-FileCopyrightText: 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 */
0008 
0009 #ifndef UNTINY_H
0010 #define UNTINY_H
0011 
0012 #include "plugin.h"
0013 
0014 #include <QMap>
0015 #include <QQueue>
0016 #include <QUrl>
0017 #include <QPointer>
0018 
0019 namespace KIO {
0020 class Job;
0021 }
0022 
0023 class KJob;
0024 namespace Choqok {
0025 namespace UI {
0026     class PostWidget;
0027 }
0028 }
0029 
0030 class UnTiny : public Choqok::Plugin
0031 {
0032     Q_OBJECT
0033 public:
0034     UnTiny( QObject* parent, const QList< QVariant >& args );
0035     ~UnTiny();
0036 
0037 protected Q_SLOTS:
0038     void slotAddNewPostWidget( Choqok::UI::PostWidget *newWidget );
0039     void slot301Redirected(KIO::Job*,QUrl,QUrl);
0040     void startParsing();
0041 
0042 private:
0043     enum ParserState{ Running = 0, Stopped };
0044     ParserState state;
0045 
0046     void parse( QPointer< Choqok::UI::PostWidget > postToParse );
0047     QQueue< QPointer<Choqok::UI::PostWidget> > postsQueue;
0048     QMap<KJob*, QPointer<Choqok::UI::PostWidget> > mParsingList;
0049     QMap<KJob*, QString> mShortUrlsList;
0050 };
0051 
0052 #endif //UNTINY_H