void LLTeleportHistoryStorage::addItem(const std::string title, const LLVector3d& global_pos) { addItem(title, global_pos, LLDate::now()); }
bool CNPKReader::scanLocalHeader() { SNPKHeader header; // Read and validate the header File->read(&header, sizeof(header)); if (!isHeaderValid(header)) return false; // Seek to the table of contents #ifdef __BIG_ENDIAN__ header.Offset = os::Byteswap::byteswap(header.Offset); header.Length = os::Byteswap::byteswap(header.Length); #endif header.Offset += 8; core::stringc dirName; bool inTOC=true; // Loop through each entry in the table of contents while (inTOC && (File->getPos() < File->getSize())) { // read an entry char tag[4]={0}; SNPKFileEntry entry; File->read(tag, 4); const int numTag = MAKE_IRR_ID(tag[3],tag[2],tag[1],tag[0]); int size; bool isDir=true; switch (numTag) { case MAKE_IRR_ID('D','I','R','_'): { File->read(&size, 4); readString(entry.Name); entry.Length=0; entry.Offset=0; #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Dir", entry.Name); #endif } break; case MAKE_IRR_ID('F','I','L','E'): { File->read(&size, 4); File->read(&entry.Offset, 4); File->read(&entry.Length, 4); readString(entry.Name); isDir=false; #ifdef IRR_DEBUG_NPK_READER os::Printer::log("File", entry.Name); #endif #ifdef __BIG_ENDIAN__ entry.Offset = os::Byteswap::byteswap(entry.Offset); entry.Length = os::Byteswap::byteswap(entry.Length); #endif } break; case MAKE_IRR_ID('D','E','N','D'): { File->read(&size, 4); entry.Name=""; entry.Length=0; entry.Offset=0; const s32 pos = dirName.findLast('/', dirName.size()-2); if (pos==-1) dirName=""; else dirName=dirName.subString(0, pos); #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Dirend", dirName); #endif } break; default: inTOC=false; } // skip root dir if (isDir) { if (!entry.Name.size() || (entry.Name==".") || (entry.Name=="<noname>")) continue; dirName += entry.Name; dirName += "/"; } #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Name", entry.Name); #endif addItem((isDir?dirName:dirName+entry.Name), entry.Offset+header.Offset, entry.Length, isDir); } return true; }
View::View() : m_widg{new QWidget} { auto lay = new QFormLayout; m_widg->setLayout(lay); #if defined(HAS_VST2) m_VstPaths = new QListWidget; auto button_lay = new QHBoxLayout; auto pb = new QPushButton{"Add path"}; auto rescan = new QPushButton{"Rescan"}; button_lay->addWidget(pb); button_lay->addWidget(rescan); auto vst_lay = new QGridLayout; auto vst_ok = new QListWidget; auto vst_bad = new QListWidget; m_VstPaths->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu); connect( m_VstPaths, &QListWidget::customContextMenuRequested, this, [=](const QPoint& p) { QMenu* m = new QMenu; auto act = m->addAction("Remove"); connect(act, &QAction::triggered, this, [=] { auto idx = m_VstPaths->currentRow(); if (idx >= 0 && idx < m_curitems.size()) { m_VstPaths->takeItem(idx); m_curitems.removeAt(idx); VstPathsChanged(m_curitems); } }); m->exec(m_VstPaths->mapToGlobal(p)); m->deleteLater(); }); lay->addRow(tr("VST paths"), m_VstPaths); lay->addRow(button_lay); connect(pb, &QPushButton::clicked, this, [=] { auto path = QFileDialog::getExistingDirectory(m_widg, tr("VST Path")); if (!path.isEmpty()) { m_VstPaths->addItem(path); m_curitems.push_back(path); VstPathsChanged(m_curitems); } }); auto& app_plug = score::GUIAppContext().applicationPlugin<Media::ApplicationPlugin>(); connect(rescan, &QPushButton::clicked, this, [&] { app_plug.rescanVSTs(m_curitems); }); auto reloadVSTs = [=, &app_plug] { vst_ok->clear(); vst_bad->clear(); for (auto& plug : app_plug.vst_infos) { if (plug.isValid) { vst_ok->addItem(QString{"%1 - %2\t(%3)"} .arg(plug.prettyName) .arg(plug.displayName) .arg(plug.path)); } else { vst_bad->addItem(QString{"%1 - %2\t(%3)"} .arg(plug.prettyName) .arg(plug.displayName) .arg(plug.path)); } } }; reloadVSTs(); con(app_plug, &Media::ApplicationPlugin::vstChanged, this, reloadVSTs); lay->addRow(vst_lay); vst_lay->addWidget(new QLabel("Working plug-ins"), 0, 0, 1, 1); vst_lay->addWidget(new QLabel("Bad plug-ins"), 0, 1, 1, 1); vst_lay->addWidget(vst_ok, 1, 0, 1, 1); vst_lay->addWidget(vst_bad, 1, 1, 1, 1); #endif }
ConfigInt::ConfigInt(Configuration* config, QString name, int value) : ConfigItem(config, name) { _value = value; addItem(); }
void SpawnShell::newSpawn(const spawnStruct& s) { #ifdef SPAWNSHELL_DIAG seqDebug("SpawnShell::newSpawn(spawnStruct *(name='%s'))", s.name); #endif // if this is the SPAWN_SELF it's the player if (s.NPC == SPAWN_SELF) return; // not the player, so check if it's a recently deleted spawn for (int i =0; i < m_cntDeadSpawnIDs; i++) { if ((m_deadSpawnID[i] != 0) && (m_deadSpawnID[i] == s.spawnId)) { // found a match, remove it from the deleted spawn list m_deadSpawnID[i] = 0; /* Commented this out because it wasn't adding shrouded spawns. Shrouded spawns get deleted from the zone first then added as a new spawn. leaving this here in case another work-around needs to be found. (ieatacid - 6-8-2008) // let the user know what's going on seqInfo("%s(%d) has already been removed from the zone before we processed it.", s.name, s.spawnId); // and stop the attempt to add the spawn. return; */ } } Item* item = m_spawns.find(s.spawnId); if (item != NULL) { Spawn* spawn = (Spawn*)item; spawn->update(&s); updateFilterFlags(spawn); updateRuntimeFilterFlags(spawn); item->updateLastChanged(); if (spawn->guildID() < MAX_GUILDS) spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID())); else spawn->setGuildTag(""); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); emit changeItem(item, tSpawnChangedALL); } else { item = new Spawn(&s); Spawn* spawn = (Spawn*)item; updateFilterFlags(spawn); updateRuntimeFilterFlags(spawn); m_spawns.insert(s.spawnId, item); if (spawn->guildID() < MAX_GUILDS) spawn->setGuildTag(m_guildMgr->guildIdToName(spawn->guildID())); else spawn->setGuildTag(""); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); emit addItem(item); // send notification of new spawn count emit numSpawns(m_spawns.count()); } }
void AddRemoveListWidget::setItemsText(const QStringList& texts) { for(int i=0; i < texts.count(); i++) { addItem(texts[i]); } m_list->sortItems(); }
int TableViewImpl::newRow(ItemProperties itemProp) { int r = rowCount; rowCount += addItem(r+1,itemProp); return r; }
void Inventory::addItems(vector<PItem> v) { for (PItem& it : v) addItem(std::move(it)); }
void RimWellPathCollection::WellVisibilityEnum::setUp() { addItem(RimWellPathCollection::FORCE_ALL_OFF, "FORCE_ALL_OFF", "Off"); addItem(RimWellPathCollection::ALL_ON, "ALL_ON", "Individual"); addItem(RimWellPathCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On"); }
/// Adds an arrow object to the diagram which might be used as a coordinate axis, etc. QArrow* DiagramScene::addArrow(float length, float angle, QPen &pen) { QArrow* arrow = new QArrow(length, angle, 8, 5, pen); addItem(arrow); return arrow; }
void DialogSelectHardware::ChangeText(int indexDevice) { int driverVersion = 0, runtimeVersion = 0; cudaSetDevice(indexDevice); cudaGetDeviceProperties(deviceProp, indexDevice); cudaDriverGetVersion(&driverVersion); cudaRuntimeGetVersion(&runtimeVersion); char msg[256]; SPRINTF(msg,"%.0f MBytes (%llu bytes)\n", (float)deviceProp->totalGlobalMem/1048576.0f, (unsigned long long) deviceProp->totalGlobalMem); ui->tableWidget->clear(); addItem(QString ("Device "+QString::number(indexDevice).append(" : ")+ deviceProp->name),0,0); addItem((selectDevice == indexDevice) ? "Dispositivo Seleccionado " : " ",0,1); addItem("CUDA Driver Version / Runtime Version",1,0); addItem(QString ("%1.%2 / %3.%4").arg(driverVersion/1000).arg((driverVersion%100)/10).arg( runtimeVersion/1000).arg((runtimeVersion%100)/10),1,1); addItem("CUDA Capability Major/Minor version number: ",2,0); addItem(QString ("%1.%2").arg(deviceProp->major).arg(deviceProp->minor),2,1); addItem("Total amount of global memory:",3,0); addItem(msg,3,1); addItem(QString ("(%1) Multiprocessors, (%2) CUDA Cores/MP:%3 CUDA Cores").arg( deviceProp->multiProcessorCount).arg( _ConvertSMVer2Cores(deviceProp->major, deviceProp->minor)).arg( _ConvertSMVer2Cores(deviceProp->major, deviceProp->minor) * deviceProp->multiProcessorCount),4,0); addItem("Total amount of constant memory:",5,0); addItem(QString ("%1 bytes").arg(deviceProp->totalConstMem),5,1); addItem("Total amount of shared memory per block:",6,0); addItem(QString ("%1 bytes").arg(deviceProp->sharedMemPerBlock),6,1); addItem("Total number of registers available per block:",7,0); addItem(QString ("%1").arg(deviceProp->regsPerBlock),7,1); addItem("Warp size:",8,0); addItem(QString ("%1").arg(deviceProp->warpSize),8,1); addItem("Maximum number of threads per multiprocessor:",9,0); addItem(QString ("%1").arg(deviceProp->maxThreadsPerMultiProcessor),9,1); addItem("Maximum number of threads per block:",10,0); addItem(QString ("%1").arg(deviceProp->maxThreadsPerBlock),10,1); addItem("Max dimension size of a thread block (x,y,z):",11,0); addItem(QString ("(%1, %2, %3)").arg(deviceProp->maxThreadsDim[0]).arg( deviceProp->maxThreadsDim[1]).arg( deviceProp->maxThreadsDim[2]),11,1); addItem("Max dimension size of a grid size (x,y,z):",12,0); addItem(QString ("(%1, %2, %3)\n").arg(deviceProp->maxGridSize[0]).arg(deviceProp->maxGridSize[1]).arg(deviceProp->maxGridSize[2]),12,1); addItem("Run time limit on kernels: ",13,0); addItem(QString ("%1\n").arg(deviceProp->kernelExecTimeoutEnabled ? "Yes" : "No"),13,1); addItem("Integrated GPU sharing Host Memory: ",14,0); addItem( QString ("%1\n").arg(deviceProp->integrated ? "Yes" : "No"),14,1); ui->tableWidget->resizeColumnsToContents(); ui->tableWidget->resizeRowsToContents(); }
/// Adds a grid-object to the scene QGraphicsGrid* DiagramScene::addGrid(const QRectF &rect, int xTicks, int yTicks, const QPen &pen) { QGraphicsGrid* g = new QGraphicsGrid(rect, xTicks, yTicks, true, pen); addItem(g); return g; }
void SimpleUI::addItem( const string& name,const string* tex,int count ) { for( int i=0;i<count;++i ) addItem( name,tex[i] ); }
void ColourWindowBox::addColourItem(const MyGUI::Colour& _colour, const std::string& _name) { addItem(new ColourWindowCellData(_colour, _name)); }
void PLSelector::createItems() { /* PL */ playlistItem = putPLData( addItem( PL_ITEM_TYPE, N_("Playlist"), true ), THEPL->p_playing ); playlistItem->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_PL ) ); setCurrentItem( playlistItem->treeItem() ); /* ML */ PLSelItem *ml = putPLData( addItem( PL_ITEM_TYPE, N_("Media Library"), true ), THEPL->p_media_library ); ml->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_ML ) ); #ifdef MEDIA_LIBRARY /* SQL ML */ addItem( SQL_ML_TYPE, "SQL Media Library" )->treeItem(); #endif /* SD nodes */ QTreeWidgetItem *mycomp = addItem( CATEGORY_TYPE, N_("My Computer") )->treeItem(); QTreeWidgetItem *devices = addItem( CATEGORY_TYPE, N_("Devices") )->treeItem(); QTreeWidgetItem *lan = addItem( CATEGORY_TYPE, N_("Local Network") )->treeItem(); QTreeWidgetItem *internet = addItem( CATEGORY_TYPE, N_("Internet") )->treeItem(); #define NOT_SELECTABLE(w) w->setFlags( w->flags() ^ Qt::ItemIsSelectable ); NOT_SELECTABLE( mycomp ); NOT_SELECTABLE( devices ); NOT_SELECTABLE( lan ); NOT_SELECTABLE( internet ); #undef NOT_SELECTABLE /* SD subnodes */ char **ppsz_longnames; int *p_categories; char **ppsz_names = vlc_sd_GetNames( THEPL, &ppsz_longnames, &p_categories ); if( !ppsz_names ) return; char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames; int *p_category = p_categories; for( ; *ppsz_name; ppsz_name++, ppsz_longname++, p_category++ ) { //msg_Dbg( p_intf, "Adding a SD item: %s", *ppsz_longname ); PLSelItem *selItem; switch( *p_category ) { case SD_CAT_INTERNET: { selItem = addItem( SD_TYPE, *ppsz_longname, false, internet ); if( !strncmp( *ppsz_name, "podcast", 7 ) ) { selItem->treeItem()->setData( 0, SPECIAL_ROLE, QVariant( IS_PODCAST ) ); selItem->addAction( ADD_ACTION, qtr( "Subscribe to a podcast" ) ); CONNECT( selItem, action( PLSelItem* ), this, podcastAdd( PLSelItem* ) ); podcastsParent = selItem->treeItem(); } } break; case SD_CAT_DEVICES: selItem = addItem( SD_TYPE, *ppsz_longname, false, devices ); break; case SD_CAT_LAN: selItem = addItem( SD_TYPE, *ppsz_longname, false, lan ); break; case SD_CAT_MYCOMPUTER: selItem = addItem( SD_TYPE, *ppsz_longname, false, mycomp ); break; default: selItem = addItem( SD_TYPE, *ppsz_longname ); } putSDData( selItem, *ppsz_name, *ppsz_longname ); free( *ppsz_name ); free( *ppsz_longname ); }
void Config::add() { QString empty = "Test"; addItem(empty, empty, empty); emit changed(); }
void CurvedTreeGraphicsScene::highlight(double x, double y) { //Look for a line close to the mouse position. //If multiple lines are found, choose the closest. CurvedTreeLine * closestLine = 0; double closestDistance = std::numeric_limits<double>::max(); for (std::list<CurvedTreeLine *>::iterator i = m_lines.begin(); i != m_lines.end(); ++i) { (*i)->setZValue(0.0); double distance; if ((*i)->containsPoint(x, y, g_settings->treeLineSelectionMargin, &distance)) { if (distance < closestDistance) { closestLine = *i; closestDistance = distance; } } } //If no line was found, clear the highlighting. if (closestLine == 0) { stopHighlighting(); return; } //Bring the closest line to the top, so its highlighting won't //be obscured by other lines. closestLine->setZValue(1.0); //Find the history data point that best matches the selection location. double dateOfMousePosition = m_lastLoggedDateInTree * (1.0 - (y / height())); if (dateOfMousePosition < closestLine->m_startDate) dateOfMousePosition = closestLine->m_startDate; if (dateOfMousePosition > closestLine->m_endDate) dateOfMousePosition = closestLine->m_endDate; boost::shared_ptr<HistoryDataPoint> closestHistoryPoint = g_history->getClosestHistoryPoint(dateOfMousePosition); long long closestDate = closestHistoryPoint->m_date; //Now send the history landscape data to the widget that will show it. g_mainWindow->m_landscapeHistoryWidget->m_landscapeThumbnail = &closestHistoryPoint->m_landscapeThumbnail; g_mainWindow->m_landscapeHistoryWidget->update(); g_mainWindow->setHistoryDate(closestDate); //If the selection is different from the current one, set up highlighting! if (closestLine != m_highlightedLine || closestDate != m_selectionDate) { //Determine the y coordinate associated with the selection date int steps = closestDate / g_settings->speciesCheckInterval; double dotY = height() - steps * g_settings->treeStepHeight; //First, highlight the line itself if (m_highlightedLine != 0) m_highlightedLine->unhighlight(); m_highlightedLine = closestLine; m_selectionDate = closestDate; closestLine->highlight(PARTIAL_LINE, dotY); updateTree(); if (g_settings->simulationShown) m_landscapeView->viewport()->update(); //Now create a selection dot at the date nearest the mouse double dotX = closestLine->getX(steps); m_selectionDot.reset(new QGraphicsEllipseItem(dotX - g_settings->treeSelectionDotDiameter / 2.0, dotY - g_settings->treeSelectionDotDiameter / 2.0, g_settings->treeSelectionDotDiameter, g_settings->treeSelectionDotDiameter)); m_selectionDot->setPen(Qt::NoPen); m_selectionDot->setBrush(Qt::red); m_selectionDot->setZValue(2.0); addItem(m_selectionDot.get()); //Now send the history organism to the widget that will show it. int speciesNumber = closestLine->m_species->m_speciesNumber; Organism * historyOrganism = closestHistoryPoint->m_randomOrganismForEachSpecies[speciesNumber]; g_mainWindow->m_historyOrganismWidget->m_organism = historyOrganism; g_mainWindow->m_historyOrganismWidget->update(); g_mainWindow->setHistorySpecies(speciesNumber); //Finally, give the species positions to be displayed on the landscape thumbnail g_mainWindow->m_landscapeHistoryWidget->m_organismPositions = &(closestHistoryPoint->m_organismLocationsForEachSpecies[speciesNumber]); } //If a line was found but it's the same line and at the same date as //the currently highlighted one, then there's nothing to do. }
//! Adds a separator item to the menu void CGUIContextMenu::addSeparator() { addItem(0, -1, true, false, false); }
void AddRemoveListWidget::addItem() { addItem(m_label->text().toLower().remove("s:")); }
QBooleanComboBox::QBooleanComboBox(QWidget *parent) : QComboBox(parent) { addItem(QComboBox::tr("False")); addItem(QComboBox::tr("True")); }
ConfigBool::ConfigBool(Configuration* tree, QString name, bool value) : ConfigItem(tree, name) { _value = value; addItem(); }
void TToolBox::addPage(QWidget *page, const QString &title) { addItem(page, m_icon, title); }
ConfigDouble::ConfigDouble(Configuration* config, QString name, double value) : ConfigItem(config, name) { _value = value; addItem(); }
GeneralSettingsPage::GeneralSettingsPage(QWidget* parent) : SettingsPage(parent) , translation_file(getSetting(Settings::General_TranslationFile).toString()) { auto layout = new QFormLayout(this); layout->addRow(Util::Headline::create(tr("Appearance"))); auto language_widget = new QWidget(); auto language_layout = new QHBoxLayout(language_widget); language_layout->setContentsMargins({}); layout->addRow(tr("Language:"), language_widget); language_box = new QComboBox(this); language_layout->addWidget(language_box); QAbstractButton* language_file_button = new QToolButton(); language_file_button->setIcon(QIcon(QLatin1String(":/images/open.png"))); language_layout->addWidget(language_file_button); layout->addItem(Util::SpacerItem::create(this)); layout->addRow(Util::Headline::create(tr("Screen"))); auto ppi_widget = new QWidget(); auto ppi_layout = new QHBoxLayout(ppi_widget); ppi_layout->setContentsMargins({}); layout->addRow(tr("Pixels per inch:"), ppi_widget); ppi_edit = Util::SpinBox::create(2, 0.01, 9999); ppi_layout->addWidget(ppi_edit); QAbstractButton* ppi_calculate_button = new QToolButton(); ppi_calculate_button->setIcon(QIcon(QLatin1String(":/images/settings.png"))); ppi_layout->addWidget(ppi_calculate_button); layout->addItem(Util::SpacerItem::create(this)); layout->addRow(Util::Headline::create(tr("Program start"))); open_mru_check = new QCheckBox(AbstractHomeScreenWidget::tr("Open most recently used file")); layout->addRow(open_mru_check); tips_visible_check = new QCheckBox(AbstractHomeScreenWidget::tr("Show tip of the day")); layout->addRow(tips_visible_check); layout->addItem(Util::SpacerItem::create(this)); layout->addRow(Util::Headline::create(tr("Saving files"))); compatibility_check = new QCheckBox(tr("Retain compatibility with Mapper %1").arg(QLatin1String("0.5"))); layout->addRow(compatibility_check); // Possible point: limit size of undo/redo journal autosave_check = new QCheckBox(tr("Save information for automatic recovery")); layout->addRow(autosave_check); autosave_interval_edit = Util::SpinBox::create(1, 120, tr("min", "unit minutes"), 1); layout->addRow(tr("Recovery information saving interval:"), autosave_interval_edit); layout->addItem(Util::SpacerItem::create(this)); layout->addRow(Util::Headline::create(tr("File import and export"))); encoding_box = new QComboBox(); encoding_box->addItem(QLatin1String("System")); encoding_box->addItem(QLatin1String("Windows-1250")); encoding_box->addItem(QLatin1String("Windows-1252")); encoding_box->addItem(QLatin1String("ISO-8859-1")); encoding_box->addItem(QLatin1String("ISO-8859-15")); encoding_box->setEditable(true); QStringList availableCodecs; for (const QByteArray& item : QTextCodec::availableCodecs()) { availableCodecs.append(QString::fromUtf8(item)); } if (!availableCodecs.empty()) { availableCodecs.sort(Qt::CaseInsensitive); availableCodecs.removeDuplicates(); encoding_box->addItem(tr("More...")); } QCompleter* completer = new QCompleter(availableCodecs, this); completer->setCaseSensitivity(Qt::CaseInsensitive); encoding_box->setCompleter(completer); layout->addRow(tr("8-bit encoding:"), encoding_box); ocd_importer_check = new QCheckBox(tr("Use the new OCD importer also for version 8 files").replace("8", "6-8")); layout->addRow(ocd_importer_check); updateWidgets(); connect(language_file_button, &QAbstractButton::clicked, this, &GeneralSettingsPage::openTranslationFileDialog); connect(ppi_calculate_button, &QAbstractButton::clicked, this, &GeneralSettingsPage::openPPICalculationDialog); connect(encoding_box, &QComboBox::currentTextChanged, this, &GeneralSettingsPage::encodingChanged); connect(autosave_check, &QAbstractButton::toggled, autosave_interval_edit, &QWidget::setEnabled); connect(autosave_check, &QAbstractButton::toggled, layout->labelForField(autosave_interval_edit), &QWidget::setEnabled); }
Configuration::Configuration(Applet *applet, KConfigDialog *parent) : QObject(parent), m_applet(applet), m_editedLauncher(NULL) { KConfigGroup configuration = m_applet->config(); KMenu *addLauncherMenu = new KMenu(parent); QWidget *generalWidget = new QWidget; QWidget *appearanceWidget = new QWidget; QWidget *arrangementWidget = new QWidget; QWidget *actionsWidget = new QWidget; QAction *addLauncherApplicationAction = addLauncherMenu->addAction(KIcon("application-x-executable"), i18n("Add Application...")); QAction *addLauncherFromFileAction = addLauncherMenu->addAction(KIcon("inode-directory"), i18n("Add File or Directory...")); QAction *addMenuLauncher = addLauncherMenu->addAction(KIcon("start-here"), i18n("Add Menu")); KMenu *addMenuLauncherMenu = new KMenu(addLauncherMenu); addMenuLauncher->setMenu(addMenuLauncherMenu); QAction *action = addMenuLauncherMenu->addAction(QString()); action->setData("/"); action->setVisible(false); m_generalUi.setupUi(generalWidget); m_appearanceUi.setupUi(appearanceWidget); m_arrangementUi.setupUi(arrangementWidget); m_actionsUi.setupUi(actionsWidget); connectWidgets(generalWidget); connectWidgets(appearanceWidget); m_arrangementUi.addLauncherButton->setMenu(addLauncherMenu); m_generalUi.groupingStrategy->addItem(i18n("Do Not Group"), QVariant(TaskManager::GroupManager::NoGrouping)); m_generalUi.groupingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualGrouping)); m_generalUi.groupingStrategy->addItem(i18n("By Program Name"), QVariant(TaskManager::GroupManager::ProgramGrouping)); m_generalUi.groupingStrategy->setCurrentIndex(m_generalUi.groupingStrategy->findData(QVariant(configuration.readEntry("groupingStrategy", static_cast<int>(TaskManager::GroupManager::NoGrouping))))); m_generalUi.sortingStrategy->addItem(i18n("Do Not Sort"), QVariant(TaskManager::GroupManager::NoSorting)); m_generalUi.sortingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualSorting)); m_generalUi.sortingStrategy->addItem(i18n("Alphabetically"), QVariant(TaskManager::GroupManager::AlphaSorting)); m_generalUi.sortingStrategy->addItem(i18n("By Desktop"), QVariant(TaskManager::GroupManager::DesktopSorting)); m_generalUi.sortingStrategy->setCurrentIndex(m_generalUi.sortingStrategy->findData(QVariant(configuration.readEntry("sortingStrategy", static_cast<int>(TaskManager::GroupManager::ManualSorting))))); m_generalUi.showOnlyCurrentDesktop->setChecked(configuration.readEntry("showOnlyCurrentDesktop", false)); m_generalUi.showOnlyCurrentActivity->setChecked(configuration.readEntry("showOnlyCurrentActivity", true)); m_generalUi.showOnlyCurrentScreen->setChecked(configuration.readEntry("showOnlyCurrentScreen", false)); m_generalUi.showOnlyMinimized->setChecked(configuration.readEntry("showOnlyMinimized", false)); m_generalUi.showOnlyTasksWithLaunchers->setChecked(configuration.readEntry("showOnlyTasksWithLaunchers", false)); m_generalUi.connectJobsWithTasks->setChecked(configuration.readEntry("connectJobsWithTasks", false)); m_generalUi.groupJobs->setChecked(configuration.readEntry("groupJobs", true)); m_generalUi.jobCloseMode->addItem(i18n("Instantly"), QVariant(InstantClose)); m_generalUi.jobCloseMode->addItem(i18n("After delay"), QVariant(DelayedClose)); m_generalUi.jobCloseMode->addItem(i18n("Manually"), QVariant(ManualClose)); m_generalUi.jobCloseMode->setCurrentIndex(m_generalUi.jobCloseMode->findData(QVariant(configuration.readEntry("jobCloseMode", static_cast<int>(DelayedClose))))); QStringList moveAnimationNames; moveAnimationNames << i18n("None") << i18n("Zoom") << i18n("Jump") << i18n("Spotlight") << i18n("Glow") << i18n("Fade"); QList<AnimationType> moveAnimationIds; moveAnimationIds << NoAnimation << ZoomAnimation << JumpAnimation << SpotlightAnimation << GlowAnimation << FadeAnimation; for (int i = 0; i < moveAnimationIds.count(); ++i) { m_appearanceUi.moveAnimation->addItem(moveAnimationNames.at(i), QVariant(moveAnimationIds.at(i))); } QStringList iconAnimationNames; iconAnimationNames << i18n("None") << i18n("Bounce") << i18n("Zoom") << i18n("Blink") << i18n("Spotlight") << i18n("Rotate") << i18n("Glow"); QList<AnimationType> iconAnimationIds; iconAnimationIds << NoAnimation << BounceAnimation << ZoomAnimation << BlinkAnimation << SpotlightAnimation << RotateAnimation << GlowAnimation; for (int i = 0; i < iconAnimationIds.count(); ++i) { m_appearanceUi.demandsAttentionAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i))); m_appearanceUi.startupAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i))); } m_appearanceUi.titleLabelMode->addItem(i18n("Never"), QVariant(NoLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("On mouse-over"), QVariant(MouseOverLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("For active icon"), QVariant(ActiveIconLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("Always"), QVariant(AlwaysShowLabel)); m_appearanceUi.titleLabelMode->setCurrentIndex(m_appearanceUi.titleLabelMode->findData(QVariant(configuration.readEntry("titleLabelMode", static_cast<int>(AlwaysShowLabel))))); m_appearanceUi.activeIconIndication->addItem(i18n("None"), QVariant(NoIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Zoom"), QVariant(ZoomIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Glow"), QVariant(GlowIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Fade"), QVariant(FadeIndication)); m_appearanceUi.activeIconIndication->setCurrentIndex(m_appearanceUi.activeIconIndication->findData(QVariant(configuration.readEntry("activeIconIndication", static_cast<int>(FadeIndication))))); m_appearanceUi.customBackgroundImage->setUrl(KUrl(configuration.readEntry("customBackgroundImage", QString()))); m_appearanceUi.customBackgroundImage->setFilter("image/svg+xml image/svg+xml-compressed"); if (m_applet->location() != Plasma::Floating && (!m_applet->containment() || m_applet->containment()->objectName() != "FancyPanel")) { m_appearanceUi.customBackgroundImageLabel->hide(); m_appearanceUi.customBackgroundImage->hide(); } m_appearanceUi.moveAnimation->setCurrentIndex(moveAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("moveAnimation", static_cast<int>(GlowAnimation))))); m_appearanceUi.parabolicMoveAnimation->setChecked(configuration.readEntry("parabolicMoveAnimation", false)); m_appearanceUi.demandsAttentionAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("demandsAttentionAnimation", static_cast<int>(BlinkAnimation))))); m_appearanceUi.startupAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("startupAnimation", static_cast<int>(BounceAnimation))))); m_arrangementUi.removeButton->setIcon(KIcon("go-previous")); m_arrangementUi.addButton->setIcon(KIcon("go-next")); m_arrangementUi.moveUpButton->setIcon(KIcon("go-up")); m_arrangementUi.moveDownButton->setIcon(KIcon("go-down")); KConfig kickoffConfiguration("kickoffrc", KConfig::NoGlobals); KConfigGroup favoritesGroup(&kickoffConfiguration, "Favorites"); const QStringList currentEntries = configuration.readEntry("arrangement", QStringList("tasks")); QStringList availableEntries; availableEntries << i18n("--- separator ---") << i18n("--- tasks area ---") << i18n("--- jobs area ---") << "menu:/"; availableEntries.append(favoritesGroup.readEntry("FavoriteURLs", QStringList())); for (int i = 0; i < currentEntries.count(); ++i) { QListWidgetItem *item = NULL; if (currentEntries.at(i) == "tasks") { item = new QListWidgetItem(i18n("--- tasks area ---"), m_arrangementUi.currentEntriesListWidget); } else if (currentEntries.at(i) == "jobs") { item = new QListWidgetItem(i18n("--- jobs area ---"), m_arrangementUi.currentEntriesListWidget); } else if (currentEntries.at(i) == "separator") { item = new QListWidgetItem(i18n("--- separator ---"), m_arrangementUi.currentEntriesListWidget); } else { if (hasEntry(currentEntries.at(i), false)) { continue; } Launcher *launcher = m_applet->launcherForUrl(KUrl(currentEntries.at(i))); if (!launcher) { continue; } item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.currentEntriesListWidget); item->setToolTip(launcher->launcherUrl().pathOrUrl()); m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded()); } m_arrangementUi.currentEntriesListWidget->addItem(item); } for (int i = 0; i < availableEntries.count(); ++i) { if (i > 0 && hasEntry(availableEntries.at(i), false)) { continue; } QListWidgetItem *item = NULL; if (availableEntries.at(i).startsWith("--- ")) { item = new QListWidgetItem(availableEntries.at(i), m_arrangementUi.availableEntriesListWidget); } else { Launcher *launcher = m_applet->launcherForUrl(KUrl(availableEntries.at(i))); if (!launcher) { continue; } item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.availableEntriesListWidget); item->setToolTip(launcher->launcherUrl().pathOrUrl()); m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded()); } m_arrangementUi.availableEntriesListWidget->addItem(item); } QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction> iconActions = m_applet->iconActions(); QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction>::iterator iterator; int i = 0; m_actionsUi.actionsTableWidget->setItemDelegateForColumn(0, new ActionDelegate(this)); m_actionsUi.actionsTableWidget->setItemDelegateForColumn(1, new TriggerDelegate(this)); for (iterator = iconActions.begin(); iterator != iconActions.end(); ++iterator) { if (iterator.key().first == Qt::NoButton) { continue; } QStringList action; if (iterator.key().first & Qt::LeftButton) { action.append("left"); } if (iterator.key().first & Qt::MiddleButton) { action.append("middle"); } if (iterator.key().first & Qt::RightButton) { action.append("right"); } if (iterator.key().second & Qt::ShiftModifier) { action.append("shift"); } if (iterator.key().second & Qt::ControlModifier) { action.append("ctrl"); } if (iterator.key().second & Qt::AltModifier) { action.append("alt"); } QTableWidgetItem *triggerItem = new QTableWidgetItem(action.join(QChar('+'))); triggerItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled); QTableWidgetItem *actionItem = new QTableWidgetItem(QString::number(static_cast<int>(iterator.value()))); actionItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled); m_actionsUi.actionsTableWidget->setRowCount(i + 1); m_actionsUi.actionsTableWidget->setItem(i, 0, actionItem); m_actionsUi.actionsTableWidget->setItem(i, 1, triggerItem); ++i; } moveAnimationTypeChanged(m_appearanceUi.moveAnimation->currentIndex()); parent->addPage(generalWidget, i18n("General"), "go-home"); parent->addPage(appearanceWidget, i18n("Appearance"), "preferences-desktop-theme"); parent->addPage(arrangementWidget, i18n("Arrangement"), "format-list-unordered"); parent->addPage(actionsWidget, i18n("Actions"), "configure-shortcuts"); connect(parent, SIGNAL(applyClicked()), this, SLOT(save())); connect(parent, SIGNAL(okClicked()), this, SLOT(save())); connect(m_appearanceUi.moveAnimation, SIGNAL(currentIndexChanged(int)), this, SLOT(moveAnimationTypeChanged(int))); connect(m_appearanceUi.customBackgroundImage, SIGNAL(textChanged(QString)), this, SLOT(modify())); connect(m_arrangementUi.availableEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(availableEntriesCurrentItemChanged(int))); connect(m_arrangementUi.currentEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentEntriesCurrentItemChanged(int))); connect(m_arrangementUi.removeButton, SIGNAL(clicked()), this, SLOT(removeItem())); connect(m_arrangementUi.addButton, SIGNAL(clicked()), this, SLOT(addItem())); connect(m_arrangementUi.moveUpButton, SIGNAL(clicked()), this, SLOT(moveUpItem())); connect(m_arrangementUi.moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownItem())); connect(m_arrangementUi.editLauncherButton, SIGNAL(clicked()), this, SLOT(editLauncher())); connect(m_actionsUi.actionsTableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(actionClicked(QModelIndex))); connect(m_actionsUi.actionsTableWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(actionSelectionChanged())); connect(m_actionsUi.addButton, SIGNAL(clicked()), this, SLOT(addAction())); connect(m_actionsUi.removeButton, SIGNAL(clicked()), this, SLOT(removeAction())); connect(addLauncherApplicationAction, SIGNAL(triggered()), this, SLOT(findLauncher())); connect(addLauncherFromFileAction, SIGNAL(triggered()), this, SLOT(addLauncher())); connect(addMenuLauncherMenu, SIGNAL(aboutToShow()), this, SLOT(populateMenu())); connect(addMenuLauncherMenu, SIGNAL(triggered(QAction*)), this, SLOT(addMenu(QAction*))); }
bool LuaList::addItemAndSave(LuaContainer* container) { addItem(container); return save(container); }
void LR1State::addItemsRange(const Grammar::RuleRange & ruleRange, SymbolSet && lookahead) { for(Grammar::RuleIterator ruleIt = ruleRange.first; ruleIt != ruleRange.second; ++ruleIt) addItem(ruleIt->second, ruleIt->second.symbols.begin(), SymbolSet(lookahead)); }
void ResearchSelect::populateResearchList() { auto research_list = form->findControlTyped<ListBox>("LIST"); research_list->clear(); research_list->ItemSize = 20; research_list->ItemSpacing = 1; for (auto &t : state->research.topic_list) { if (t->type != this->lab->type) { continue; } if (!t->dependencies.satisfied(state->current_base) && t->started == false) { continue; } // FIXME: When we get font coloring, set light blue color for topics too large a size bool too_large = (t->required_lab_size == ResearchTopic::LabSize::Large && this->lab->size == ResearchTopic::LabSize::Small); std::ignore = too_large; auto control = mksp<Control>(); control->Size = {544, 20}; auto topic_name = control->createChild<Label>((t->name), ui().getFont("smalfont")); topic_name->Size = {200, 20}; topic_name->Location = {6, 0}; if (this->lab->type == ResearchTopic::Type::Engineering || ((this->lab->type == ResearchTopic::Type::BioChem || this->lab->type == ResearchTopic::Type::Physics) && t->isComplete())) { UString progress_text; if (this->lab->type == ResearchTopic::Type::Engineering) progress_text = format("$%d", t->cost); else progress_text = tr("Complete"); auto progress_label = control->createChild<Label>(progress_text, ui().getFont("smalfont")); progress_label->Size = {100, 20}; progress_label->Location = {234, 0}; } else { float projectProgress = clamp((float)t->man_hours_progress / (float)t->man_hours, 0.0f, 1.0f); auto progressBar = control->createChild<Graphic>(); progressBar->Size = {101, 6}; progressBar->Location = {234, 4}; auto progressImage = mksp<RGBImage>(progressBar->Size); int redWidth = progressBar->Size.x * projectProgress; { // FIXME: For some reason, there's no border here like in the research sceen, so we // have to make one manually, probably there's a better way RGBImageLock l(progressImage); for (int y = 0; y < 2; y++) { for (int x = 0; x < progressBar->Size.x; x++) { if (x < redWidth) l.set({x, y}, {255, 0, 0, 255}); else l.set({x, y}, {77, 77, 77, 255}); } } l.set({0, 2}, {77, 77, 77, 255}); l.set({progressBar->Size.x - 1, 2}, {77, 77, 77, 255}); l.set({0, 3}, {130, 130, 130, 255}); l.set({progressBar->Size.x - 1, 3}, {130, 130, 130, 255}); l.set({0, 4}, {140, 140, 140, 255}); l.set({progressBar->Size.x - 1, 4}, {140, 140, 140, 255}); for (int x = 0; x < progressBar->Size.x; x++) { l.set({x, 5}, {205, 205, 205, 255}); } } progressBar->setImage(progressImage); } int skill_total = 0; switch (this->lab->type) { case ResearchTopic::Type::BioChem: case ResearchTopic::Type::Physics: if (t->current_lab) skill_total = t->current_lab->getTotalSkill(); break; case ResearchTopic::Type::Engineering: skill_total = t->man_hours; break; default: break; } auto skill_total_label = control->createChild<Label>(format("%d", skill_total), ui().getFont("smalfont")); skill_total_label->Size = {50, 20}; skill_total_label->Location = {328, 0}; skill_total_label->TextHAlign = HorizontalAlignment::Right; UString labSize; switch (t->required_lab_size) { case ResearchTopic::LabSize::Small: labSize = tr("Small"); break; case ResearchTopic::LabSize::Large: labSize = tr("Large"); break; default: labSize = tr("UNKNOWN"); break; } auto lab_size_label = control->createChild<Label>(labSize, ui().getFont("smalfont")); lab_size_label->Size = {100, 20}; lab_size_label->Location = {439, 0}; control->setData(t); research_list->addItem(control); control_map[t] = control; } }
ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal width, ChatView *parent) : QGraphicsScene(0, 0, width, 0, (QObject *)parent), _chatView(parent), _idString(idString), _model(model), _singleBufferId(BufferId()), _sceneRect(0, 0, width, 0), _firstLineRow(-1), _viewportHeight(0), _markerLine(new MarkerLineItem(width)), _markerLineVisible(false), _markerLineValid(false), _markerLineJumpPending(false), _cutoffMode(CutoffRight), _selectingItem(0), _selectionStart(-1), _isSelecting(false), _clickMode(NoClick), _clickHandled(true), _leftButtonPressed(false) { MessageFilter *filter = qobject_cast<MessageFilter *>(model); if (filter && filter->isSingleBufferFilter()) { _singleBufferId = filter->singleBufferId(); } addItem(_markerLine); connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _markerLine, SLOT(sceneRectChanged(const QRectF &))); ChatViewSettings defaultSettings; _defaultFirstColHandlePos = defaultSettings.value("FirstColumnHandlePos", 80).toInt(); _defaultSecondColHandlePos = defaultSettings.value("SecondColumnHandlePos", 200).toInt(); ChatViewSettings viewSettings(this); _firstColHandlePos = viewSettings.value("FirstColumnHandlePos", _defaultFirstColHandlePos).toInt(); _secondColHandlePos = viewSettings.value("SecondColumnHandlePos", _defaultSecondColHandlePos).toInt(); _firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator()); addItem(_firstColHandle); _firstColHandle->setXPos(_firstColHandlePos); connect(_firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(firstHandlePositionChanged(qreal))); connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _firstColHandle, SLOT(sceneRectChanged(const QRectF &))); _secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator()); addItem(_secondColHandle); _secondColHandle->setXPos(_secondColHandlePos); connect(_secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(secondHandlePositionChanged(qreal))); connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _secondColHandle, SLOT(sceneRectChanged(const QRectF &))); setHandleXLimits(); if (model->rowCount() > 0) rowsInserted(QModelIndex(), 0, model->rowCount() - 1); connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowsInserted(const QModelIndex &, int, int))); connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int))); connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(rowsRemoved())); connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex))); #ifdef HAVE_WEBKIT webPreview.timer.setSingleShot(true); connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep())); #endif _showWebPreview = defaultSettings.showWebPreview(); defaultSettings.notify("ShowWebPreview", this, SLOT(showWebPreviewChanged())); _clickTimer.setInterval(QApplication::doubleClickInterval()); _clickTimer.setSingleShot(true); connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout())); setItemIndexMethod(QGraphicsScene::NoIndex); }
void ComboBox::addItemList (const StringArray& itemsToAdd, const int firstItemIdOffset) { for (int i = 0; i < itemsToAdd.size(); ++i) addItem (itemsToAdd[i], i + firstItemIdOffset); }