void PanelWidget::on_tool_addplugin_clicked(){ GetPluginDialog dlg(mainui); dlg.LoadPlugins("panel", PINFO); dlg.exec(); if(!dlg.selected){ return; } //cancelled QString pan = dlg.plugID; //getNewPanelPlugin(); if(pan == "applauncher"){ //Prompt for the application to add XDGDesktop app = static_cast<MainUI*>(mainui)->getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled pan.append("::"+app.filePath); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name); it->setWhatsThis(pan); ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); }else{ if(pan.isEmpty()){ return; } //nothing selected //Add the new plugin to the list LPI info = PINFO->panelPluginInfo(pan); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); it->setWhatsThis(info.ID); ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); } emit PanelChanged(); }
//================= // PRIVATE SLOTS //================= void page_interface_desktop::deskplugadded(){ GetPluginDialog dlg(this); dlg.LoadPlugins("desktop", PINFO); dlg.exec(); if( !dlg.selected ){ return; } //cancelled QString newplug = dlg.plugID; QListWidgetItem *it = new QListWidgetItem(); if(newplug=="applauncher"){ //Prompt for the application to add XDGDesktop app = getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled newplug.append("::"+app.filePath); //Now fill the item with the necessary info it->setWhatsThis(newplug); it->setText(app.name); it->setIcon(LXDG::findIcon(app.icon,"") ); it->setToolTip(app.comment); }else{ //Load the info for this plugin LPI info = PINFO->desktopPluginInfo(newplug); if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen) it->setWhatsThis(newplug); it->setText(info.name); it->setToolTip(info.description); it->setIcon( LXDG::findIcon(info.icon,"") ); } ui->list_desktop_plugins->addItem(it); ui->list_desktop_plugins->scrollToItem(it); settingChanged(); }
void ObjectExplorer::updateIddFile() { ///! update displayed info if(!mObjectList || !mGroupList){ return; } mObjectList->clear(); mGroupList->clear(); std::string group; std::vector<std::string> groups = mIddFile.groups(); openstudio::IddObject object; std::vector<openstudio::IddObject> objects; QListWidgetItem * newItem = nullptr; for(unsigned i=0 ; i<groups.size(); i++){ group = groups.at(i); if(group.empty()) continue; objects = mIddFile.getObjectsInGroup(group); newItem = new QListWidgetItem(); newItem->setText(tr(group.c_str())); mGroupList->addItem(newItem); for(unsigned j=0 ; j<objects.size(); j++){ object = objects.at(j); newItem = new QListWidgetItem(); newItem->setText(tr(object.name().c_str())); newItem->setWhatsThis(tr(group.c_str())); mObjectList->addItem(newItem); } } mGroupList->sortItems(); mObjectList->sortItems(); }
void MainUI::foundSearchItem(QString path){ //To get the worker's results QListWidgetItem *it = new QListWidgetItem; it->setWhatsThis(path); it->setToolTip(path); //Now setup the visuals if(path.simplified().endsWith(".desktop")){ bool ok = false; XDGDesktop desk(path); if( !desk.isValid() ){delete it; return; } //invalid file it->setText(desk.name); it->setIcon( LXDG::findIcon(desk.icon, "application-x-desktop") ); }else{ if(QFileInfo(path).isDir()){ it->setIcon( LXDG::findIcon("inode-directory","") ); it->setText( path.replace(QDir::homePath(), "~") ); }else{ if(QFileInfo(path).isExecutable()){ it->setIcon( LXDG::findIcon("application-x-executable","") ); }else{ it->setIcon( LXDG::findMimeIcon(path.section("/",-1).section(".",-1)) ); } it->setText( path.section("/",-1) ); } } //Now add it to the widget ui->listWidget->addItem(it); if(ui->listWidget->count()>100){ searcher->StopSearch(); } //just in case }
void ContextMenu::addItem(QIcon &icon, const QString &text, const QString &whatsThis) { QListWidgetItem *item = new QListWidgetItem(icon, text); item->setWhatsThis(whatsThis); ui->menuWidget->addItem(item); }
void DesktopViewPlugin::updateContents(){ list->clear(); QDir dir(QDir::homePath()+"/Desktop"); QFileInfoList files = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Type | QDir::DirsFirst); for(int i=0; i<files.length(); i++){ QListWidgetItem *it = new QListWidgetItem; it->setWhatsThis(files[i].absoluteFilePath()); if(files[i].isDir()){ it->setIcon( LXDG::findIcon("folder","") ); it->setText( files[i].fileName() ); }else if(files[i].suffix() == "desktop" ){ bool ok = false; XDGDesktop desk = LXDG::loadDesktopFile(files[i].absoluteFilePath(), ok); if(ok){ it->setIcon( LXDG::findIcon(desk.icon,"") ); it->setText( desk.name ); }else{ //Revert back to a standard file handling it->setIcon( LXDG::findMimeIcon(files[i].suffix()) ); it->setText( files[i].fileName() ); } }else{ it->setIcon( LXDG::findMimeIcon(files[i].suffix()) ); it->setText( files[i].fileName() ); } list->addItem(it); } }
//Main slots void ConfigDialog::loadPbiConf(){ //fill the UI with the current settings QStringList contents = Extras::readFile("/usr/local/etc/pcbsd.conf"); for(int i=0; i<contents.length(); i++){ if(contents[i].startsWith("#") || contents[i].isEmpty() ){ continue; } //skip comment if(contents[i].startsWith("PACKAGE_SET:")){ QString val = contents[i].section(":",1,50).simplified(); if(val=="EDGE"){ ui->radio_edge->setChecked(true); } else if(val=="PRODUCTION"){ ui->radio_production->setChecked(true); } else if(val=="CUSTOM"){ ui->radio_custom->setChecked(true); } else{ ui->radio_production->setChecked(true); } //default to PRODUCTION }else if(contents[i].startsWith("PACKAGE_URL:")){ QString cURL = contents[i].section(":",1,50).simplified(); //Now make sure that custom repo is selected bool found = false; for(int i=0; i<ui->listWidget->count() && !found; i++){ if( ui->listWidget->item(i)->whatsThis() == cURL ){ found = true; ui->listWidget->setCurrentRow(i); } } qDebug() << "Custom URL detected:" << cURL; if(!found){ //Add this repo as UNKNOWN QListWidgetItem *item = new QListWidgetItem( cURL.left(30).append("..."), 0); item->setWhatsThis(cURL); item->setToolTip(cURL); ui->listWidget->addItem(item); ui->listWidget->setCurrentItem(item); } } } }
//添加网络item int PlaylistWindow::addItemFromNet(const QString &additem, const QString &link,int id, bool playNow) { QListWidgetItem *item = new QListWidgetItem(additem,listWidget); int row = listWidget->row(item); //添加索引字符 QString index = ""; if(row<9) { index.append("0").append(QString::number(row+1,10).append(". ")); } else { index = QString::number(row+1,10).append(". "); } item->setText(index.append(item->text())); //设置item高度 item->setSizeHint(QSize(100,30)); item->setIcon(QIcon(":/image/net.ico")); item->setWhatsThis(QString::number(id,10)); item->setToolTip(additem); //设置media的类型 item->setStatusTip(QString::number(MEDIA_TYPE_MUSIC,10)); this->setItemNormalView(item); //添加到playlist 并将第一条设置为当前播放item playlist->addMedia(QUrl(link)); // this->setItemPlay(row); if (playNow){ this->doubleClicked = false; playlist->setCurrentIndex(row); } //qDebug("%d",playlist->currentIndex()); return MEDIA_TYPE_MUSIC; }
void MainWindow::insertItem() { if (!listWidget->currentItem()) return; QString itemText = QInputDialog::getText(this, tr("Insert Item"), tr("Input text for the new item:")); if (itemText.isNull()) return; //! [6] QListWidgetItem *newItem = new QListWidgetItem; newItem->setText(itemText); //! [6] int row = listWidget->row(listWidget->currentItem()); //! [7] listWidget->insertItem(row, newItem); //! [7] QString toolTipText = tr("Tooltip:") + itemText; QString statusTipText = tr("Status tip:") + itemText; QString whatsThisText = tr("What's This?:") + itemText; //! [8] newItem->setToolTip(toolTipText); newItem->setStatusTip(toolTipText); newItem->setWhatsThis(whatsThisText); //! [8] }
void PartitionSelect::UpdateParts(){ ui->list_part->clear(); QStringList parts = DEVINFO.value(ui->combo_hd->currentData().toString()); //qDebug() << "Parts:" << parts; for(int i=0; i<parts.length(); i++){ QListWidgetItem *it = new QListWidgetItem(parts[i].section("::::",0,0)); it->setWhatsThis(parts[i].section("::::",1,1) ); ui->list_part->addItem(it); } }
//Custom Repo Management void ConfigDialog::readSavedRepos(){ QStringList keys = settings->allKeys(); for(int i=0; i<keys.length(); i++){ QListWidgetItem *item = new QListWidgetItem(keys[i], 0); QString cURL = settings->value(keys[i]).toString(); item->setWhatsThis( cURL ); item->setToolTip( cURL ); ui->listWidget->addItem(item); if(i==0){ ui->listWidget->setCurrentItem(item); } } }
void page_autostart::addsessionstartfile(){ QString chkpath = QDir::homePath(); QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) ); it->setWhatsThis(bin); //file to be saved/run it->setToolTip(bin); it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); settingChanged(); }
void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ pnum = Pnum; dnum = Dnum; //save these for later ui->label->setText( QString(tr("Panel %1")).arg(QString::number(Pnum+1) ) ); QString prefix = "panel"+QString::number(Dnum)+"."+QString::number(Pnum)+"/"; qDebug() << "Loading Panel Settings:" << prefix; //Now load the settings into the GUI int tmp = ui->combo_align->findData( settings->value(prefix+"pinLocation","center").toString().toLower() ); if(tmp>=0){ ui->combo_align->setCurrentIndex( tmp ); } tmp = ui->combo_edge->findData( settings->value(prefix+"location","top").toString().toLower() ); if(tmp>=0){ ui->combo_edge->setCurrentIndex( tmp ); } ui->spin_plength->setValue( settings->value( prefix+"lengthPercent",100).toInt() ); ui->spin_pxthick->setValue( settings->value( prefix+"height",30).toInt() ); ui->check_autohide->setChecked( settings->value(prefix+"hidepanel", false).toBool() ); ui->group_customcolor->setChecked( settings->value(prefix+"customColor",false).toBool() ); ui->label_color_sample->setWhatsThis( settings->value(prefix+"color","rgba(255,255,255,160)").toString()); ui->list_plugins->clear(); QStringList plugs = settings->value(prefix+"pluginlist",QStringList()).toStringList(); for(int i=0; i<plugs.length(); i++){ QString pid = plugs[i].section("---",0,0); if(pid.startsWith("applauncher")){ bool ok = false; XDGDesktop desk = LXDG::loadDesktopFile(pid.section("::",1,1),ok); if(ok){ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version) ui->list_plugins->addItem(it); } }else{ LPI info = PINFO->panelPluginInfo(pid); if(!info.ID.isEmpty()){ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version) ui->list_plugins->addItem(it); } } } reloadColorSample(); }
void page_autostart::addsessionstartapp(){ //Prompt for the application to start QString app = getSysApp(false); //no reset if(app.isEmpty()){ return; } //cancelled XDGDesktop desk(app); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(desk.filePath); it->setToolTip(desk.comment); it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); settingChanged(); }
void MainWindow::onRedraw() { qDebug() << "onRedraw()"; QListWidget *list=ui->listWidget; QListWidgetItem *item; list->clear(); for(auto i = network_->getClients().begin(); i != network_->getClients().end(); i++) { item = new QListWidgetItem(i.value()->getOs() ); item->setWhatsThis(QString("%1") .arg( i.value()->getId() )); list->addItem(item); } }
void ConfigDialog::addCustom(){ //Get the name/URL from the user QString cURL = QInputDialog::getText(this, tr("New Repo URL"), tr("URL:") ); if(cURL.isEmpty()){ return; } //cancelled QString key = QInputDialog::getText(this, tr("New Repo Name"), tr("Name:") ); while( key.isEmpty() || settings->contains(key) ){ key = QInputDialog::getText(this, tr("Invalid Name: Try Again"), tr("Name:") ); } settings->setValue(key, cURL); QListWidgetItem *item = new QListWidgetItem(key, 0); item->setWhatsThis(cURL); ui->listWidget->addItem(item); ui->listWidget->setCurrentItem(item); customChanged(); }
ServicesDialog::ServicesDialog(QWidget *parent, MainJackSMS *_padre, libJackSMS::dataTypes::servicesType &_ElencoServizi, libJackSMS::dataTypes::configuredServicesType &_ElencoServiziConfigurati) : QDialog(parent), padre(_padre), m_ui(new Ui::ServicesDialog), ElencoServizi(_ElencoServizi), ElencoServiziConfigurati(_ElencoServiziConfigurati) { m_ui->setupUi(this); m_ui->linkButton->setVisible(false); QString service_type; for (libJackSMS::dataTypes::servicesType::const_iterator i = ElencoServizi.begin(); i != ElencoServizi.end(); ++i) { if ((i.value().getName() == "Free+") || (i.value().getName() == "Freesmee") || (i.value().getName() == "SMS+")) continue; QListWidgetItem *it = new QListWidgetItem(); it->setText(i.value().getName()); it->setIcon(i.value().getIcon()); it->setWhatsThis(i.key()); service_type = i.value().getServiceType(); if (service_type == "free") m_ui->listServiziFree->addItem(it); else if (service_type == "lowcost") m_ui->listServiziLowCost->addItem(it); else if (service_type == "other") m_ui->listServiziAltri->addItem(it); else m_ui->listServiziAltri->addItem(it); } m_ui->tabServiceType->setCurrentIndex(0); spinner = new QMovie(":/resource/loading-spinner.gif", QByteArray("gif"), this); spinner->setScaledSize(QSize(16,16)); spinner->start(); m_ui->labelSpinAddAccount->setMovie(spinner); m_ui->labelSpinAddAccount->hide(); }
void page_autostart::addsessionstartbin(){ QString chkpath = LOS::AppPrefix() + "bin"; if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } QString bin = QFileDialog::getOpenFileName(this, tr("Select Binary"), chkpath, tr("Application Binaries (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled if( !QFileInfo(bin).isExecutable() ){ QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); return; } QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) ); it->setWhatsThis(bin); //command to be saved/run it->setToolTip(bin); it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); settingChanged(); }
void MainUI::updateGUI(QString tab) { if(tab=="makefile" || tab=="all") { if(ui->list_make_config->count() <= 0) { //Fill the list with the available options QStringList opts = PortUtils::getMakefileConfigOpts(); for(int i=0; i<opts.length(); i++) { QListWidgetItem *it = new QListWidgetItem(opts[i].section(":::",0,0)); it->setToolTip(opts[i].section(":::",2,50)); //description of the variable it->setWhatsThis(opts[i].section(":::",1,1)); //type of variable ui->list_make_config->addItem(it); ui->tool_make_addconf->setVisible(false); //nothing selected yet ui->tool_make_replaceconf->setEnabled(false); //nothing selected yet } //Now make sure the widget is the smallest possible ui->list_make_config->setMaximumWidth(ui->list_make_config->sizeHintForColumn(0)+5); } //Load the makefile for the current port QStringList contents = PortUtils::readFile(PORT->portPath()+"/Makefile"); ui->text_makefile->clear(); ui->text_makefile->setPlainText(contents.join("\n")); ui->tool_make_save->setEnabled(false); //nothing changed yet } if(tab=="distinfo" || tab=="all") { //Load the distinfo for the current port QStringList contents = PortUtils::readFile(PORT->portPath()+"/distinfo"); ui->text_distinfo->clear(); ui->text_distinfo->setPlainText(contents.join("\n")); } if(tab=="pkg-plist" || tab=="all") { //Load the distinfo for the current port QStringList contents = PortUtils::readFile(PORT->portPath()+"/pkg-plist"); ui->text_pkgplist->clear(); ui->text_pkgplist->setPlainText(contents.join("\n")); ui->tool_plist_save->setEnabled(false); //nothing changed yet } if(tab=="pkg-descr" || tab=="all") { //Load the distinfo for the current port QStringList contents = PortUtils::readFile(PORT->portPath()+"/pkg-descr"); ui->text_pkgdesc->clear(); ui->text_pkgdesc->setPlainText(contents.join("\n")); ui->tool_desc_save->setEnabled(false); //nothing changed yet } }
void PBCOpenPlayDialog::fillCategoryList(std::map<PBCCategorySP, unsigned int> categories, // NOLINT unsigned int totalPlayCount) { for (const auto& kv : categories) { PBCCategorySP categorySP = kv.first; unsigned int count = kv.second; std::string categoryString = categorySP->name() + " (" + std::to_string(count) + " plays)"; QListWidgetItem* item = new QListWidgetItem(QString::fromStdString(categoryString)); // NOLINT item->setWhatsThis(QString::fromStdString(categorySP->name())); pbcAssert(count <= totalPlayCount) if(count == totalPlayCount) { item->setFlags(item->flags() & ~Qt::ItemIsEnabled); } ui->categoryListWidget->addItem(item); // NOLINT } }
void page_interface_desktop::LoadSettings(int screennum){ if(screennum>=0){ cscreen = screennum; } emit HasPendingChanges(false); emit ChangePageTitle( tr("Desktop Settings") ); QSettings settings("lumina-desktop","desktopsettings"); QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; ui->check_desktop_autolaunchers->setChecked(settings.value(DPrefix+"generateDesktopIcons",false).toBool() ); QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList(); ui->list_desktop_plugins->clear(); for(int i=0; i<dplugs.length(); i++){ QListWidgetItem* it = new QListWidgetItem(); it->setWhatsThis(dplugs[i]); //save the full thing instantly //Now load the rest of the info about the plugin QString num; if(dplugs[i].contains("---")){ num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number if(num=="1"){ num.clear(); } //don't bother showing the number dplugs[i] = dplugs[i].section("---",0,0); } if(dplugs[i].startsWith("applauncher::")){ bool ok = false; XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok); if(!ok){ continue; } //invalid for some reason //Now fill the item with the necessary info it->setText(app.name); it->setIcon(LXDG::findIcon(app.icon,"") ); it->setToolTip(app.comment); }else{ //Load the info for this plugin LPI info = PINFO->desktopPluginInfo(dplugs[i]); if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason it->setText(info.name); it->setToolTip(info.description); it->setIcon( LXDG::findIcon(info.icon,"") ); } if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number ui->list_desktop_plugins->addItem(it); } }
void MobileApp::updateDownloadableList() { QList <QString> dl; groups.clear(); ReadFileToList(SAVEDBOOKLIST, dl, "UTF-8"); parseDLFile(dl); //show aprorpriate widgets ui->downloadSTKWidget->setCurrentIndex(1); //Clear the old list ui->downloadListWidget->clear(); //Build the new list for (int i=0; i<groups.size(); i++) { if (groups[i].downloadState != 0) { QListWidgetItem *lwi; lwi= new QListWidgetItem(groups[i].name + " (" + QString::number(groups[i].downloadSize) + /* "/" + QString::number(groups[i].fullSize) + */ " MB)"); if (autoInstallKukBooksFlag && groups[i].name.contains("הרחבה")) lwi->setCheckState(Qt::Checked); else lwi->setCheckState(Qt::Unchecked); lwi->setWhatsThis(stringify(i)); lwi->setToolTip("False"); if(groups[i].hidden) lwi->setTextColor(QColor("gray")); ui->downloadListWidget->addItem(lwi); ui->downloadListWidget->setEnabled(true); } } if(autoInstallKukBooksFlag) downloadStart(); }
void page_autostart::LoadSettings(int){ emit HasPendingChanges(false); emit ChangePageTitle( tr("Startup Services") ); //qDebug() << "Load AutoStart Files"; QList<XDGDesktop*> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items //qDebug() << " - done:" << STARTAPPS.length(); //qDebug() << "StartApps:"; ui->list_session_start->clear(); for(int i=0; i<STARTAPPS.length(); i++){ //qDebug() << STARTAPPS[i]->filePath +" -> " +STARTAPPS[i]->name << STARTAPPS[i]->isHidden; if( !STARTAPPS[i]->isValid() || !QFile::exists(STARTAPPS[i]->filePath) ){ continue; } QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i]->icon,"application-x-executable"), STARTAPPS[i]->name ); it->setWhatsThis(STARTAPPS[i]->filePath); //keep the file location it->setToolTip(STARTAPPS[i]->comment); if(STARTAPPS[i]->isHidden){ it->setCheckState( Qt::Unchecked); } else{it->setCheckState( Qt::Checked); } ui->list_session_start->addItem(it); } //Now cleanup all the STARTAPPS data for(int i=STARTAPPS.length()-1; i>=0; i--){ STARTAPPS[i]->deleteLater(); } }
//---------------------------------------------------------------------------------------- void ObjectsViewWidget::prepareView() { listWidget->clear(); Ogre::String filename; Ogre::String itemname; Ogitors::EditorObjectFactoryMap objects = Ogitors::OgitorsRoot::getSingletonPtr()->GetEditorObjectFactories(); Ogitors::EditorObjectFactoryMap::iterator it = objects.begin(); while(it != objects.end()) { if(it->second && it->second->mAddToObjectList) { if(it->second->mIcon != "") filename = "../Plugins/" + it->second->mIcon; itemname = it->second->mTypeName; itemname.erase(itemname.length() - 7,7); filename = OgitorsUtils::QualifyPath(filename); QListWidgetItem *item = new QListWidgetItem(QIcon(QString(filename.c_str())), QString(itemname.c_str()), listWidget); item->setWhatsThis(it->second->mTypeName.c_str()); listWidget->addItem(item); } it++; } listWidget->setGridSize(QSize(64,70)); mTimer = new QTimer(this); mTimer->setInterval(1000); connect(mTimer, SIGNAL(timeout()), this, SLOT(updateView())); mTimer->start(); }
void AdvancedTabBar::tabLayoutChange() { d->list->setIconSize(iconSize()); while (count() < d->list->count()) { delete d->list->takeItem(0); } if (count() == -1) return; while (count() > d->list->count()) { d->list->addItem(QString()); } for (int i = 0; i < count(); i++) { QListWidgetItem * item = d->list->item(i); item->setText(tabText(i)); item->setIcon(tabIcon(i)); item->setToolTip(tabToolTip(i)); item->setWhatsThis(tabWhatsThis(i)); } d->list->setCurrentRow(currentIndex()); }
static PyObject *meth_QListWidgetItem_setWhatsThis(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QString* a0; int a0State = 0; QListWidgetItem *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QListWidgetItem, &sipCpp, sipType_QString,&a0, &a0State)) { sipCpp->setWhatsThis(*a0); sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QListWidgetItem, sipName_setWhatsThis, doc_QListWidgetItem_setWhatsThis); return NULL; }
/** * @brief Reloads the todo list from the SQLite database */ void TodoDialog::reloadTodoListItems() { QList<CalendarItem> calendarItemList = CalendarItem::fetchAllByCalendar( ui->todoListSelector->currentText()); MetricsService::instance()->sendEvent( "note", "todo list loaded", "", calendarItemList.count()); { const QSignalBlocker blocker(ui->todoList); Q_UNUSED(blocker); ui->todoList->clear(); QListIterator<CalendarItem> itr(calendarItemList); while (itr.hasNext()) { CalendarItem calItem = itr.next(); // skip completed items if the "show completed items" checkbox // is not checked if (!ui->showCompletedItemsCheckBox->checkState()) { if (calItem.isCompleted()) { continue; } } QString uid = calItem.getUid(); // skip items that were not fully loaded yet if (uid == "") { continue; } QListWidgetItem *item = new QListWidgetItem(calItem.getSummary()); item->setWhatsThis(uid); item->setCheckState( calItem.isCompleted() ? Qt::Checked : Qt::Unchecked); item->setFlags( Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); ui->todoList->addItem(item); } } // set the current row of the todo list to the first row if (ui->todoList->count() > 0) { int row = -1; // try to find a possible last created calendar item if (lastCreatedCalendarItem.isFetched()) { row = findTodoItemRowByUID(lastCreatedCalendarItem.getUid()); // clear the last created calendar item if we found it in the list if (row > -1) { lastCreatedCalendarItem = CalendarItem(); } } if (row == -1) { // try to find the currently selected calendar item row = findTodoItemRowByUID(currentCalendarItem.getUid()); } ui->todoList->setCurrentRow(row >= 0 ? row : 0); } else { resetEditFrameControls(); } }
void Details :: describePlanet() { fileIndex = qBound(0, fileIndex, filesCount() - 1); bool exists = planet != A::Planet_None; positionLabel -> setVisible(exists); aspectsList -> setVisible(exists); powerLabel -> setVisible(exists); if (!exists) return; const A::Planet& p = file(fileIndex)->horoscope().planets[planet]; QString powerText = A::describePowerInHtml(p, file(fileIndex)->horoscope()); if (!powerText.isEmpty()) powerText = "<p align='center'><b><i>" + QString("<font color='#71aeec' size='+2'>+%1</font> | " "<font color='#dfb096' size='+2'>%2</font>") .arg(p.power.dignity) .arg(p.power.deficient) + "</i></b></p>" + powerText; positionLabel -> setText(A::describePlanetCoordInHtml(p)); powerLabel -> setText(powerText); aspectsList->clear(); A::AspectList list; QString tag1, tag2; if (filesCount() == 1) { list = file()->horoscope().aspects; aspects->setTitle(tr("Aspects")); } else { list = calculateSynastryAspects(); aspects->setTitle(tr("Synastry aspects")); tag1 = "#1"; tag2 = "#2"; } foreach (const A::Aspect& asp, list) { if (*asp.planet1 != p && *asp.planet2 != p) continue; QListWidgetItem* item = new QListWidgetItem; item->setIcon(QIcon(asp.d->userData["icon"].toString())); item->setText(A::describeAspect(asp)); item->setToolTip(A::describeAspectFull(asp, tag1, tag2)); item->setStatusTip(QString("%1+%2+%3").arg(asp.d->name) .arg(asp.planet1->name) .arg(asp.planet2->name)); aspectsList->addItem(item); } QListWidgetItem* item = new QListWidgetItem("..."); item->setToolTip(tr("more")); item->setWhatsThis("more"); item->setTextAlignment(Qt::AlignCenter); aspectsList->addItem(item); if (expandedAspects) expandAspects(); else updateListHeight(aspectsList); }
// ================ // PUBLIC SLOTS // ================ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){ if(dir.isEmpty()){ return; } //nothing to do QTime time; if(DEBUG){time.start(); } qDebug() << "Load Dir:" << dir; QString lastdir = CDIR; //for some checks later QString lastbasedir = normalbasedir; CDIR = dir; if(CDIR.endsWith("/") && CDIR.length() > 1){ CDIR.chop(1); } CLIST = list; //save for later canmodify = QFileInfo(CDIR).isWritable(); if(DEBUG){ qDebug() << "Clear UI:" <<time.elapsed(); } //Clear the status text if(!canmodify){ui->label_status->setText(tr("(Limited Access) ")); } else{ ui->label_status->setText(""); } //Hide the extra buttons for a moment ui->tool_goToPlayer->setVisible(false); ui->tool_goToImages->setVisible(false); ui->tool_new_dir->setVisible(canmodify); ui->tool_new_file->setVisible(canmodify); //Set the drag/drop info as appripriate if(canmodify){ listWidget->setWhatsThis(CDIR); treeWidget->setWhatsThis(CDIR); }else{ listWidget->setWhatsThis(""); treeWidget->setWhatsThis(""); } bool updateThumbs = (lastdir != CDIR); //Determine if this is an internal ZFS snapshot bool loadsnaps = false; if(DEBUG){ qDebug() << "Load Snap Info:" << time.elapsed(); } if( dir.contains(ZSNAPDIR) ){ //This is a zfs snapshot - only update the saved paths necessary to rotate between snapshots/system snaprelpath = dir.section(ZSNAPDIR,1,1000).section("/",1,1000); //the relative path inside the snapshot if(snaprelpath.endsWith("/")){ snaprelpath.chop(1); } normalbasedir = dir.section(ZSNAPDIR,0,0)+"/"+snaprelpath; //Update the new base directory if(normalbasedir.endsWith("/")){ normalbasedir.chop(1); } line_dir->setText(normalbasedir); //See if this was a manual move to the directory, or an internal move QString tmp = dir.section(ZSNAPDIR,0,0); if(tmp != snapbasedir.section(ZSNAPDIR,0,0)){ loadsnaps = true; //different snapshot loaded - need to update internally } }else{ //This is a normal directory - prompt for snapshot information line_dir->setText(CDIR); normalbasedir = CDIR; if(!snapbasedir.isEmpty()){ watcher->removePath(snapbasedir); } snapbasedir.clear(); loadsnaps = true; } if(loadsnaps){ //kick this off while still loading the dir contents ui->group_snaps->setEnabled(false); //to prevent the snap updates to be automatically used ui->group_snaps->setVisible(false); ui->slider_snap->setRange(1,1); emit findSnaps(ID, normalbasedir); } if(DEBUG){ qDebug() << "Update History:" <<time.elapsed(); } //Now update the history for this browser //qDebug() << "History:" << history << normalbasedir << lastbasedir; if(!history.isEmpty() && history.last() == normalbasedir && lastbasedir!=normalbasedir ){ //We went back one - remove this from the history history.takeLast(); ui->actionBack->setEnabled(!history.isEmpty()); //qDebug() << " - Duplicate: removed item"; }else if(lastbasedir!=normalbasedir){ //not a refresh or internal snapshot change //qDebug() << " - New History Item:" << normalbasedir; history << normalbasedir; ui->actionBack->setEnabled(history.length()>1); } if(DEBUG){ qDebug() << "Update Watcher:" << time.elapsed(); } //Clear the current watcher if(!watcher->directories().isEmpty()){ watcher->removePaths(watcher->directories()); } if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } watcher->addPath(CDIR); // add sessionsettings to watcher so date_format can be update based on user settings watcher->addPath(sessionsettings_config_file); ui->actionStopLoad->setVisible(true); stopload = false; //Clear the display widget (if a new directory) if(DEBUG){ qDebug() << "Clear Browser Widget:" << time.elapsed(); } double scrollpercent = -1; if(updateThumbs){ needThumbs.clear(); } if(lastbasedir != normalbasedir){ if(showDetails){ treeWidget->clear(); } else{ listWidget->clear(); } QApplication::processEvents(); //make sure it is cleared right away }else{ //Need to be smarter about which items need to be removed // - compare the old/new lists and remove any items not in the new listing (new items taken care of below) QStringList newfiles; //just the filenames for(int i=0; i<CLIST.length(); i++){ newfiles << CLIST[i].fileName(); } if(showDetails){ for(int i=0; i<treeWidget->topLevelItemCount(); i++){ if( !newfiles.contains(treeWidget->topLevelItem(i)->whatsThis(0).section("/",-1)) ){ if(!updateThumbs){ needThumbs.removeAll( treeWidget->topLevelItem(i)->whatsThis(0).section("::::",1,50)); } delete treeWidget->takeTopLevelItem(i); i--; } } QApplication::processEvents(); //make sure the scrollbar is up to date after removals scrollpercent = treeWidget->verticalScrollBar()->value()/( (double) treeWidget->verticalScrollBar()->maximum()); }else{ for(int i=0; i<listWidget->count(); i++){ if( !newfiles.contains(listWidget->item(i)->text()) ){ if(!updateThumbs){ needThumbs.removeAll( listWidget->item(i)->whatsThis().section("::::",1,50)); } delete listWidget->takeItem(i); i--; } } QApplication::processEvents(); //make sure the scrollbar is up to date after removals scrollpercent = listWidget->horizontalScrollBar()->value()/( (double) listWidget->horizontalScrollBar()->maximum()); } } //end check for CDIR reload //Now fill the display widget bool hasimages, hasmultimedia; hasimages = hasmultimedia = false; int numdirs = 0; qint64 filebytes = 0; //Setup the timer to see when we should process events /*QTimer updatetime; updatetime.setInterval(1000); //1 second updates updatetime.setSingleShot(true); updatetime.start();*/ QTime updatetime = QTime::currentTime().addMSecs(500); if(DEBUG){ qDebug() << "Start Loop over items:" << time.elapsed(); } for(int i=0; i<list.length(); i++){ if(stopload){ ui->actionStopLoad->setVisible(false); return; } //stop right now if(!hasimages && list[i].isImage()){ hasimages = true; ui->tool_goToImages->setVisible(true); } else if(!hasmultimedia && list[i].isAVFile()){ hasmultimedia = true; ui->tool_goToPlayer->setVisible(true); } //Update statistics if(list[i].isDir()){ numdirs++; } else{ filebytes += list[i].size(); } watcher->addPath(list[i].absoluteFilePath()); if(showDetails){ //Now create all the individual items for the details tree CQTreeWidgetItem *it; bool addnew = false; //See if an item already exists for this file QList<QTreeWidgetItem*> items = treeWidget->findItems(list[i].fileName(),Qt::MatchExactly,0); //NOTE: This requires column 0 to be the name if(items.isEmpty()){ it = new CQTreeWidgetItem(); addnew = true; }else{ // Safe downcasting because CQTreeWidgetItem only redefines the virtual function bool opearot<. Not new methos added. it = static_cast<CQTreeWidgetItem *> (items.first()); } //Now update the entry contents it->setWhatsThis(0, QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath()); for(int t=0; t<listDetails.length(); t++){ switch(listDetails[t]){ case NAME: it->setText(t,list[i].fileName()); it->setStatusTip(t, list[i].fileName()); //Since the icon/image is based on the filename - only update this for a new item // (This is the slowest part of the routine) if(list[i].isImage()&& (addnew || updateThumbs)){ if(showThumbs){ it->setIcon(t, LXDG::findIcon("fileview-preview","image-x-generic") ); needThumbs << list[i].fileName(); }else{ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); } }else if(addnew){ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") ); } break; case SIZE: if(!list[i].isDir()){ it->setText(t, LUtils::BytesToDisplaySize(list[i].size()) ); } break; case TYPE: it->setText(t, list[i].mimetype()); break; case DATEMOD: { QStringList datetime_format = getDateFormat(); // Save datetime in WhatThis value. Lately will be used by CQTreeWidgetItem for sorting by date it->setWhatsThis(t, list[i].lastModified().toString("yyyyMMddhhmmsszzz")); // Default configurition. Fallback to Qt::DefaultLocaleShortDate for formats if(datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) ); // Date is setted but time not. Time goes to default else if(!datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(Qt::DefaultLocaleShortDate)); // Time is setted but date not. Date goes to default else if(datetime_format.at(0).isEmpty() && !datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().date().toString(Qt::DefaultLocaleShortDate) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); // Both time and date setted. else it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); break; } case DATECREATE: { QStringList datetime_format = getDateFormat(); it->setWhatsThis(DATECREATE, list[i].lastModified().toString("yyyyMMddhhmmsszzz")); if(datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) ); else if(!datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(Qt::DefaultLocaleShortDate)); else if(datetime_format.at(0).isEmpty() && !datetime_format.at(1).isEmpty()) it->setText(t, list[i].lastModified().date().toString(Qt::DefaultLocaleShortDate) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); else it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); break; } } } if(addnew){ treeWidget->addTopLevelItem(it); } if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); } if(lastdir == CDIR+"/"+list[i].fileName()){ treeWidget->setCurrentItem(it); treeWidget->scrollToItem(it); } }else{ //Create all the individual items for the basic list QListWidgetItem *it; //See if there is an existing item to re-use bool addnew = false; QList<QListWidgetItem*> items = listWidget->findItems(list[i].fileName(), Qt::MatchExactly); if(items.isEmpty()){ it = new QListWidgetItem(); addnew = true; }else{ it = items.first(); } it->setWhatsThis( QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath()); //used for drag and drop it->setText(list[i].fileName()); it->setStatusTip(list[i].fileName()); //Since the icon/image is based on the filename - only update this for a new items (non-thumbnail) // (This is the slowest part of the routine) if(list[i].isImage() && (addnew || updateThumbs) ){ if(showThumbs){ it->setIcon(LXDG::findIcon("fileview-preview","image-x-generic") ); needThumbs << list[i].fileName(); }else{ it->setIcon(LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); } }else if(addnew){ it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") ); } listWidget->addItem(it); if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); } if(lastdir == CDIR+"/"+list[i].fileName()){ listWidget->setCurrentItem(it); listWidget->scrollToItem(it); } } if(QTime::currentTime() > updatetime){ QApplication::processEvents(); updatetime = QTime::currentTime().addMSecs(500); }//keep the UI snappy while loading a directory if(DEBUG){ qDebug() << " - item finished:" << i << time.elapsed(); } } tmpSel.clear(); if(DEBUG){ qDebug() << "Done with item loop:" << time.elapsed() << list.length(); } ui->actionStopLoad->setVisible(false); //Another check to ensure the current item is visible (or return to the same scroll position) if(stopload){ return; } //stop right now if(scrollpercent<0){ if(showDetails){ for(int t=0; t<treeWidget->columnCount(); t++){treeWidget->resizeColumnToContents(t); } if(treeWidget->currentItem()!=0){ treeWidget->scrollToItem(treeWidget->currentItem()); } }else{ if(listWidget->currentItem()!=0){ listWidget->scrollToItem(listWidget->currentItem()); } } }else{ if(showDetails){ treeWidget->verticalScrollBar()->setValue( qRound(treeWidget->verticalScrollBar()->maximum()*scrollpercent) ); }else{ listWidget->horizontalScrollBar()->setValue( qRound(listWidget->horizontalScrollBar()->maximum()*scrollpercent) ); } } if(stopload){ return; } //stop right now if(DEBUG){ qDebug() << "Assemble Status Message:" << time.elapsed(); } //Assemble any status message QString stats = QString(tr("Capacity: %1")).arg(LOS::FileSystemCapacity(CDIR)); if(list.length()>0){ stats.prepend("\t"); if(numdirs < list.length()){ //Has Files stats.prepend( QString(tr("Files: %1 (%2)")).arg(QString::number(list.length()-numdirs), LUtils::BytesToDisplaySize(filebytes)) ); } if(numdirs > 0){ //Has Dirs if(numdirs<list.length()){ stats.prepend(" / "); }//has files output already stats.prepend( QString(tr("Dirs: %1")).arg(QString::number(numdirs)) ); } } if(stopload){ return; } //stop right now if(!canmodify){ stats.prepend(tr("(Limited Access) ")); } ui->label_status->setText( stats.simplified() ); if(DEBUG){ qDebug() << "DONE:" << time.elapsed(); } if(showThumbs){ thumbThread = QtConcurrent::run(this, &DirWidget::startLoadThumbs); } }
TrashDialog::TrashDialog(QScriptValue notes, MainWindow *mainWindow, QWidget *parent) : MasterDialog(parent), ui(new Ui::TrashDialog) { this->mainWindow = mainWindow; ui->setupUi(this); setupMainSplitter(); QPushButton *button; ui->buttonBox->clear(); button = new QPushButton(tr("&Restore selected note on server")); button->setToolTip(tr("<h3>Slower, but with note versions</h3>" "<p>The note will be restored on your ownCloud " "server with all versions.</p>" "<p>You will have to wait until it is synced to " "QOwnNotes by ownCloud sync.</p>")); button->setProperty("ActionRole", RestoreOnServer); button->setDefault(false); button->setIcon(QIcon(":/images/breeze/view-restore.svg")); ui->buttonBox->addButton(button, QDialogButtonBox::ActionRole); button = new QPushButton(tr("&Download selected note")); button->setToolTip(tr("<h3>Faster, but without versions</h3>" "<p>The note will be created with the text from the preview.</p>" "<p>The note versions on your ownCloud server will not be restored " "and the note will remain in the trash.</p>" "<p>You can always restore the note and its versions later.</p>")); button->setProperty("ActionRole", Download); button->setDefault(false); button->setIcon(QIcon(":/images/breeze/edit-download.svg")); ui->buttonBox->addButton(button, QDialogButtonBox::ActionRole); button = new QPushButton(tr("&Cancel")); button->setProperty("ActionRole", Cancel); button->setIcon(QIcon(":/images/breeze/dialog-cancel.svg")); button->setDefault(true); ui->buttonBox->addButton(button, QDialogButtonBox::ActionRole); connect(this->ui->buttonBox, SIGNAL(clicked(QAbstractButton *)), SLOT(dialogButtonClicked(QAbstractButton *))); connect(this, SIGNAL(finished(int)), this, SLOT(storeSettings())); QString itemName; QString dateString; QString data; int timestamp; ui->trashListWidget->clear(); dataList = new QStringList(); timestampList = new QList<int>; // init the iterator for the versions QScriptValueIterator notesIterator(notes); // iterate over the trashed notes while (notesIterator.hasNext()) { notesIterator.next(); itemName = notesIterator.value().property("noteName").toString(); dateString = notesIterator.value().property("dateString").toString(); data = notesIterator.value().property("data").toString(); timestamp = notesIterator.value().property("timestamp").toInt32(); QString fileName = notesIterator.value().property("fileName").toString(); if (itemName == "") { continue; } QListWidgetItem *item = new QListWidgetItem(); item->setText(itemName); item->setWhatsThis(fileName); item->setToolTip(dateString); ui->trashListWidget->addItem(item); dataList->append(data); timestampList->append(timestamp); } ui->trashListWidget->setCurrentRow(0); ui->noteBrowser->setText(dataList->at(0)); }