File indexing completed on 2024-05-05 04:47:20
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Téo Mrnjavac <teo@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef AMAROK_OCSPERSONITEM_H 0018 #define AMAROK_OCSPERSONITEM_H 0019 0020 #include "ui_OcsPersonItem.h" 0021 0022 #include "OcsData.h" 0023 0024 #include <kaboutdata.h> 0025 #include <KToolBar> 0026 #include <Attica/Person> 0027 #include <Attica/Provider> 0028 0029 #include <QLabel> 0030 0031 class KJob; 0032 0033 namespace Attica { 0034 class BaseJob; 0035 } 0036 0037 class OcsPersonItem : public QWidget, private Ui::OcsPersonItem 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 enum PersonStatus 0043 { 0044 Author = 0, 0045 Contributor = 1 0046 }; 0047 enum State 0048 { 0049 Offline = 0, 0050 Online = 1 0051 }; 0052 0053 OcsPersonItem( const KAboutPerson &person, const QString &ocsUsername, PersonStatus status, QWidget *parent = nullptr ); 0054 0055 ~OcsPersonItem() override; 0056 0057 QString name() const; 0058 0059 void switchToOcs( Attica::Provider &provider ); 0060 0061 Q_SIGNALS: 0062 void ocsFetchStarted(); 0063 void ocsFetchResult( int err ); 0064 0065 private Q_SLOTS: 0066 void launchUrl( QAction *action ); 0067 void onJobFinished( Attica::BaseJob *job ); 0068 void onAvatarLoadingJobFinished( KJob *job ); 0069 0070 private: 0071 void init(); 0072 void fillOcsData( const Attica::Person &ocsPerson ); 0073 const KAboutPerson *m_person; 0074 QString m_ocsUsername; 0075 QString m_aboutText; 0076 KToolBar *m_iconsBar; //!< holds the icons for email, homepage and oD.o profile 0077 KToolBar *m_snBar; //!< holds any other icons for social network profiles 0078 PersonStatus m_status; 0079 State m_state; 0080 /* 0081 <firstname>Frank</firstname> 0082 <lastname>Test</lastname> 0083 <communityrole>developer</communityrole> 0084 <homepage>opendesktop.org</homepage> 0085 <company>opendesktop.org</company> 0086 <avatarpic>http://www.KDE-Look.org/CONTENT/user-pics/0/Frank.jpg</avatarpic> 0087 <avatarpicfound>1</avatarpicfound> 0088 <bigavatarpic>http://www.KDE-Look.org/CONTENT/user-bigpics/0/Frank.jpg</bigavatarpic> 0089 <bigavatarpicfound>1</bigavatarpicfound> 0090 <city>Stuttgart</city> 0091 <country>Germany</country> 0092 <ircnick>karli</ircnick> 0093 <ircchannels>kde-dev, plasma</ircchannels> 0094 <irclink>irc://irc.freenode.org/kde-dev</irclink> 0095 <irclink>irc://irc.freenode.org/plasma</irclink> 0096 <profilepage>http://www.KDE-Look.org/usermanager/search.php?username=Frank</profilepage> 0097 */ 0098 }; 0099 0100 #endif //AMAROK_OCSPERSONITEM_H