QString Dymola::getExecutablePath() { QString path; #ifdef WIN32 HKEY hKey = 0; char buf[255] = {0}; DWORD dwType = 0; DWORD dwBufSize = sizeof(buf); QString subkey("SOFTWARE\\Classes\\Applications\\Dymola.exe\\shell\\Run\\command"); if( RegOpenKey(HKEY_LOCAL_MACHINE,VQTConvert::QString_To_LPCTSTR(subkey),&hKey) == ERROR_SUCCESS) { dwType = REG_SZ; if( RegQueryValueEx(hKey,NULL,NULL, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS) { path = QString(buf); } RegCloseKey(hKey); } path.remove("\""); path.remove("%1"); //path.remove(" "); #endif return path; }
void Kleo::SubkeyKeyListViewItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int alignment ) { const KeyListView::DisplayStrategy * ds = listView() ? listView()->displayStrategy() : 0 ; if ( !ds ) { QListViewItem::paintCell( p, cg, column, width, alignment ); return; } const QColor fg = ds->subkeyForeground( subkey(), cg.text() ); const QColor bg = ds->subkeyBackground( subkey(), cg.base() ); const QFont f = ds->subkeyFont( subkey(), p->font() ); QColorGroup _cg = cg; p->setFont( f ); _cg.setColor( QColorGroup::Text, fg ); _cg.setColor( QColorGroup::Base, bg ); QListViewItem::paintCell( p, _cg, column, width, alignment ); }
void keyboard(unsigned char key, int x, int y) { switch (key) { case 27: exit(0); break; default: subkey (&inputs, &root_sel, key); /* terminate input string, if need */ if (inputs.input) inputs.input[inputs.strlen] = '\0'; } glutPostRedisplay (); }
int RegistryMuninNodePlugin::GetConfig(char *buffer, int len) { CRegistry reg(m_RootKey, m_SubKey); reg.Check(); // reopen if reg is removed then added string graphTitle = reg.GetValue("graph_title", "Disk Time"); string graphCategory = reg.GetValue("graph_category", "system"); string graphArgs = reg.GetValue("graph_args", "--base 1000 -l 0"); string graphInfo = reg.GetValue("graph_info", "disk time"); string graphVlabel = reg.GetValue("graph_vlabel", "Disk Time"); int printCount; printCount = _snprintf(buffer, len, "graph_title %s\n" "graph_category %s\n" "graph_args %s\n" "graph_info %s\n" "graph_vlabel %s\n", graphTitle.c_str(), graphCategory.c_str(), graphArgs.c_str(), graphInfo.c_str(), graphVlabel.c_str() ); len -= printCount; buffer += printCount; vector<string> keys; reg.EnumKeys(keys); // for keys, add definition for(vector<string>::iterator it=keys.begin(); it!=keys.end(); ++it) { string subkey(m_SubKey); CRegistry sub_reg(m_RootKey, subkey.append("\\").append(*it)); string label = sub_reg.GetValue("label", "disk time"); string draw = sub_reg.GetValue("draw", "Disk Time"); printCount = _snprintf(buffer, len, "%s.label %s\n" "%s.draw %s\n", it->c_str(), label.c_str(), it->c_str(), draw.c_str() ); len -= printCount; buffer += printCount; } strncat(buffer, ".\n", len); return 0; }
bool wxRegKey::DoExport(wxOutputStream& ostr) const { // write out this key name if ( !WriteAsciiChar(ostr, '[') ) return false; if ( !WriteAsciiString(ostr, GetName(false /* no short prefix */)) ) return false; if ( !WriteAsciiChar(ostr, ']') || !WriteAsciiEOL(ostr) ) return false; // dump all our values long dummy; wxString name; wxRegKey& self = const_cast<wxRegKey&>(*this); bool cont = self.GetFirstValue(name, dummy); while ( cont ) { if ( !DoExportValue(ostr, name) ) return false; cont = GetNextValue(name, dummy); } // always terminate values by blank line, even if there were no values if ( !WriteAsciiEOL(ostr) ) return false; // recurse to subkeys cont = self.GetFirstKey(name, dummy); while ( cont ) { wxRegKey subkey(*this, name); if ( !subkey.DoExport(ostr) ) return false; cont = GetNextKey(name, dummy); } return true; }
int RegistryMuninNodePlugin::GetValues(char *buffer, int len) { CRegistry reg(m_RootKey, m_SubKey); vector<string> keys; reg.EnumKeys(keys); // for keys, add definition for(vector<string>::iterator it=keys.begin(); it!=keys.end(); ++it) { int printCount; string subkey(m_SubKey); CRegistry sub_reg(m_RootKey, subkey.append("\\").append(*it)); double v = sub_reg.GetValueF("value", 0.0); printCount = _snprintf(buffer, len, "%s.value %.2f\n", it->c_str(), v); len -= printCount; buffer += printCount; } strncat(buffer, ".\n", len); return 0; }
const QPixmap * Kleo::SubkeyKeyListViewItem::pixmap( int col ) const { return listView() && listView()->columnStrategy() ? listView()->columnStrategy()->subkeyPixmap( subkey(), col ) : 0 ; }
QString Kleo::SubkeyKeyListViewItem::toolTip( int col ) const { return listView() && listView()->columnStrategy() ? listView()->columnStrategy()->subkeyToolTip( subkey(), col ) : QString::null ; }