File indexing completed on 2024-04-28 04:55:50
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 IMAGEPREVIEW_H 0010 #define IMAGEPREVIEW_H 0011 0012 #include <QQueue> 0013 #include <QPixmap> 0014 #include <QVariant> 0015 0016 #include "plugin.h" 0017 0018 namespace Choqok 0019 { 0020 namespace UI 0021 { 0022 class PostWidget; 0023 } 0024 } 0025 0026 class ImagePreview : public Choqok::Plugin 0027 { 0028 Q_OBJECT 0029 public: 0030 ImagePreview(QObject *parent, const QList< QVariant > &args); 0031 ~ImagePreview(); 0032 0033 protected Q_SLOTS: 0034 void slotAddNewPostWidget(Choqok::UI::PostWidget *newWidget); 0035 void startParsing(); 0036 void slotImageFetched(const QUrl &remoteUrl, const QPixmap &pixmap); 0037 0038 private: 0039 enum ParserState { Running = 0, Stopped }; 0040 ParserState state; 0041 0042 void parse(Choqok::UI::PostWidget *postToParse); 0043 QQueue< QPointer<Choqok::UI::PostWidget> > postsQueue; 0044 QMap<QUrl, QPointer<Choqok::UI::PostWidget> > mParsingList;//remoteUrl, Post 0045 QMap<QUrl, QString> mBaseUrlMap;//remoteUrl, BaseUrl 0046 0047 static const QRegExp mImgLyRegExp; 0048 static const QRegExp mTwitgooRegExp; 0049 static const QRegExp mPumpIORegExp; 0050 }; 0051 0052 #endif // IMAGEPREVIEW_H