MCPcopy Create free account
hub / github.com/baldurk/renderdoc / FillRemotesMenu

Method FillRemotesMenu

qrenderdoc/Windows/MainWindow.cpp:1937–1992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1935}
1936
1937void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost)
1938{
1939 menu->clear();
1940
1941 rdcarray<RemoteHost> hosts = m_Ctx.Config().GetRemoteHosts();
1942
1943 int idx = 1;
1944
1945 for(int i = 0; i < hosts.count(); i++)
1946 {
1947 RemoteHost host = hosts[i];
1948
1949 // add localhost at the end, skip invalid hosts
1950 if(host.IsLocalhost() || !host.IsValid())
1951 continue;
1952
1953 QAction *action = new QAction(menu);
1954
1955 action->setIcon(host.IsServerRunning() && !host.IsVersionMismatch() ? Icons::tick()
1956 : Icons::cross());
1957 if(host.IsConnected())
1958 action->setText(tr("%1 (Connected)").arg(host.Name()));
1959 else if(host.IsServerRunning() && host.IsVersionMismatch())
1960 action->setText(tr("%1 (%2)").arg(host.Name(), host.VersionMismatchError()));
1961 else if(host.IsServerRunning() && host.IsBusy())
1962 action->setText(tr("%1 (Busy)").arg(host.Name()));
1963 else if(host.IsServerRunning())
1964 action->setText(tr("%1 (Online)").arg(host.Name()));
1965 else
1966 action->setText(tr("%1 (Offline)").arg(host.Name()));
1967
1968 action->setText(lit("%1: %2").arg(idx++).arg(action->text()));
1969
1970 QObject::connect(action, &QAction::triggered, this, &MainWindow::switchContext);
1971 action->setData(i);
1972
1973 // don't allow switching to the connected host
1974 if(host.IsConnected())
1975 action->setEnabled(false);
1976
1977 menu->addAction(action);
1978 }
1979
1980 if(includeLocalhost)
1981 {
1982 QAction *localContext = new QAction(menu);
1983
1984 localContext->setText(tr("Local"));
1985 localContext->setIcon(Icons::house());
1986
1987 QObject::connect(localContext, &QAction::triggered, this, &MainWindow::switchContext);
1988 localContext->setData(-1);
1989
1990 menu->addAction(localContext);
1991 }
1992}
1993
1994void MainWindow::setRemoteHost(int hostIdx)

Callers

nothing calls this directly

Calls 15

tickFunction · 0.85
connectFunction · 0.85
NameMethod · 0.80
trFunction · 0.50
clearMethod · 0.45
GetRemoteHostsMethod · 0.45
ConfigMethod · 0.45
countMethod · 0.45
IsValidMethod · 0.45
setIconMethod · 0.45
IsServerRunningMethod · 0.45
IsVersionMismatchMethod · 0.45

Tested by

no test coverage detected