void ShortcutsWidget::loadShortcuts(const QSettings &settings) { MenuItems items = menuItems(); ::loadShortcuts(&items, settings); m_actions.clear(); m_shortcuts.clear(); QTableWidget *table = ui->tableWidget; while (table->rowCount() > 0) table->removeRow(0); for (const auto &item : items) { MenuAction action; action.iconName = item.iconName; action.iconId = item.iconId; action.text = item.text; action.settingsKey = item.settingsKey; addShortcutRow(action); action.shortcutButton->setDefaultShortcut(item.defaultShortcut); for (const auto &shortcut : item.shortcuts) action.shortcutButton->addShortcut(shortcut); } addCommands( loadAllCommands() ); addCommands( predefinedCommands() ); }
void ShortcutsWidget::loadShortcuts(QSettings &settings) { MenuItems items = menuItems(); ::loadShortcuts(&items, settings); m_actions.clear(); m_shortcuts.clear(); QTableWidget *table = ui->tableWidget; while (table->rowCount() > 0) table->removeRow(0); foreach (const MenuItem &item, items) { MenuAction action; action.iconName = item.iconName; action.iconId = item.iconId; action.text = item.text; action.settingsKey = item.settingsKey; const int row = table->rowCount(); table->insertRow(row); QTableWidgetItem *tableItem = new QTableWidgetItem(); table->setItem(row, Columns::Empty, tableItem); tableItem->setFlags(Qt::NoItemFlags); tableItem = new QTableWidgetItem(); action.tableItem = tableItem; table->setItem(row, Columns::Icon, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); tableItem = new QTableWidgetItem(uiText(action.text)); table->setItem(row, Columns::Text, tableItem); tableItem->setFlags(Qt::ItemIsEnabled); action.shortcutButton = new ShortcutButton(table); table->setCellWidget(row, Columns::Shortcut, action.shortcutButton); action.shortcutButton->setDefaultShortcut(item.defaultShortcut); foreach (const QKeySequence &shortcut, item.shortcuts) action.shortcutButton->addShortcut(shortcut); action.iconId = item.iconId; m_actions.append(action); m_shortcuts << item.shortcuts; m_timerCheckAmbiguous.start(); connect( action.shortcutButton, SIGNAL(shortcutAdded(QKeySequence)), this, SLOT(onShortcutAdded(QKeySequence)) ); connect( action.shortcutButton, SIGNAL(shortcutRemoved(QKeySequence)), this, SLOT(onShortcutRemoved(QKeySequence)) ); }
void StartingMenuScreen::update(nk_context* ctx) { for (auto ptr : {mSmLogo.get(), mFocus42.get()}) ptr->update(); auto renderer = FARender::Renderer::get(); int32_t screenW, screenH; renderer->getWindowDimensions(screenW, screenH); Misc::ScopedSetter<float> setter(ctx->style.window.border, 0); auto bg = renderer->loadImage("ui_art/mainmenu.pcx")->getNkImage(); nk_style_push_style_item(ctx, &ctx->style.window.fixed_background, nk_style_item_image(bg)); if (nk_begin( ctx, "startingScreen", nk_rect(screenW / 2 - MenuHandler::menuWidth / 2, screenH / 2 - MenuHandler::menuHeight / 2, MenuHandler::menuWidth, MenuHandler::menuHeight), NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BACKGROUND)) menuItems(ctx); nk_end(ctx); nk_style_pop_style_item(ctx); }
void _HYObjectInspector::SortObjectsByName (long location) { _HYTable* table = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _List menuItems; menuItems.AppendNewInstance(new _String ("Ascending")); menuItems.AppendNewInstance(new _String ("Descending")); long h = table->_HandlePullDown (menuItems,(location&0xffff0000)>>16,location&0x0000ffff,0), k; if (h>=0) { menuItems.Clear(); _SimpleList index; for (k=0; k<table->verticalSpaces.lLength; k++) { index<<k; menuItems << table->GetCellData (0,k); } bool hasPadding = ((_String*)menuItems(menuItems.lLength-1))->sLength==0; if (hasPadding) { menuItems.Delete (menuItems.lLength-1); index.Delete (index.lLength-1); } SortLists (&menuItems, &index); if (h==1) { index.Flip(); } if (hasPadding) { index<<index.lLength; } table->SetRowOrder (index); } }