bool QUiBuilder::InitializeLoader( QString strUiResName, QWidget* pkParent, QString strPluginPath ) { if ( !pkParent ) { return false; } QUiLoader kLoader; if ( false == strPluginPath.isEmpty() ) { kLoader.addPluginPath( strPluginPath ); } QFile kFile( strUiResName ); if( !kFile.open( QFile::ReadOnly ) ) { return false; } m_pkLoadedWidget = kLoader.load( &kFile, pkParent ); if ( !m_pkLoadedWidget ) { return false; } kFile.close(); return true; }
bool ElTerrain::setHeightMap(LPCTSTR filename) { mHeightMap.assign(mNumVertex); memset((void*)mHeightMap.base(), 0, sizeof(unsigned char) * mNumVertex); std::ifstream kFile(filename, std::ios_base::binary); if (!kFile.good()) return false; kFile.read((char*)mHeightMap.base(), mNumVertex); kFile.close(); // cause the height map has been re-assigned, we should rebuild vertices buildVertices(); if (mLod) buildQuadTreeBound(); return true; }
Installer::Installer(QWidget *parent) : QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint) { setupUi(this); //Setup the window if(!DEBUG){ this->setGeometry( QApplication::primaryScreen()->geometry() ); }//full screen else{ this->setWindowFlags(Qt::Window); } //don't keep on bottom/frameless for testing translator = new QTranslator(); connect(backButton, SIGNAL(clicked()), this, SLOT(slotBack())); connect(nextButton, SIGNAL(clicked()), this, SLOT(slotNext())); connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); connect(pushTouchKeyboard, SIGNAL(clicked()), this, SLOT(slotPushVirtKeyboard())); connect(pushChangeKeyLayout, SIGNAL(clicked()), this, SLOT(slotPushKeyLayout())); connect(lineHostname,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckHost())); connect(lineDomainName, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckDomainName()) ); connect(lineRootPW, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW())); connect(lineRootPW2, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW())); connect(lineName,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(lineName,SIGNAL(editingFinished()),this,SLOT(slotSuggestUsername())); connect(lineUsername,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(linePW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(linePW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(line_PCpass, SIGNAL(textChanged(const QString)), this, SLOT(slotCheckUser())) ; connect(line_PCpass_repeat, SIGNAL(textChanged(const QString)), this, SLOT(slotCheckUser())) ; connect(group_usePC, SIGNAL(toggled(bool)), this, SLOT(slotCheckUser()) ); connect(push_PC_device, SIGNAL(clicked()), this, SLOT(slotGetPCDevice()) ); connect(tool_testAudio, SIGNAL(clicked()), this, SLOT(slotPlayAudioTest()) ); connect(slider_volume, SIGNAL(valueChanged(int)), this, SLOT(slotAudioVolumeChanged()) ); connect(combo_audiodevice, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetAudioDev()) ); backButton->setText(tr("&Back")); nextButton->setText(tr("&Next")); // Load the keyboard info keyModels = Scripts::Backend::keyModels(); keyLayouts = Scripts::Backend::keyLayouts(); // If we have a saved keyboard layout from installation, use it first QString kD; if ( QFile::exists("/var/.wizardKeyboard") ) { QFile kFile("/var/.wizardKeyboard"); if ( kFile.open(QIODevice::ReadOnly | QIODevice::Text) ) { kD = kFile.readLine().simplified(); kFile.close(); kbMod = kD.section(" ", 0, 0); kbLay = kD.section(" ", 1, 1); kbVar = kD.section(" ", 2, 2); Scripts::Backend::changeKbMap(kbMod, kbLay, kbVar); } } // Load the timezones comboBoxTimezone->clear(); QString curZone = Scripts::Backend::guessTimezone(); comboBoxTimezone->addItems(Scripts::Backend::timezones()); if ( ! curZone.isEmpty() ) { int index = comboBoxTimezone->findText(curZone, Qt::MatchStartsWith); if (index != -1) { comboBoxTimezone->setCurrentIndex(index); } else { // Set America/New_York to default index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith); if (index != -1) comboBoxTimezone->setCurrentIndex(index); } } else { // Set America/New_York to default int index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith); if (index != -1) comboBoxTimezone->setCurrentIndex(index); } // Load the hostname lineHostname->setText(pcbsd::Utils::getConfFileValue("/etc/rc.conf", "hostname=", 1).section(".",0,0)); // Load the domain name lineDomainName->setText(pcbsd::Utils::getConfFileValue("/etc/rc.conf", "hostname=",1).section(".",1,100)); //Load the available Services into the UI LoadServices(); // Start on the first screen installStackWidget->setCurrentIndex(0); backButton->setVisible(false); // Update the status bar // This makes the status text more "visible" instead of using the blue background //statusBar()->setStyleSheet("background: white"); //Load the audio settings values combo_audiodevice->clear(); QStringList devs = pcbsd::Utils::runShellCommand("pc-sysconfig list-audiodev").join("").split(", "); int def = -1; bool found = false; for(int i=0; i<devs.length(); i++){ combo_audiodevice->addItem(devs[i], devs[i].section(":",0,0)); //<full text>, <pcmID> if(devs[i].contains(" default")){ found = true; def = i; } } if(def<0 && !devs.isEmpty()){ def=0; } if(def<0){ //No audio devices found - disable this functionality Page_Audio->setEnabled(false); //just do the whole page - nothing will work }else{ combo_audiodevice->setCurrentIndex(def); //make sure this item is initially selected if(!found){ slotSetAudioDev(); } //make sure to run the setup command initially } slider_volume->setValue(100); slotAudioVolumeChanged(); //update the volume % label }
Installer::Installer(QWidget *parent) : QMainWindow(parent) { setupUi(this); translator = new QTranslator(); connect(backButton, SIGNAL(clicked()), this, SLOT(slotBack())); connect(nextButton, SIGNAL(clicked()), this, SLOT(slotNext())); connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); connect(pushTouchKeyboard, SIGNAL(clicked()), this, SLOT(slotPushVirtKeyboard())); connect(pushChangeKeyLayout, SIGNAL(clicked()), this, SLOT(slotPushKeyLayout())); connect(lineHostname,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckHost())); connect(lineRootPW, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW())); connect(lineRootPW2, SIGNAL(textChanged ( const QString &)), this, SLOT(slotCheckRootPW())); connect(lineName,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(lineName,SIGNAL(editingFinished()),this,SLOT(slotSuggestUsername())); connect(lineUsername,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(linePW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); connect(linePW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckUser())); backButton->setText(tr("&Back")); nextButton->setText(tr("&Next")); // Load the keyboard info keyModels = Scripts::Backend::keyModels(); keyLayouts = Scripts::Backend::keyLayouts(); // If we have a saved keyboard layout from installation, use it first QString kD; if ( QFile::exists("/var/.wizardKeyboard") ) { QFile kFile("/var/.wizardKeyboard"); if ( kFile.open(QIODevice::ReadOnly | QIODevice::Text) ) { kD = kFile.readLine().simplified(); kFile.close(); kbMod = kD.section(" ", 0, 0); kbLay = kD.section(" ", 1, 1); kbVar = kD.section(" ", 2, 2); Scripts::Backend::changeKbMap(kbMod, kbLay, kbVar); } } // Load the timezones comboBoxTimezone->clear(); QString curZone = Scripts::Backend::guessTimezone(); comboBoxTimezone->addItems(Scripts::Backend::timezones()); if ( ! curZone.isEmpty() ) { int index = comboBoxTimezone->findText(curZone, Qt::MatchStartsWith); if (index != -1) comboBoxTimezone->setCurrentIndex(index); } else { // Set America/New_York to default int index = comboBoxTimezone->findText("America/New_York", Qt::MatchStartsWith); if (index != -1) comboBoxTimezone->setCurrentIndex(index); } // Load the hostname lineHostname->setText(pcbsd::Utils::getConfFileValue("/etc/rc.conf", "hostname=", 1)); // Start on the first screen installStackWidget->setCurrentIndex(0); backButton->setVisible(false); // Update the status bar // This makes the status text more "visible" instead of using the blue background statusBar()->setStyleSheet("background: white"); }
void Compile(VeChar8* pcFileName, VeChar8* pcDstDir) { VeChar8* pcFile = VeStrrchr(pcFileName, '/'); VeSizeT stNum = pcFile - pcFileName; VeChar8 acBuffer[2048]; VeMemcpy(acBuffer, pcFileName, stNum); acBuffer[stNum] = 0; ++pcFile; VeFileDir kFile(acBuffer); VeChar8* pcContent; VeChar8* pcTemp = VeStrtok(pcDstDir, "/", &pcContent); VE_ASSERT(pcTemp && *pcTemp); VeFileDir kDstFile(pcTemp); pcTemp = VeStrtok(NULL, "/", &pcContent); while(pcTemp && *pcTemp) { kDstFile.Change(pcTemp); pcTemp = VeStrtok(NULL, "/", &pcContent); } VeBinaryIStreamPtr spStream = kFile.OpenSync(pcFile); VE_ASSERT(spStream); VeXMLDocument kDoc; (*spStream) >> kDoc; VE_ASSERT(!kDoc.Error()); VeXMLElement* pkRoot = kDoc.RootElement(); VeXMLElement* pkGroup = pkRoot->FirstChildElement("Group"); while(pkGroup) { VeXMLElement* pkShader = pkGroup->FirstChildElement(); while(pkShader) { const VeChar8* pcName = pkShader->Value(); const VeChar8* pcSrc = pkShader->GetAttribute("src"); const VeChar8* pcEntry = pkShader->GetAttribute("entry"); VeStringA kFile(acBuffer); kFile += '/'; kFile += pcSrc; VeVector<const VeChar8*> kProfileList; VeXMLElement* pkProfile = pkShader->FirstChildElement("Profile"); while(pkProfile) { const VeChar8* pcProfile = pkProfile->GetAttribute("value"); kProfileList.PushBack(pcProfile); pkProfile = pkProfile->NextSiblingElement("Profile"); } VeVector<D3D_SHADER_MACRO> kMacroList; VeXMLElement* pkMacro = pkShader->FirstChildElement("Macro"); while(pkMacro) { D3D_SHADER_MACRO kMac; kMac.Name = pkMacro->GetAttribute("name"); kMac.Definition = pkMacro->GetAttribute("define"); kMacroList.PushBack(kMac); pkMacro = pkMacro->NextSiblingElement("Macro"); } D3D_SHADER_MACRO kLast = {NULL, NULL}; kMacroList.PushBack(kLast); for(VeVector<const VeChar8*>::iterator it = kProfileList.Begin(); it != kProfileList.End(); ++it) { HRESULT hRes = S_OK; ID3DBlob* pkOut; ID3DBlob* pkErrorBlob; hRes = D3DX11CompileFromFile(kFile, kMacroList.Begin(), NULL, pcEntry, *it, D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_OPTIMIZATION_LEVEL3 | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR, 0, NULL, &pkOut, &pkErrorBlob, NULL); if(VE_FAILED(hRes)) { if(pkErrorBlob) { VE_LOG_EString("HLSLComplier", (VeChar8*)pkErrorBlob->GetBufferPointer()); } } else { VeStringA kOutputName(pcName); kOutputName += '.'; kOutputName += *it; VeMemoryOStreamPtr spOutputStream = VE_NEW VeMemoryOStream(); spOutputStream->AddBlob(pkOut->GetBufferPointer(), pkOut->GetBufferSize()); kDstFile.WriteAsync(kOutputName, spOutputStream, g_kWriteDelegate); } VE_SAFE_RELEASE(pkOut); VE_SAFE_RELEASE(pkErrorBlob); } pkShader = pkShader->NextSiblingElement(); } pkGroup = pkGroup->NextSiblingElement("Group"); } }