本文整理汇总了C++中Protocol::description方法的典型用法代码示例。如果您正苦于以下问题:C++ Protocol::description方法的具体用法?C++ Protocol::description怎么用?C++ Protocol::description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::description方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPict
void StatusLabel::setPict()
{
const char *icon;
const char *text;
if (m_client->getState() == Client::Connecting){
if (m_timer == NULL){
m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
m_timer->start(1000);
m_bBlink = false;
}
Protocol *protocol = m_client->protocol();
text = I18N_NOOP("Connecting");
unsigned status;
if (m_bBlink){
icon = "online";
status = m_client->getManualStatus();
}else{
icon = "offline";
status = STATUS_OFFLINE;
}
if (protocol){
for (const CommandDef *cmd = protocol->statusList(); cmd->text; cmd++){
if (cmd->id == status){
icon = cmd->icon;
break;
}
}
}
}else{
if (m_timer){
delete m_timer;
m_timer = NULL;
}
if (m_client->getState() == Client::Error){
icon = "error";
text = I18N_NOOP("Error");
}else{
Protocol *protocol = m_client->protocol();
const CommandDef *cmd = protocol->description();
icon = cmd->icon;
text = cmd->text;
for (cmd = protocol->statusList(); cmd->text; cmd++){
if (cmd->id == m_client->getStatus()){
icon = cmd->icon;
text = cmd->text;
break;
}
}
}
}
QPixmap pict = Pict(icon);
QString tip = CorePlugin::m_plugin->clientName(m_client);
tip += "\n";
tip += i18n(text);
setPixmap(pict);
QToolTip::add(this, tip);
resize(pict.width(), pict.height());
setFixedSize(pict.width(), pict.height());
};
示例2: protocolChanged
void NewProtocol::protocolChanged(int n)
{
if (m_last){
removePage(m_last);
delete m_last;
m_last = NULL;
}
if (m_connectWnd){
removePage(m_connectWnd);
delete m_connectWnd;
m_connectWnd = NULL;
}
if (m_setup){
removePage(m_setup);
delete m_setup;
m_setup = NULL;
}
if (m_client){
delete m_client;
m_client = NULL;
}
if ((n < 0) || (n >= (int)(m_protocols.size())))
return;
Protocol *protocol = m_protocols[n];
m_client = protocol->createClient(NULL);
if (m_client == NULL)
return;
m_setup = m_client->setupWnd();
if (m_setup == NULL){
delete m_client;
m_client = NULL;
return;
}
connect(m_setup, SIGNAL(okEnabled(bool)), this, SLOT(okEnabled(bool)));
connect(this, SIGNAL(apply()), m_setup, SLOT(apply()));
addPage(m_setup, i18n(protocol->description()->text));
m_connectWnd = new ConnectWnd(m_bStart);
addPage(m_connectWnd, i18n(protocol->description()->text));
if (m_bStart){
m_last = new QWidget;
addPage(m_last, i18n(protocol->description()->text));
}
setNextEnabled(currentPage(), true);
setIcon(Pict(protocol->description()->icon));
Event e(EventRaiseWindow, this);
e.process();
}
示例3: e
NewProtocol::NewProtocol(QWidget *parent)
: NewProtocolBase(parent, "new_protocol", true)
{
m_setup = NULL;
m_client = NULL;
m_last = NULL;
m_connectWnd = NULL;
m_bConnected = false;
m_bConnect = false;
m_bStart = (parent == NULL);
SET_WNDPROC("protocol")
setIcon(Pict("configure"));
setButtonsPict(this);
setCaption(caption());
helpButton()->hide();
for (unsigned n = 0;; n++){
Event e(EventPluginGetInfo, (void*)n);
pluginInfo *info = (pluginInfo*)e.process();
if (info == NULL)
break;
if (info->info == NULL){
Event e(EventLoadPlugin, info->name);
e.process();
if (info->info && !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT))){
Event e(EventUnloadPlugin, info->name);
e.process();
}
}
if ((info->info == NULL) || !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT)))
continue;
info->bDisabled = false;
Event eApply(EventApplyPlugin, info->name);
eApply.process();
}
Protocol *protocol;
ContactList::ProtocolIterator it;
while ((protocol = ++it) != NULL){
const CommandDef *cmd = protocol->description();
if (cmd == NULL)
continue;
m_protocols.push_back(protocol);
}
sort(m_protocols.begin(), m_protocols.end(), cmp_protocol);
for (unsigned i = 0; i < m_protocols.size(); i++){
const CommandDef *cmd = m_protocols[i]->description();
cmbProtocol->insertItem(Pict(cmd->icon), i18n(cmd->text));
}
connect(cmbProtocol, SIGNAL(activated(int)), this, SLOT(protocolChanged(int)));
cmbProtocol->setCurrentItem(0);
protocolChanged(0);
connect(this, SIGNAL(selected(const QString&)), this, SLOT(pageChanged(const QString&)));
}
示例4: ConnectionSettingsBase
ConnectionSettings::ConnectionSettings(Client *client)
: ConnectionSettingsBase(NULL, NULL, true)
{
SET_WNDPROC("client")
setButtonsPict(this);
m_client = client;
Protocol *protocol = client->protocol();
const CommandDef *cmd = protocol->description();
setIcon(Pict(cmd->icon));
setCaption(i18n("Configure %1 client") .arg(i18n(cmd->text)));
QVBoxLayout *lay = new QVBoxLayout(addWnd);
QWidget *setupWnd = client->setupWnd();
setupWnd->reparent(addWnd, QPoint());
lay->addWidget(setupWnd);
setupWnd->show();
}
示例5: QDialog
ConnectionSettings::ConnectionSettings(Client *client) : QDialog(NULL)
//: ConnectionSettingsBase(NULL, NULL, true)
{
setupUi(this);
SET_WNDPROC("client")
setButtonsPict(this);
m_client = client;
Protocol *protocol = client->protocol();
const CommandDef *cmd = protocol->description();
setWindowIcon(Icon(cmd->icon));
setWindowTitle(i18n("Configure %1 client") .arg(i18n(cmd->text)));
QVBoxLayout *lay = new QVBoxLayout(addWnd);
QWidget *setupWnd = client->setupWnd();
setupWnd->setParent(addWnd);
setupWnd->move(QPoint());
lay->addWidget(setupWnd);
setupWnd->show();
}
示例6: fill
void ConnectionManager::fill(Client *current)
{
lstConnection->clear();
QListWidgetItem *curItem = NULL;
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
Protocol *protocol = client->protocol();
const CommandDef *descr = protocol->description();
QString text = CorePlugin::instance()->clientName(client);
QListWidgetItem *item = new QListWidgetItem(text, lstConnection);
if (descr)
item->setIcon(Pict(descr->icon));
if (current == client)
curItem = item;
}
if (curItem)
lstConnection->setCurrentItem(curItem);
selectionChanged();
}
示例7: fill
void ConnectionManager::fill(Client *current)
{
lstConnection->clear();
QListViewItem *curItem = NULL;
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
Protocol *protocol = client->protocol();
const CommandDef *descr = protocol->description();
QString text = CorePlugin::m_plugin->clientName(client);
QListViewItem *item = new QListViewItem(lstConnection, text);
if (descr)
item->setPixmap(0, Pict(descr->icon, lstConnection->colorGroup().base()));
if (current == client)
curItem = item;
QString index = QString::number(i);
while (index.length() < 6)
index = QString("0") + index;
item->setText(1, index);
}
if (curItem)
lstConnection->setCurrentItem(curItem);
selectionChanged();
}
示例8: fill
void ConfigureDialog::fill(unsigned id)
{
lstBox->clear();
lstBox->setSorting(1);
ConfigItem *parentItem = new MainInfoItem(lstBox, 0);
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
CommandDef *cmds = client->configWindows();
if (cmds){
parentItem = NULL;
for (; cmds->text; cmds++){
if (parentItem){
new ClientItem(parentItem, client, cmds);
}else{
parentItem = new ClientItem(lstBox, client, cmds);
parentItem->setOpen(true);
}
}
}
}
unsigned long n;
parentItem = NULL;
list<unsigned> st;
for (n = 0; n < getContacts()->nClients(); n++){
Protocol *protocol = getContacts()->getClient(n)->protocol();
if ((protocol->description()->flags & (PROTOCOL_AR | PROTOCOL_AR_USER)) == 0)
continue;
if (parentItem == NULL){
parentItem = new ConfigItem(lstBox, 0);
parentItem->setText(0, i18n("Autoreply"));
parentItem->setOpen(true);
}
for (const CommandDef *d = protocol->statusList(); d->text; d++){
if (((protocol->description()->flags & PROTOCOL_AR_OFFLINE) == 0) &&
((d->id == STATUS_ONLINE) || (d->id == STATUS_OFFLINE)))
continue;
list<unsigned>::iterator it;
for (it = st.begin(); it != st.end(); ++it)
if ((*it) == d->id)
break;
if (it != st.end())
continue;
st.push_back(d->id);
new ARItem(parentItem, d);
}
}
parentItem = new ConfigItem(lstBox, 0);
parentItem->setText(0, i18n("Plugins"));
parentItem->setPixmap(0, Pict("run", lstBox->colorGroup().base()));
parentItem->setOpen(true);
for ( n = 0;; n++){
Event e(EventPluginGetInfo, (void*)n);
pluginInfo *info = (pluginInfo*)e.process();
if (info == NULL) break;
if (info->info == NULL){
Event e(EventLoadPlugin, (char*)info->name.c_str());
e.process();
}
if ((info->info == NULL) || (info->info->title == NULL)) continue;
QString title = i18n(info->info->title);
new PluginItem(parentItem, title, info, n);
}
QFontMetrics fm(lstBox->font());
unsigned w = 0;
for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
w = QMAX(w, itemWidth(item, fm));
}
lstBox->setFixedWidth(w);
lstBox->setColumnWidth(0, w - 2);
if (id){
for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
if (setCurrentItem(item, id))
return;
}
}
lstBox->setCurrentItem(lstBox->firstChild());
}
示例9: itObject
void *StatusFrame::processEvent(Event *e)
{
CommandDef *cmd;
switch (e->type()){
case EventCheckState:
cmd = (CommandDef*)(e->param());
if ((cmd->menu_id == MenuStatusWnd) && (cmd->id == CmdStatusWnd)){
unsigned n = 0;
{
QObjectList *l = queryList("StatusLabel");
QObjectListIt itObject(*l);
QObject *obj;
while ((obj=itObject.current()) != NULL) {
++itObject;
StatusLabel *lbl = static_cast<StatusLabel*>(obj);
if (lbl->x() + lbl->width() > width())
n++;
}
delete l;
}
CommandDef *cmds = new CommandDef[n + 1];
memset(cmds, 0, sizeof(CommandDef) * (n + 1));
QObjectList *l = queryList("StatusLabel");
QObjectListIt itObject(*l);
QObject *obj;
n = 0;
while ((obj=itObject.current()) != NULL) {
++itObject;
StatusLabel *lbl = static_cast<StatusLabel*>(obj);
if (lbl->x() + lbl->width() > width()){
cmds[n].id = 1;
cmds[n].text = "_";
cmds[n].text_wrk = strdup(CorePlugin::m_plugin->clientName(lbl->m_client).utf8());
cmds[n].popup_id = lbl->m_id;
if (lbl->m_client->getState() == Client::Error){
cmds[n].icon = "error";
}else{
Protocol *protocol = lbl->m_client->protocol();
const CommandDef *cmd = protocol->description();
cmds[n].icon = cmd->icon;
for (cmd = protocol->statusList(); cmd->text; cmd++){
if (cmd->id == lbl->m_client->getStatus()){
cmds[n].icon = cmd->icon;
break;
}
}
}
n++;
}
}
delete l;
cmd->param = cmds;
cmd->flags |= COMMAND_RECURSIVE;
return e->param();
}
break;
case EventClientsChanged:
addClients();
break;
case EventClientChanged:{
StatusLabel *lbl = findLabel((Client*)(e->param()));
if (lbl)
lbl->setPict();
break;
}
case EventClientError:
if (isVisible()){
clientErrorData *data = (clientErrorData*)(e->param());
if (data->code == AuthError)
break;
StatusLabel *lbl = findLabel(data->client);
if (lbl == NULL)
break;
if (data->err_str && *data->err_str){
QString msg = i18n(data->err_str);
if (data->args)
msg = msg.arg(QString::fromUtf8(data->args));
raiseWindow(topLevelWidget());
BalloonMsg::message(msg, lbl);
return e->param();
}
}
break;
case EventIconChanged:{
QObjectList *l = queryList("StatusLabel");
QObjectListIt itObject(*l);
QObject *obj;
while ((obj=itObject.current()) != NULL) {
++itObject;
static_cast<StatusLabel*>(obj)->setPict();
}
delete l;
break;
}
}
return NULL;
}