本文整理汇总了C++中Host::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Host::isValid方法的具体用法?C++ Host::isValid怎么用?C++ Host::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::isValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetContents
void ServersComboBox::resetContents(const Host ¤t_host, bool caption, bool connection)
{
setUpdatesEnabled(false);
clear();
int sel = -1;
if (caption) {
addItem(tr("MPD Servers"));
}
std::vector<ServerItem> servers;
loadPresetServers(&servers);
for (int i = 0; i < (int)servers.size(); i++) {
int row = count();
QString text = servers[i].name;
addItem(text);
setItemData(row, text);
if (current_host == servers[i].host) {
sel = i;
}
}
if (sel < 0 && current_host.isValid()) {
QString text = makeServerText(current_host);
if (!text.isEmpty()) {
sel = count();
addItem(text);
}
}
if (connection) {
addItem(trConnect());
}
setCurrentIndex(sel);
setUpdatesEnabled(true);
}
示例2: makeServerText
QString ServersComboBox::makeServerText(const Host &host)
{
QString name;
name = host.address();
if (host.isValid()) {
if (name.indexOf(':') >= 0) {
name = '[' + name + ']';
}
name += ':' + QString::number(host.port());
}
return name;
}
示例3: while
QList<Host> Discover::parseProcessOutput(const QByteArray &processData)
{
m_reader.clear();
m_reader.addData(processData);
QList<Host> hosts;
while (!m_reader.atEnd() && !m_reader.hasError()) {
QXmlStreamReader::TokenType token = m_reader.readNext();
if(token == QXmlStreamReader::StartDocument)
continue;
if(token == QXmlStreamReader::StartElement && m_reader.name() == "host") {
Host host = parseHost();
if (host.isValid()) {
hosts.append(host);
}
}
}
return hosts;
}
示例4: GUIProc
//.........这里部分代码省略.........
case IDC_LOGDEBUG: // log debug
servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_DEBUG) : servMgr->showLog&~(1<<LogBuffer::T_DEBUG);
break;
case IDC_LOGERRORS: // log errors
servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_ERROR) : servMgr->showLog&~(1<<LogBuffer::T_ERROR);
break;
case IDC_LOGNETWORK: // log network
servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_NETWORK) : servMgr->showLog&~(1<<LogBuffer::T_NETWORK);
break;
case IDC_LOGCHANNELS: // log channels
servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_CHANNEL) : servMgr->showLog&~(1<<LogBuffer::T_CHANNEL);
break;
case IDC_CHECK9: // pause log
servMgr->pauseLog = getButtonState(wParam);
break;
case IDC_CHECK2: // start outgoing
if (getButtonState(IDC_CHECK2))
{
SendDlgItemMessage(hwnd, IDC_COMBO1,WM_GETTEXT, 128, (LONG)servMgr->connectHost);
servMgr->autoConnect = true;
//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Disconnect");
enableControl(IDC_COMBO1,false);
}else{
servMgr->autoConnect = false;
//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Connect");
enableControl(IDC_COMBO1,true);
}
break;
case IDC_BUTTON11: // broadcast
{
Host sh = servMgr->serverHost;
if (sh.isValid())
{
char cmd[256];
sprintf(cmd,"http://localhost:%d/admin?page=broadcast",sh.port);
ShellExecute(hwnd, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
}else{
MessageBox(hwnd,"Server is not currently connected.\nPlease wait until you have a connection.","PeerCast",MB_OK);
}
}
break;
case IDC_BUTTON8: // play selected
{
Channel *c = getListBoxChannel();
if (c){
chanMgr->playChannel(c->info);
}
}
break;
case IDC_BUTTON7: // advanced
sys->callLocalURL("admin?page=settings",servMgr->serverHost.port);
break;
case IDC_BUTTON6: // servent disconnect
{
/* Servent *s = (Servent *)getListBoxSelData(statusID);
if (s)
s->thread.active = false;*/
Servent *s = getListBoxServent();
if (s){
s->thread.active = false;
s->thread.finish = true;
}
sleep_skip = true;