SearchDlg::SearchDlg(QWidget *parent) : QDialog(parent), ui(new Ui::SearchDlg) { ui->setupUi(this); Qt::WindowFlags flags=Qt::Dialog; flags |=Qt::WindowMinimizeButtonHint |Qt::WindowMaximizeButtonHint; setWindowFlags(flags); this->setWindowTitle(LOCAL("查找用户")); itemModel_ = new QStandardItemModel(0,4,this); itemModel_->setHeaderData(0,Qt::Horizontal,LOCAL("财政通行证账号")); itemModel_->setHeaderData(1,Qt::Horizontal,LOCAL("姓名")); itemModel_->setHeaderData(2,Qt::Horizontal,LOCAL("用户名")); itemModel_->setHeaderData(3,Qt::Horizontal,tr("Email")); ui->treeView->setColumnWidth(0,250); ui->treeView->setColumnWidth(1,100); ui->treeView->setColumnWidth(2,100); ui->treeView->setColumnWidth(3,200); ui->treeView->setModel(itemModel_); ui->pushButton_AddContact->setEnabled(false); //flag_search = 0; connect(ui->treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(treeClick(QModelIndex))); connect(ui->pushButton_find,SIGNAL(clicked()),this,SLOT(btnSearchClick())); connect(ui->pushButton_AddContact,SIGNAL(clicked()),this,SLOT(addContactClick())); //connect(ui->radioButton_id, SIGNAL(clicked(bool)), this, SLOT(slotchangeID())); //connect(ui->radioButton_name, SIGNAL(clicked(bool)), this, SLOT(slotchangeName())); bool check; check= connect(Listwindow::Instance(),SIGNAL(handleSearch(QString)),this,SLOT(handleSearch(QString))); check = connect(this, SIGNAL(addnewfreind(QString)), Listwindow::Instance(), SLOT(slotaddnew(QString))); Q_ASSERT(check); type_ = AddContact; }
QtMUCSearchWindow::QtMUCSearchWindow() { ui_.setupUi(this); #ifndef Q_OS_MAC setWindowIcon(QIcon(":/logo-icon-16.png")); #endif setModal(true); ui_.filter_->hide(); model_ = new MUCSearchModel(); delegate_ = new MUCSearchDelegate(); ui_.results_->setModel(model_); ui_.results_->setItemDelegate(delegate_); ui_.results_->setHeaderHidden(true); ui_.results_->setRootIsDecorated(true); ui_.results_->setAnimated(true); ui_.results_->setAlternatingRowColors(true); connect(ui_.searchButton, SIGNAL(clicked()), this, SLOT(handleSearch())); connect(ui_.service_, SIGNAL(activated(const QString&)), this, SLOT(handleSearch(const QString&))); connect(ui_.results_->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)), this, SLOT(handleSelectionChanged (const QItemSelection&, const QItemSelection&))); connect(ui_.results_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleActivated(const QModelIndex&))); connect(ui_.results_, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleActivated(const QModelIndex&))); // Not using a button box, because i can't seem to be able to make the ok button non-default (on mac) connect(ui_.okButton, SIGNAL(clicked()), this, SLOT(accept())); ui_.okButton->setEnabled(false); connect(ui_.cancelButton, SIGNAL(clicked()), this, SLOT(reject())); throbber_ = new QLabel(tr("Searching"), ui_.results_); throbber_->setMovie(new QMovie(":/icons/throbber.gif", QByteArray(), throbber_)); throbber_->setToolTip(tr("Searching")); hasHadScrollBars_ = false; updateThrobberPosition(); setSearchInProgress(false); }
void FollowingOrder::run(Bottle args/*=Bottle()*/) { yInfo() << "FollowingOrder::run"; Bottle* sens = sensation_port_in.read(); string action = sens->get(0).asString(); string type; string target; if (sens->size()>0) type = sens->get(1).asString(); if (sens->size()>1) target = sens->get(2).asString(); yDebug() << action; yDebug() << type; yInfo() << target; if (target != "none"){ yInfo() << "there are elements to search!!!";//<<endl; finding = handleSearch(type, target); } if (action == "point"){ // Be carfull: both handlePoint (point in response of a human order) and handlePointing (point what you know) if (sens->size()<2){ yInfo()<<"I can't point if you don't tell me the objects"; iCub->say("I can't point if you don't tell me the objects"); }else{ pointing = handlePoint(type, target); yInfo() << "pointing elements to point!!!";//<<endl; yDebug() << finding;// << endl; } }else if (action == "look at"){ if (sens->size()<2){ yInfo()<<"I can't look if you don't tell me the objects"; iCub->say("I can't look if you don't tell me the objects"); }else{ handleLook(type, target); yInfo() << "looking elements to look at!!!";//<<endl; yDebug() << finding;// << endl; } }else if (action == "push"){ if (sens->size()<2){ yInfo()<<"I can't push if you don't tell me the objects"; iCub->say("I can't push if you don't tell me the objects"); }else{ //handlePush(type, target); //Feature under development yInfo() << "pushing elements to look at!!!";//<<endl; yDebug() << finding;// << endl; } }else if (action == "narrate"){ handleNarrate(); yInfo() << "narrating!!!";//<<endl; yDebug() << finding;// << endl; } }
void TouchingOrder::run(Bottle args/*=Bottle()*/) { yInfo() << "TouchingOrder::run"; string type = sensation_port_in.read()->get(0).asString(); string target = sensation_port_in.read()->get(1).asString(); yInfo() << target; if (target != "none"){ handleSearch(type, target); handleTouch(type, target); } }
QtJoinMUCWindow::QtJoinMUCWindow(UIEventStream* uiEventStream) : uiEventStream(uiEventStream) { ui.setupUi(this); #if QT_VERSION >= 0x040700 ui.room->setPlaceholderText(tr("*****@*****.**")); #endif connect(ui.room, SIGNAL(returnPressed()), this, SLOT(handleJoin())); connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(handleSearch())); connect(ui.joinButton, SIGNAL(clicked()), this, SLOT(handleJoin())); // FIXME: Temporarily set focus on the nickName field first, so that the // placeholder for the room is visible. This is just because Qt hides // the placeholder when a widget is focused for some reason. ui.nickName->setFocus(); ui.instantRoom->setChecked(true); ui.nickName->setValidator(new NickValidator(this)); }
bool PediaMainForm::handleControlSelect(const EventType& event) { switch (event.data.ctlSelect.controlID) { case doneButton: application().runMainForm(); return true; case searchButton: handleSearch(); return true; default: assert(false); } return false; }
LRESULT AutoSearchFrame::onContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if(reinterpret_cast<HWND>(wParam) == ctrlAutoSearch) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; OMenu asMenu; asMenu.CreatePopupMenu(); CRect rc; ctrlAutoSearch.GetHeader().GetWindowRect(&rc); if (PtInRect(&rc, pt)) { return 0; } if(pt.x == -1 && pt.y == -1) { WinUtil::getContextMenuPos(ctrlAutoSearch, pt); } int enable = ctrlAutoSearch.GetSelectedCount() == 1 ? MFS_ENABLED : MFS_DISABLED; auto index = WinUtil::getFirstSelectedIndex(ctrlAutoSearch); if(ctrlAutoSearch.GetSelectedCount() > 1) { asMenu.appendItem(TSTRING(ENABLE_AUTOSEARCH), [=] { handleState(false); }); asMenu.appendItem(TSTRING(DISABLE_AUTOSEARCH), [=] { handleState(true); }); asMenu.appendSeparator(); } else if(ctrlAutoSearch.GetSelectedCount() == 1) { asMenu.appendItem(TSTRING(SEARCH), [=] { handleSearch(true); }); asMenu.appendItem(TSTRING(SEARCH_FOREGROUND), [=] { handleSearch(false); }); asMenu.appendSeparator(); if(ctrlAutoSearch.GetCheckState(index) == 1) { asMenu.appendItem(TSTRING(DISABLE_AUTOSEARCH), [=] { handleState(true); }); } else { asMenu.appendItem(TSTRING(ENABLE_AUTOSEARCH), [=] { handleState(false); }); } asMenu.appendSeparator(); } if (ctrlAutoSearch.GetSelectedCount() > 0) { auto groups = AutoSearchManager::getInstance()->getGroups(); if (!groups.empty()) { OMenu* groupsMenu = asMenu.createSubMenu(_T("Move to group")); groupsMenu->appendItem(_T("---"), [=] { handleMoveToGroup(Util::emptyString); }); for (auto grp : groups) { groupsMenu->appendItem(Text::toT(grp), [=] { handleMoveToGroup(grp); }); } asMenu.appendSeparator(); } } asMenu.AppendMenu(MF_STRING, IDC_ADD, CTSTRING(ADD)); asMenu.AppendMenu(MF_STRING, IDC_CHANGE, CTSTRING(SETTINGS_CHANGE)); asMenu.AppendMenu(MF_STRING, IDC_DUPLICATE, CTSTRING(DUPLICATE)); tstring title; if (ctrlAutoSearch.GetSelectedCount() == 1) { BundleList bundles; AutoSearch::FinishedPathMap fpl; auto as = ctrlAutoSearch.getItemData(index)->asItem; title = Text::toT(as->getDisplayName()); if (as->usingIncrementation()) { asMenu.appendSeparator(); asMenu.appendItem(TSTRING(INCREASE_NUM), [=] { AutoSearchManager::getInstance()->changeNumber(as, true); }, (as->getMaxNumber() > 0 && as->getCurNumber() >= as->getMaxNumber()) ? OMenu::FLAG_DISABLED : 0); asMenu.appendItem(TSTRING(DECREASE_NUM), [=] { AutoSearchManager::getInstance()->changeNumber(as, false); }, as->getCurNumber() == 0 ? OMenu::FLAG_DISABLED : 0); } AutoSearchManager::getInstance()->getMenuInfo(as, bundles, fpl); if (!bundles.empty() || !fpl.empty()) { asMenu.appendSeparator(); if (!bundles.empty()) { auto bundleMenu = asMenu.createSubMenu(CTSTRING(REMOVE_BUNDLE), true); for(auto& b: bundles) { auto token = b->getToken(); bundleMenu->appendItem(Text::toT(b->getName()), [=] { WinUtil::removeBundle(token); }); } } auto pathMenu = asMenu.createSubMenu(CTSTRING(OPEN_FOLDER), false); if (!bundles.empty()) { pathMenu->InsertSeparatorFirst(CTSTRING(QUEUED_BUNDLES)); for(auto& b: bundles) { string path = b->getTarget(); pathMenu->appendItem(Text::toT(path), [=] { WinUtil::openFolder(Text::toT(path)); }); } } if (!fpl.empty()) { pathMenu->InsertSeparatorLast(CTSTRING(FINISHED_BUNDLES)); for(auto j=fpl.begin(); j != fpl.end(); j++) { string path = j->first; pathMenu->appendItem(Text::toT(path) + (j->second > 0 ? _T(" (") + Text::toT(Util::formatTime("%Y-%m-%d %H:%M", j->second)) + _T(")") : Util::emptyStringT), [=] { WinUtil::openFolder(Text::toT(path)); }); } pathMenu->appendSeparator(); pathMenu->appendItem(CTSTRING(CLEAR_FINISHED_PATHS), [=] { AutoSearchManager::getInstance()->clearPaths(as); }); } } if (!as->getLastError().empty()) { asMenu.appendSeparator(); asMenu.appendItem(TSTRING(CLEAR_ERROR), [=] { as->setLastError(Util::emptyString); updateItem(as); }); } } asMenu.AppendMenu(MF_SEPARATOR); asMenu.AppendMenu(MF_STRING, IDC_REMOVE, CTSTRING(REMOVE)); asMenu.EnableMenuItem(IDC_CHANGE, enable); asMenu.EnableMenuItem(IDC_DUPLICATE, enable); asMenu.SetMenuDefaultItem(IDC_CHANGE); //make a menu title from the search string, its probobly too long to fit but atleast it shows something. if (!title.empty()) asMenu.InsertSeparatorFirst(title); asMenu.open(m_hWnd, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt); if (!title.empty()) asMenu.RemoveFirstItem(); return TRUE; } bHandled = FALSE; return FALSE; }