MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / addKeyHistoryDock

Method addKeyHistoryDock

gui/qt/settings.cpp:1148–1192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1146
1147
1148void MainWindow::addKeyHistoryDock(const QString &magic, int size) {
1149 if (m_docksKeyHistory.contains(magic)) {
1150 return;
1151 }
1152
1153 m_docksKeyHistory.append(magic);
1154 m_docksKeyHistorySize.append(size);
1155
1156 DockWidget *dw = new DockWidget(TXT_KEYHISTORY_DOCK, this);
1157 KeyHistoryWidget *widget = new KeyHistoryWidget(this, size);
1158
1159 dw->makeCloseableFloat(true);
1160
1161 if (m_setup) {
1162 dw->setFloating(true);
1163 dw->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, dw->minimumSize(), qApp->screens().first()->availableGeometry()));
1164 }
1165
1166 connect(ui->keypadWidget, &KeypadWidget::keyPressed, widget, &KeyHistoryWidget::add);
1167 connect(widget, &KeyHistoryWidget::fontSizeChanged, [this, widget, magic]{
1168 int index;
1169 if ((index = m_docksKeyHistory.indexOf(magic)) != -1) {
1170 m_docksKeyHistorySize[index] = widget->getFontSize();
1171 }
1172 });
1173 connect(dw, &DockWidget::closed, [this, magic]{
1174 int index;
1175 if ((index = m_docksKeyHistory.indexOf(magic)) != -1) {
1176 m_docksKeyHistory.removeAt(index);
1177 m_docksKeyHistorySize.removeAt(index);
1178 }
1179 });
1180
1181 dw->setState(m_uiEditMode);
1182 dw->setAttribute(Qt::WA_DeleteOnClose);
1183 addDockWidget(Qt::RightDockWidgetArea, dw);
1184 dw->setObjectName(magic);
1185 dw->setWidget(widget);
1186
1187 if (m_setup) {
1188 dw->show();
1189 dw->activateWindow();
1190 dw->raise();
1191 }
1192}
1193
1194void MainWindow::setVersion() {
1195 m_config->setValue(SETTING_VERSION, QStringLiteral(CEMU_VERSION));

Callers

nothing calls this directly

Calls 4

makeCloseableFloatMethod · 0.80
indexOfMethod · 0.80
getFontSizeMethod · 0.80
setStateMethod · 0.80

Tested by

no test coverage detected