2013-03-15 21:02:43 +00:00
|
|
|
/*
|
|
|
|
* Retroshare Gxs Support
|
2012-11-19 22:14:45 +00:00
|
|
|
*
|
2013-03-15 21:02:43 +00:00
|
|
|
* Copyright 2012-2013 by Robert Fernie.
|
2012-11-19 22:14:45 +00:00
|
|
|
*
|
2013-03-15 21:02:43 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2.1 as published by the Free Software Foundation.
|
2012-11-19 22:14:45 +00:00
|
|
|
*
|
2013-03-15 21:02:43 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
2012-11-19 22:14:45 +00:00
|
|
|
*
|
2013-03-15 21:02:43 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
2012-11-19 22:14:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef _GXS_ID_CHOOSER_H
|
|
|
|
#define _GXS_ID_CHOOSER_H
|
|
|
|
|
|
|
|
#include <QComboBox>
|
2014-07-06 11:19:58 +00:00
|
|
|
#include <QPushButton>
|
|
|
|
#include "util/TokenQueue.h"
|
2012-11-19 22:14:45 +00:00
|
|
|
#include <retroshare/rsidentity.h>
|
2014-07-06 11:19:58 +00:00
|
|
|
#include <retroshare/rsgxsifacetypes.h>
|
|
|
|
|
|
|
|
// This class implement a basic RS functionality which is that ComboBox displaying Id
|
|
|
|
// should update regularly. They also should update only when visible, to save CPU time.
|
|
|
|
//
|
|
|
|
|
|
|
|
class RsGxsIfaceHelper;
|
|
|
|
class RsGxsUpdateBroadcastBase;
|
2012-11-19 22:14:45 +00:00
|
|
|
|
|
|
|
#define IDCHOOSER_ID_REQUIRED 0x0001
|
|
|
|
#define IDCHOOSER_ANON_DEFAULT 0x0002
|
|
|
|
|
2014-07-06 11:19:58 +00:00
|
|
|
class GxsIdChooser : public QComboBox, public TokenResponse
|
2012-11-19 22:14:45 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-07-06 11:19:58 +00:00
|
|
|
GxsIdChooser(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
2012-11-19 22:14:45 +00:00
|
|
|
GxsIdChooser(QWidget *parent = NULL);
|
2014-07-06 11:19:58 +00:00
|
|
|
virtual ~GxsIdChooser();
|
|
|
|
|
2014-11-24 21:02:18 +00:00
|
|
|
void setFlags(uint32_t flags) ;
|
|
|
|
|
2014-07-06 11:19:58 +00:00
|
|
|
void setUpdateWhenInvisible(bool update);
|
|
|
|
const std::list<RsGxsGroupId> &getGrpIds();
|
|
|
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
|
|
|
|
|
|
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);//TokenResponse
|
2012-11-19 22:14:45 +00:00
|
|
|
|
2014-07-06 11:19:58 +00:00
|
|
|
enum ChosenId_Ret {None, KnowId, UnKnowId, NoId} ;
|
2012-11-19 22:14:45 +00:00
|
|
|
void loadIds(uint32_t chooserFlags, RsGxsId defId);
|
2014-07-06 11:19:58 +00:00
|
|
|
void setDefaultId(RsGxsId defId) {mDefaultId=defId;}
|
|
|
|
void setDefaultId(std::string defIdName) {mDefaultIdName=defIdName;}
|
|
|
|
|
|
|
|
bool setChosenId(RsGxsId &gxsId);
|
|
|
|
ChosenId_Ret getChosenId(RsGxsId &gxsId);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
virtual void updateDisplay(bool complete);
|
2012-11-19 22:14:45 +00:00
|
|
|
|
2013-06-23 18:55:30 +00:00
|
|
|
private slots:
|
2014-07-06 11:19:58 +00:00
|
|
|
void fillDisplay(bool complete);
|
|
|
|
void myCurrentIndexChanged(int index);
|
2013-06-23 18:55:30 +00:00
|
|
|
|
2012-11-19 22:14:45 +00:00
|
|
|
private:
|
2014-07-06 11:19:58 +00:00
|
|
|
void requestIdList() ;
|
|
|
|
void loadPrivateIds(uint32_t token);
|
|
|
|
void insertIdList(uint32_t token);
|
|
|
|
void setDefaultItem();
|
2012-11-19 22:14:45 +00:00
|
|
|
|
|
|
|
uint32_t mFlags;
|
|
|
|
RsGxsId mDefaultId;
|
2014-07-06 11:19:58 +00:00
|
|
|
std::string mDefaultIdName;
|
|
|
|
bool mFirstLoad;
|
|
|
|
QPushButton* addNewCxsId;
|
2013-06-23 18:55:30 +00:00
|
|
|
|
2014-07-06 11:19:58 +00:00
|
|
|
TokenQueue *mIdQueue;
|
|
|
|
RsGxsUpdateBroadcastBase *mBase;
|
2012-11-19 22:14:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|