void Schema::populateSchemaViews() { foreach (View *view, getViewList()) delete view; this->view_list.clear(); QList<View*> view_list; QSqlQuery *view_query = new QSqlQuery(parent_database->getDatabaseConnection()); QString view_query_string = "SELECT 1, viewname FROM pg_views WHERE schemaname='"+this->getName()+"' ORDER BY 1,2"; view_query->exec(view_query_string); setViewCount(view_query->size()); if(view_query->lastError().isValid()) { QMessageBox *error_message = new QMessageBox(QMessageBox::Critical, tr("Database error"), tr("Unable to retrieve schema views.\n" "Check your database connection or permissions.\n"), QMessageBox::Cancel,0,Qt::Dialog); error_message->setWindowModality(Qt::NonModal); error_message->show(); return; } while (view_query->next()) { QString view_name = view_query->value(1).toString(); View *view; if(view_query->value(0).toInt() == 1) { view = new View(parent_database, this, view_name, view_list.size(), QColor(100,50,50)); } else { return; } view->setSearched(true); if(mainwin->isColumnView()) view->verticalPosition2(); else view->defaultPosition(); QObject::connect(mainwin->getSearchBox(), SIGNAL(textChanged(QString)), view, SLOT(getSearchTerm(QString))); QObject::connect(mainwin, SIGNAL(showColumnView()), view, SLOT(verticalPosition2())); QObject::connect(view, SIGNAL(expandView(Database *, Schema *, View*)), mainwin, SLOT(showViewView(Database *, Schema *, View*))); QObject::connect(view, SIGNAL(dropView(Database *, Schema *, View*)), mainwin, SLOT(dropView(Database *, Schema *, View*))); view_list.append(view); if(!mainwin->view_completer_list.contains(view_name)) mainwin->view_completer_list.append(view_name); } setViewList(view_list); }
void PluginVideo::loadVideo(const QString &service, const QVariantMap &video) { setService(service); setDate(video.value("date").toString()); setDescription(video.value("description").toString()); setDownloadable(video.value("downloadable", true).toBool()); setDuration(video.value("duration").toString()); setId(video.value("id").toString()); setLargeThumbnailUrl(video.value("largeThumbnailUrl").toString()); setStreamUrl(video.value("streamUrl").toString()); setThumbnailUrl(video.value("thumbnailUrl").toString()); setTitle(video.value("title").toString()); setUrl(video.value("url").toString()); setUserId(video.value("userId").toString()); setUsername(video.value("username").toString()); setViewCount(video.value("viewCount").toLongLong()); }
void DXFrame::reSize(HWND& hWnd, HINSTANCE& hInst,bool bWindowed) { IDirect3DDevice9* tempDevice = 0; m_bFullScreen = bWindowed; m_hWnd = hWnd; //get window size RECT rect; GetWindowRect(hWnd, &rect); w_width = rect.right - rect.left; w_height = rect.bottom - rect.top; // Set D3D Device presentation parameters before creating the device D3DPRESENT_PARAMETERS D3Dpp; ZeroMemory(&D3Dpp, sizeof(D3Dpp)); // NULL the structure's memory D3Dpp.hDeviceWindow = hWnd; // Handle to the focus window D3Dpp.Windowed = bWindowed; // Windowed or Full-screen boolean D3Dpp.AutoDepthStencilFormat = D3DFMT_D24S8; // Format of depth/stencil buffer, 24 bit depth, 8 bit stencil D3Dpp.EnableAutoDepthStencil = TRUE; // Enables Z-Buffer (Depth Buffer) D3Dpp.BackBufferCount = 1; // Change if need of > 1 is required at a later date D3Dpp.BackBufferFormat = D3DFMT_X8R8G8B8; // Back-buffer format, 8 bits for each pixel D3Dpp.BackBufferHeight = w_height; // Make sure resolution is supported, use adapter modes D3Dpp.BackBufferWidth = w_width; // (Same as above) D3Dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // Discard back-buffer, must stay discard to support multi-sample D3Dpp.PresentationInterval = m_bVsync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE; // Present back-buffer immediately, unless V-Sync is on D3Dpp.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; // This flag should improve performance, if not set to NULL. D3Dpp.FullScreen_RefreshRateInHz = bWindowed ? 0 : D3DPRESENT_RATE_DEFAULT; // Full-screen refresh rate, use adapter modes or default D3Dpp.MultiSampleQuality = 0; // MSAA currently off, check documentation for support. D3Dpp.MultiSampleType = D3DMULTISAMPLE_NONE; // MSAA currently off, check documentation for support. // Check device capabilities DWORD deviceBehaviorFlags = 0; m_pD3DObject->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_D3DCaps); // Determine vertex processing mode if(m_D3DCaps.DevCaps & D3DCREATE_HARDWARE_VERTEXPROCESSING) { // Hardware vertex processing supported? (Video Card) deviceBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING; } else { // If not, use software (CPU) deviceBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; } // If hardware vertex processing is on, check pure device support if(m_D3DCaps.DevCaps & D3DDEVCAPS_PUREDEVICE && deviceBehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING) { deviceBehaviorFlags |= D3DCREATE_PUREDEVICE; } m_pD3DObject->CreateDevice( D3DADAPTER_DEFAULT, // which adapter to use, set to primary D3DDEVTYPE_HAL, // device type to use, set to hardware rasterization hWnd, // handle to the focus window deviceBehaviorFlags, // behavior flags &D3Dpp, // presentation parameters &tempDevice); // returned device pointer //delete old device stuff and replace it with new stuff if(tempDevice) { m_pD3DLine->Release(); m_pD3DLine = 0; m_pD3DSprite->Release(); m_pD3DSprite = 0; m_pD3DFont->Release(); m_pD3DSprite = 0; m_pD3DDevice->Release(); m_pD3DDevice = tempDevice; // Create a Font Object D3DXCreateFont(m_pD3DDevice,30,0,FW_BOLD,0,false,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,DEFAULT_PITCH | FF_DONTCARE, TEXT("Times New Roman"),&m_pD3DFont); // Create Sprite Object and Textures D3DXCreateSprite(m_pD3DDevice, &m_pD3DSprite); //create line object D3DXCreateLine(m_pD3DDevice,&m_pD3DLine); m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE ); m_pD3DDevice->SetRenderState(D3DRS_SPECULARENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(60, 60, 60)); m_pD3DDevice->SetRenderState(D3DRS_NORMALIZENORMALS, true); m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); m_bLost = false; m_pD3DDevice->GetViewport(&defaultView); m_pD3DDevice->SetViewport(&defaultView); setViewCount(numViewPorts); m_pD3DDevice->Reset(&D3Dpp); } else m_bLost = true; }