void CatBrowser::SetupQuery(void) { BString command, esccat = EscapeIllegalCharacters(fCategory.String()); CppSQLite3Query query; command = "select count(number) from "; command << esccat << ";"; query = DBQuery(command.String(), "CatBrowser::SetupQuery:get category count"); fCategoryCount = (query.eof()) ? 0 : query.getIntField(0); for(int32 i = 0; i < fPageList.CountItems(); i++) { QueryPage *page = (QueryPage*)fPageList.ItemAt(i); page->MakeEmpty(); } fPageCount = (fCategoryCount / BROWSE_MODE_RECIPE_COUNT); if( (fPageCount % BROWSE_MODE_RECIPE_COUNT) || fPageCount < BROWSE_MODE_RECIPE_COUNT) fPageCount++; if(fPageList.CountItems() < fPageCount) { for(int32 i = fPageList.CountItems(); i <= fPageCount; i++) fPageList.AddItem(new QueryPage()); } fCurrentPage = -1; }
/** * Ensures the current page is a query page that is ready to accept new * queries. * The function first checks the current page. If it is an unlocked query * page, then nothing needs to be done. Otherwise, it checks for the first * unlocked query page by iterating over all pages in the tab widget. If this * fails as well, a new query page is created. */ void QueryWidget::findQueryPage() { QueryPage* pPage; int nPages, i; // First check if the current page is an unlocked query page pPage = dynamic_cast<QueryPage*>(currentPage()); if (pPage != NULL) { if (!pPage->isLocked() && !pPage->isRunning()) return; } // Look for the first unlocked query page nPages = m_pQueryTabs->count(); for (i = 0; i < nPages; i++) { pPage = dynamic_cast<QueryPage*>(m_pQueryTabs->widget(i)); if (pPage != NULL) { if (!pPage->isLocked() && !pPage->isRunning()) { setCurrentPage(pPage); return; } } } // Couldn't find an unlocked query page, create a new one addQueryPage(); }
/** * Update the lock button when the current query page changes. * @param pWidget The new current page */ void QueryWidget::slotCurrentChanged(QWidget* pWidget) { QueryPage* pPage; pPage = (QueryPage*)pWidget; m_pLockAction->setChecked(pPage->isLocked()); }
/** * Selects the next query result record in the current query page. */ void QueryWidget::slotPrevResult() { QueryPage* pPage; // Select the next record in the current page pPage = dynamic_cast<QueryPage*>(currentPage()); if (pPage != NULL) pPage->selectPrev(); }
/** * Update the lock button when the current query page changes. * @param pWidget The new current page */ void QueryWidget::slotCurrentChanged(QWidget* pWidget) { QueryPage* pPage; // Return immediatly if last tab was removed if (!pWidget) return; pPage = (QueryPage*)pWidget; m_pLockAction->setChecked(pPage->isLocked()); }
/** * Reruns the query whose results are displayed in the current page. */ void QueryWidget::slotRefreshCurrent() { QueryPage* pPage; // Make sure the current page is a valid, non-empty one pPage = dynamic_cast<QueryPage*>(currentPage()); if (pPage == NULL) return; // Clear the current page contents pPage->refresh(); }
/** * Applies the user's colour and font preferences to all pages. */ void QueryWidget::applyPrefs() { QueryPage* pPage; int nPages, i; // Iterate query pages nPages = m_pQueryTabs->count(); for (i = 0; i < nPages; i++) { pPage = (QueryPage*)m_pQueryTabs->widget(i); pPage->applyPrefs(); setPageCaption(pPage); } }
/** * Stores all pages marked for saving into files in the project directory. * @param sProjPath The full path of the project directory * @param slFiles Holds a list of query file names, upon return */ void QueryWidget::savePages(const QString& sProjPath, QStringList& slFiles) { int nPageCount, i; QueryPage* pPage; QString sFileName; // Iterate pages nPageCount = m_pQueryTabs->count(); for (i = 0; i < nPageCount; i++) { pPage = (QueryPage*)m_pQueryTabs->widget(i); if (pPage->shouldSave()) { // Store this query page if (pPage->save(sProjPath, sFileName) && !sFileName.isEmpty()) slFiles.append(sFileName); } } }
void Homepage::sltCx() { if(g_transaction && !g_transaction->networkIsNormal()) { YGMsgBox* box = Utility::msgBox(YGMsgBox::MsgType_Err, trUtf8("错误"), trUtf8("网络出现故障,请稍后再试."), this); box->show(); return; } if(!checkTerminalConfig()) { return; } QueryPage *query = new QueryPage(g_home); query->show(); //Utility::pushPage(PageType_QueryPage, query); g_pageInfo.push(PageInfo(PageType_QueryPage, query)); }
/** * Runs a query in a query page. * A query page is first selected, with a new one created if required. The * method then creates a Cscope process and runs the query. * @param nType The query's numeric type code * @param sText The query's text, as entered by the user */ void QueryWidget::initQuery(uint nType, const QString& sText) { QueryPage* pPage; // Make sure we have a query page findQueryPage(); pPage = (QueryPage*)currentPage(); // Use the current page, or a new page if the current one is locked if (pPage->isLocked()) { addQueryPage(); pPage = (QueryPage*)currentPage(); } // Reset the page's results list pPage->clear(); pPage->query(nType, sText); // Set the page's tab text according to the new query setPageCaption(pPage); }
/** * Reruns the query whose results are displayed in the current page. */ void QueryWidget::slotRefreshCurrent() { QueryPage* pPage; uint nType; QString sText; // Make sure the current page is a valid, non-empty one pPage = dynamic_cast<QueryPage*>(currentPage()); if ((pPage == NULL) || (pPage->getQueryType() == CscopeFrontend::None)) { return; } // Get the current page parameters (before they are deleted by clear()) nType = pPage->getQueryType(); sText = pPage->getQueryText(); // Clear the current page contents pPage->clear(); pPage->query(nType, sText); }
void Utility::popPage() { int top0 = g_pageInfo.top().type; g_pageInfo.pop(); PageInfo info = g_pageInfo.top(); if(top0 == PageType_None) { if(info.type != PageType_None) { return; } else { g_timer = g_pageInfo.top().pWgt->timerLabel(); } } switch(info.type) { case PageType_CourierLogIn: { LoginPage *login = new LoginPage(LoginPage::Courier_In ,g_home); login->show(); g_pageInfo.top().pWgt = login; break; } case PageType_CourierPage: { CourierPage *courierPage = new CourierPage(g_home); courierPage->show(); g_pageInfo.top().pWgt = courierPage; break; } case PageType_CourierVerifyPage: { CourierVerifyPage *page = new CourierVerifyPage(g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_CourierInPage: { CourierInPage *page = new CourierInPage(false, g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_FastCourierInPage: { CourierInPage *page = new CourierInPage(true, g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_CabinetPage: { // CabinetPage *cabinetPage = new CabinetPage(g_transaction->courier().type, g_home); // cabinetPage->show(); // g_pageInfo.top().pWgt = cabinetPage; // 无需处理; break; } case PageType_CourierInDoorOperatePage: { // 无需处理; break; } case PageType_CourierRechargePayPage: { break; } case PageType_FetchPage: { FetchPage *fetch = new FetchPage(g_home); fetch->show(); g_pageInfo.top().pWgt = fetch; break; } case PageType_WechatQrcFetchPage: { WechatQrcFetchPage *page = new WechatQrcFetchPage(g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_AppQrcFetchPage: { AppQrCodeFetchPage *page = new AppQrCodeFetchPage(g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_ValidCodeFetchPage: { LoginPage *login = new LoginPage(LoginPage::Receiver_Out ,g_home); login->show(); g_pageInfo.top().pWgt = login; break; } case PageType_QueryPage: { QueryPage *query = new QueryPage(g_home); query->show(); g_pageInfo.top().pWgt = query; break; } case PageType_MailingPage: { MailPage *page = new MailPage(g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_ReceiverOutDoorOperatePage: { // DoorOperateDlg *page = new DoorOperateDlg(DoorOperateDlg::DoorOperateType_ReceiverOut, g_home); // page->show(); // g_pageInfo.top().pWgt = page; break; } case PageType_ChangePasswdPage: { ModifyPasswdPage *page = new ModifyPasswdPage(g_home); page->show(); g_pageInfo.top().pWgt = page; break; } case PageType_None: { info.pWgt->resetTimerLbl(); break; } case PageType_SignupPage: { SignupPage *signupPage = new SignupPage(g_home); signupPage->show(); g_pageInfo.top().pWgt = signupPage; break; } case PageType_Help: { HelpPage *helpPage = new HelpPage(g_home); helpPage->show(); g_pageInfo.top().pWgt = helpPage; } case PageType_Homepage: { break; } case PageType_LjHelp: { YGWidget * wgt =Utility::addImageWgt(QSize(GL_WIDTH, GL_HEIGHT), QPoint(0,0), g_appPath + "/data/pic/mailing/mailingpostinstruction.jpg", g_appPath + "/data/piceng/mailing/mailingpostinstruction.jpg", g_home); g_pageInfo.top().pWgt = wgt; break; } case PageType_JjHelp: { YGWidget * wgt = Utility::addImageWgt(QSize(GL_WIDTH, GL_HEIGHT), QPoint(0,0), g_appPath + "/data/pic/mailing/mailinginstruction.jpg", g_appPath + "/data/piceng/mailing/mailinginstruction.jpg", g_home); g_pageInfo.top().pWgt = wgt; break; } default: break; } }