├── images
├── dice.png
└── irkick.png
├── ETChat_images.qrc
├── testit.sh
├── README.md
├── topjcdialog.h
├── topjcdialog.cpp
├── ETChat.pro
├── ETChatPlugin.h
├── topjcdialog.ui
└── ETChatPlugin.cpp
/images/dice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/ETChatRS/master/images/dice.png
--------------------------------------------------------------------------------
/images/irkick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/ETChatRS/master/images/irkick.png
--------------------------------------------------------------------------------
/ETChat_images.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/irkick.png
4 | images/dice.png
5 |
6 |
7 |
--------------------------------------------------------------------------------
/testit.sh:
--------------------------------------------------------------------------------
1 | make clean
2 | qmake-qt4
3 | make clean
4 | make
5 | kdesudo -u retrotester cp libETChat.so* /home/retrotester/.retroshare/extensions6/
6 | kdesudo -u retrotester ../../retroshare-gui/src/RetroShare
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is a test plugin that lets you chat with minimal code!
2 |
3 | ###include easy transport
4 |
5 | #include "interface/rsEasyTransport.h"
6 |
7 |
8 | ###connect
9 |
10 | connect(rsEasyTransport->mNotify, SIGNAL(NeMsgArrived(RsPeerId,QString)), this , SLOT(NeMsgArrived(RsPeerId,QString)));
11 |
12 | ###send message
13 |
14 | rsEasyTransport->msg_all(ui->lineEdit->text().toStdString());
15 |
--------------------------------------------------------------------------------
/topjcdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef TOPJCDIALOG_H
2 | #define TOPJCDIALOG_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 |
9 | #include
10 |
11 | namespace Ui {
12 | class TopJCDialog;
13 | }
14 |
15 | class TopJCDialog : public MainPage
16 | {
17 | Q_OBJECT
18 |
19 | public:
20 | explicit TopJCDialog(QWidget *parent = 0);
21 | ~TopJCDialog();
22 |
23 | public slots:
24 | void NeMsgArrived(const RsPeerId &peer_id, QString str);
25 | private slots:
26 | void on_lineEdit_returnPressed();
27 |
28 | private:
29 | Ui::TopJCDialog *ui;
30 | };
31 |
32 | #endif // TOPJCDIALOG_H
33 |
--------------------------------------------------------------------------------
/topjcdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "topjcdialog.h"
2 | #include "ui_topjcdialog.h"
3 |
4 | #include "interface/rsEasyTransport.h"
5 |
6 | /** Constructor
7 | LinksDialog::LinksDialog(RsPeers *peers, RsFiles *files, QWidget *parent)
8 | : MainPage(parent), mPeers(peers), mFiles(files)
9 | {
10 |
11 | }**/
12 |
13 | class rsEasyTransport;
14 |
15 | TopJCDialog::TopJCDialog(QWidget *parent) :
16 | MainPage(parent),
17 | ui(new Ui::TopJCDialog)
18 | {
19 | ui->setupUi(this);
20 | connect(rsEasyTransport->mNotify, SIGNAL(NeMsgArrived(RsPeerId,QString)), this , SLOT(NeMsgArrived(RsPeerId,QString)));
21 | }
22 |
23 | TopJCDialog::~TopJCDialog()
24 | {
25 | delete ui;
26 | }
27 |
28 | void TopJCDialog::on_lineEdit_returnPressed()
29 | {
30 | rsEasyTransport->msg_all(ui->lineEdit->text().toStdString());
31 | }
32 |
33 |
34 | void TopJCDialog::NeMsgArrived(const RsPeerId &peer_id, QString str)
35 | {
36 |
37 | std::cout << "GUI got Packet from: " << peer_id;
38 | std::cout << " saying " << str.toStdString();
39 | std::cout << std::endl;
40 |
41 | QString output = QString::fromStdString(rsPeers->getPeerName(peer_id));
42 | output+=": ";
43 | output+=str;
44 | ui->textBrowser->append(output);
45 | }
46 |
--------------------------------------------------------------------------------
/ETChat.pro:
--------------------------------------------------------------------------------
1 | !include("../Common/retroshare_plugin.pri"): error("Could not include file ../Common/retroshare_plugin.pri")
2 |
3 |
4 | INCLUDEPATH += ../EasyTransport/
5 | #LIBS += /home/chozabu/.retroshare/extensions6/libEasyTransport.so
6 | #LIBS += /home/chozabu/.retroshare/extensions6/libEasyTransport.so.1
7 |
8 | CONFIG += qt uic qrc resources
9 |
10 | greaterThan(QT_MAJOR_VERSION, 4) {
11 | # Qt 5
12 | QT += widgets
13 | }
14 |
15 | SOURCES = ETChatPlugin.cpp \
16 | topjcdialog.cpp
17 | HEADERS = ETChatPlugin.h \
18 | topjcdialog.h
19 | FORMS = \
20 | topjcdialog.ui
21 |
22 | TARGET = ETChat
23 |
24 | RESOURCES = ETChat_images.qrc
25 |
26 | TRANSLATIONS += \
27 | lang/ETChat_cs.ts \
28 | lang/ETChat_da.ts \
29 | lang/ETChat_de.ts \
30 | lang/ETChat_el.ts \
31 | lang/ETChat_en.ts \
32 | lang/ETChat_es.ts \
33 | lang/ETChat_fi.ts \
34 | lang/ETChat_fr.ts \
35 | lang/ETChat_hu.ts \
36 | lang/ETChat_it.ts \
37 | lang/ETChat_ja_JP.ts \
38 | lang/ETChat_ko.ts \
39 | lang/ETChat_nl.ts \
40 | lang/ETChat_pl.ts \
41 | lang/ETChat_ru.ts \
42 | lang/ETChat_sv.ts \
43 | lang/ETChat_tr.ts \
44 | lang/ETChat_zh_CN.ts
45 |
46 | OTHER_FILES += \
47 | testit.sh
48 |
--------------------------------------------------------------------------------
/ETChatPlugin.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | class ETChatPlugin: public RsPlugin
7 | {
8 | public:
9 | ETChatPlugin() ;
10 | virtual ~ETChatPlugin() {}
11 |
12 | virtual RsCacheService *rs_cache_service() const ;
13 | virtual MainPage *qt_page() const ;
14 | virtual QIcon *qt_icon() const ;
15 | //virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_RANK ; }
16 | virtual QTranslator *qt_translator(QApplication *app, const QString& languageCode, const QString& externalDir) const;
17 |
18 | virtual void getPluginVersion(int& major, int& minor, int &build, int& svn_rev) const ;
19 | virtual void setPlugInHandler(RsPluginHandler *pgHandler);
20 |
21 | virtual std::string configurationFileName() const { return std::string() ; }
22 |
23 | virtual std::string getShortPluginDescription() const ;
24 | virtual std::string getPluginName() const;
25 | virtual void setInterfaces(RsPlugInInterfaces& interfaces);
26 | private:
27 | mutable RsPluginHandler *mPlugInHandler;
28 | mutable RsFiles* mFiles;
29 | mutable RsPeers* mPeers;
30 | mutable MainPage* mainpage ;
31 | mutable QIcon* mIcon ;
32 | };
33 |
34 |
--------------------------------------------------------------------------------
/topjcdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TopJCDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 10
20 | 260
21 | 301
22 | 32
23 |
24 |
25 |
26 |
27 |
28 |
29 | 310
30 | 260
31 | 84
32 | 34
33 |
34 |
35 |
36 | PushButton
37 |
38 |
39 |
40 |
41 |
42 | 10
43 | 10
44 | 381
45 | 241
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ETChatPlugin.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include "ETChatPlugin.h"
7 | //#include "LinksDialog.h"
8 | #include "topjcdialog.h"
9 |
10 | //static void *inited = new ETChatPlugin();
11 |
12 | //inited->rs_cache_service();
13 |
14 | extern "C" {
15 | void *RETROSHARE_PLUGIN_provide()
16 | {
17 | static ETChatPlugin *p = new ETChatPlugin() ;
18 |
19 | return (void*)p ;
20 | }
21 |
22 | // This symbol contains the svn revision number grabbed from the executable.
23 | // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
24 | // with same revision numbers, assuming that the revision numbers are up-to-date.
25 | //
26 | uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ;
27 |
28 | // This symbol contains the svn revision number grabbed from the executable.
29 | // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
30 | // with same revision numbers, assuming that the revision numbers are up-to-date.
31 | //
32 | uint32_t RETROSHARE_PLUGIN_api = RS_PLUGIN_API_VERSION ;
33 | }
34 |
35 | #define IMAGE_LINKS ":/images/dice.png"
36 |
37 | void ETChatPlugin::getPluginVersion(int& major, int& minor, int &build, int& svn_rev) const
38 | {
39 | major = RS_MAJOR_VERSION;
40 | minor = RS_MINOR_VERSION;
41 | build = RS_BUILD_NUMBER;
42 | svn_rev = RS_REVISION_NUMBER;
43 | }
44 |
45 | ETChatPlugin::ETChatPlugin()
46 | {
47 | //mRanking = NULL ;
48 | mainpage = NULL ;
49 | mIcon = NULL ;
50 | mPlugInHandler = NULL;
51 | mPeers = NULL;
52 | mFiles = NULL;
53 | }
54 |
55 | void ETChatPlugin::setInterfaces(RsPlugInInterfaces &interfaces){
56 |
57 | mPeers = interfaces.mPeers;
58 | mFiles = interfaces.mFiles;
59 | }
60 |
61 | MainPage *ETChatPlugin::qt_page() const
62 | {
63 | if(mainpage == NULL)
64 | mainpage = new TopJCDialog();//mPeers, mFiles) ;
65 |
66 | return mainpage ;
67 | }
68 |
69 | RsCacheService *ETChatPlugin::rs_cache_service() const
70 | {
71 | /*if(mRanking == NULL)
72 | {
73 | mRanking = new p3Ranking(mPlugInHandler) ; // , 3600 * 24 * 30 * 6); // 6 Months
74 | rsRanks = mRanking ;
75 | }
76 |
77 | return mRanking ;*/
78 | return NULL;
79 | }
80 |
81 | void ETChatPlugin::setPlugInHandler(RsPluginHandler *pgHandler){
82 | mPlugInHandler = pgHandler;
83 |
84 | }
85 |
86 | QIcon *ETChatPlugin::qt_icon() const
87 | {
88 | if(mIcon == NULL)
89 | {
90 | Q_INIT_RESOURCE(ETChat_images) ;
91 |
92 | mIcon = new QIcon(IMAGE_LINKS) ;
93 | }
94 |
95 | return mIcon ;
96 | }
97 |
98 | std::string ETChatPlugin::getShortPluginDescription() const
99 | {
100 | return "infosoon";//QApplication::translate("ETChatPlugin", "This plugin provides a set of cached links, and a voting system to promote them.").toUtf8().constData();
101 | }
102 |
103 | std::string ETChatPlugin::getPluginName() const
104 | {
105 | return "ETChat";//QApplication::translate("ETChatPlugin", "ETChat").toUtf8().constData();
106 | }
107 |
108 | QTranslator* ETChatPlugin::qt_translator(QApplication */*app*/, const QString& languageCode, const QString& externalDir) const
109 | {
110 | if (languageCode == "en") {
111 | return NULL;
112 | }
113 |
114 | QTranslator* translator = new QTranslator();
115 |
116 | if (translator->load(externalDir + "/ETChat_" + languageCode + ".qm")) {
117 | return translator;
118 | } else if (translator->load(":/lang/ETChat_" + languageCode + ".qm")) {
119 | return translator;
120 | }
121 |
122 | delete(translator);
123 | return NULL;
124 | }
125 |
--------------------------------------------------------------------------------