Settings dialog string convertsion is done

This commit is contained in:
Cacodemon345
2022-01-07 01:58:18 +06:00
parent 970430f721
commit a05ac8090d
11 changed files with 72 additions and 69 deletions

View File

@@ -23,9 +23,9 @@ void FileField::setFileName(const QString &fileName) {
void FileField::on_pushButton_clicked() {
QString fileName;
if (createFile_) {
fileName = QFileDialog::getSaveFileName(this, "Create...", QString(), filter_, &selectedFilter_);
fileName = QFileDialog::getSaveFileName(this, QString(), QString(), filter_, &selectedFilter_);
} else {
fileName = QFileDialog::getOpenFileName(this, "Open...", QString(), filter_, &selectedFilter_);
fileName = QFileDialog::getOpenFileName(this, QString(), QString(), filter_, &selectedFilter_);
}
fileName_ = fileName;

View File

@@ -36,7 +36,7 @@
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Browse</string>
<string>&amp;Specify...</string>
</property>
</widget>
</item>

View File

@@ -58,8 +58,8 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) :
model = ui->comboBoxBlockSize->model();
model->insertRows(0, 2);
model->setData(model->index(0, 0), tr("Large blocks (2 MiB)"));
model->setData(model->index(1, 0), tr("Small blocks (512 KiB)"));
model->setData(model->index(0, 0), tr("Large blocks (2 MB)"));
model->setData(model->index(1, 0), tr("Small blocks (512 KB)"));
ui->comboBoxBlockSize->hide();
ui->labelBlockSize->hide();
@@ -71,7 +71,8 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) :
for (int i = 0; i < 127; i++) {
uint64_t size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2];
uint64_t size_mb = size >> 11LL;
QString text = QString("%1 MiB (CHS: %2, %3, %4)").arg(size_mb).arg(hdd_table[i][0]).arg(hdd_table[i][1]).arg(hdd_table[i][2]);
//QString text = QString("%1 MiB (CHS: %2, %3, %4)").arg(size_mb).arg(hdd_table[i][0]).arg(hdd_table[i][1]).arg(hdd_table[i][2]);
QString text = QString::asprintf(tr("%u MB (CHS: %i, %i, %i)").toUtf8().constData(), (size_mb), (hdd_table[i][0]), (hdd_table[i][1]), (hdd_table[i][2]));
Models::AddEntry(model, text, i);
}
Models::AddEntry(model, tr("Custom..."), 127);
@@ -246,7 +247,7 @@ static MVHDGeom create_drive_vhd_diff(const QString& fileName, const QString& pa
void HarddiskDialog::onCreateNewFile() {
qint64 size = ui->lineEditSize->text().toUInt() << 20U;
if (size > 0x1FFFFFFE00ll) {
QMessageBox::critical(this, tr("Disk image too large"), tr("Disk images cannot be larger than 127 GiB"));
QMessageBox::critical(this, tr("Disk image too large"), tr("Disk images cannot be larger than 127 GB."));
return;
}
@@ -280,7 +281,7 @@ void HarddiskDialog::onCreateNewFile() {
QFile file(fileName);
if (! file.open(QIODevice::WriteOnly)) {
QMessageBox::critical(this, tr("Unable to write file"), tr("Make sure the file is being saved to a writable directory"));
QMessageBox::critical(this, tr("Unable to write file"), tr("Make sure the file is being saved to a writable directory."));
return;
}
@@ -288,7 +289,7 @@ void HarddiskDialog::onCreateNewFile() {
QDataStream stream(&file);
stream.setByteOrder(QDataStream::LittleEndian);
if (size >= 0x100000000ll) {
QMessageBox::critical(this, tr("Disk image too large"), tr("HDI disk images cannot be larger than 4 GiB"));
QMessageBox::critical(this, tr("Disk image too large"), tr("HDI disk images cannot be larger than 4 GB."));
return;
}
uint32_t s = static_cast<uint32_t>(size);
@@ -337,7 +338,7 @@ void HarddiskDialog::onCreateNewFile() {
_86box_geometry = create_drive_vhd_dynamic(fileName, cylinders_, heads_, sectors_, block_size);
break;
case 5:
QString vhdParent = QFileDialog::getOpenFileName(this, tr("Select the parent VHD"), QString(), tr("VHD files (*.vhd);;All files (*)"));
QString vhdParent = QFileDialog::getOpenFileName(this, tr("Select the parent VHD"), QString(), tr("VHD files (*.VHD *.vhd);;All files (*)"));
if (vhdParent.isEmpty()) {
return;
}
@@ -346,7 +347,7 @@ void HarddiskDialog::onCreateNewFile() {
}
if (img_format != 5) {
QMessageBox::information(this, tr("Disk image created"), tr("Remember to partition and format the newly-created drive"));
QMessageBox::information(this, tr("Disk image created"), tr("Remember to partition and format the newly-created drive."));
}
ui->lineEditCylinders->setText(QString::number(_86box_geometry.cyl));
@@ -385,7 +386,7 @@ void HarddiskDialog::onCreateNewFile() {
progress.exec();
writer.join();
QMessageBox::information(this, tr("Disk image created"), tr("Remember to partition and format the newly-created drive"));
QMessageBox::information(this, tr("Disk image created"), tr("Remember to partition and format the newly-created drive."));
}
static void adjust_vhd_geometry_for_86box(MVHDGeom *vhd_geometry) {
@@ -449,7 +450,7 @@ void HarddiskDialog::onExistingFileSelected(const QString &fileName) {
QFile file(fileName);
if (! file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("Unable to read file"), tr("Make sure the file exists and is readable"));
QMessageBox::critical(this, tr("Unable to read file"), tr("Make sure the file exists and is readable."));
return;
}
QByteArray fileNameUtf8 = fileName.toUtf8();
@@ -461,7 +462,7 @@ void HarddiskDialog::onExistingFileSelected(const QString &fileName) {
stream.setByteOrder(QDataStream::LittleEndian);
stream >> sector_size;
if (sector_size != 512) {
QMessageBox::critical(this, tr("Unsupported disk image"), tr("HDI or HDX images with a sector size other than 512 are not supported"));
QMessageBox::critical(this, tr("Unsupported disk image"), tr("HDI or HDX images with a sector size other than 512 are not supported."));
return;
}

View File

@@ -22,7 +22,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>File name</string>
<string>File name:</string>
</property>
</widget>
</item>
@@ -36,14 +36,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Cylinders</string>
<string>Cylinders:</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Sectors</string>
<string>Sectors:</string>
</property>
</widget>
</item>
@@ -56,14 +56,14 @@
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Size (MiB)</string>
<string>Size (MB):</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Heads</string>
<string>Heads:</string>
</property>
</widget>
</item>
@@ -77,7 +77,7 @@
<item row="1" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Type</string>
<string>Type:</string>
</property>
</widget>
</item>
@@ -98,7 +98,7 @@
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Bus</string>
<string>Bus:</string>
</property>
</widget>
</item>
@@ -108,7 +108,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Channel</string>
<string>Channel:</string>
</property>
</widget>
</item>
@@ -122,7 +122,7 @@
<item>
<widget class="QLabel" name="labelFormat">
<property name="text">
<string>Format</string>
<string>Image Format:</string>
</property>
</widget>
</item>
@@ -139,7 +139,7 @@
<item>
<widget class="QLabel" name="labelBlockSize">
<property name="text">
<string>Block Size</string>
<string>Block Size:</string>
</property>
</widget>
</item>

View File

@@ -38,8 +38,8 @@ void MediaMenu::refresh(QMenu *parentMenu) {
cassetteMenu = parentMenu->addMenu("");
cassetteMenu->addAction(tr("&New image..."), [this]() { cassetteNewImage(); });
cassetteMenu->addSeparator();
cassetteMenu->addAction(tr("&Existing image.."), [this]() { cassetteSelectImage(false); });
cassetteMenu->addAction(tr("&Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
cassetteMenu->addAction(tr("&Existing image..."), [this]() { cassetteSelectImage(false); });
cassetteMenu->addAction(tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); });
cassetteMenu->addSeparator();
cassetteRecordPos = cassetteMenu->children().count();
cassetteMenu->addAction(tr("&Record"), [this] { pc_cas_set_mode(cassette, 1); cassetteUpdateMenu(); })->setCheckable(true);
@@ -59,10 +59,10 @@ void MediaMenu::refresh(QMenu *parentMenu) {
if (machine_has_cartridge(machine)) {
for(int i = 0; i < 2; i++) {
auto* menu = parentMenu->addMenu("");
menu->addAction(tr("Image"), [this, i]() { cartridgeSelectImage(i); });
menu->addAction(tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
menu->addSeparator();
cartridgeEjectPos = menu->children().count();
menu->addAction(tr("Eject"), [this, i]() { cartridgeEject(i); });
menu->addAction(tr("E&ject"), [this, i]() { cartridgeEject(i); });
cartridgeMenus[i] = menu;
cartridgeUpdateMenu(i);
}
@@ -71,16 +71,16 @@ void MediaMenu::refresh(QMenu *parentMenu) {
floppyMenus.clear();
MachineStatus::iterateFDD([this, parentMenu](int i) {
auto* menu = parentMenu->addMenu("");
menu->addAction(tr("New Image"), [this, i]() { floppyNewImage(i); });
menu->addAction(tr("&New image..."), [this, i]() { floppyNewImage(i); });
menu->addSeparator();
menu->addAction(tr("Existing Image"), [this, i]() { floppySelectImage(i, false); });
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { floppySelectImage(i, true); });
menu->addAction(tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); });
menu->addSeparator();
floppyExportPos = menu->children().count();
menu->addAction(tr("Export to 86F"), [this, i]() { floppyExportTo86f(i); });
menu->addAction(tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); });
menu->addSeparator();
floppyEjectPos = menu->children().count();
menu->addAction(tr("Eject"), [this, i]() { floppyEject(i); });
menu->addAction(tr("E&ject"), [this, i]() { floppyEject(i); });
floppyMenus[i] = menu;
floppyUpdateMenu(i);
});
@@ -89,15 +89,15 @@ void MediaMenu::refresh(QMenu *parentMenu) {
MachineStatus::iterateCDROM([this, parentMenu](int i) {
auto* menu = parentMenu->addMenu("");
cdromMutePos = menu->children().count();
menu->addAction(tr("Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
menu->addAction(tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true);
menu->addSeparator();
cdromEmptyPos = menu->children().count();
menu->addAction(tr("Empty"), [this, i]() { cdromEject(i); })->setCheckable(true);
menu->addAction(tr("E&mpty"), [this, i]() { cdromEject(i); })->setCheckable(true);
cdromReloadPos = menu->children().count();
menu->addAction(tr("Reload previous image"), [this, i]() { cdromReload(i); });
menu->addAction(tr("&Reload previous image"), [this, i]() { cdromReload(i); });
menu->addSeparator();
cdromImagePos = menu->children().count();
menu->addAction(tr("Image"), [this, i]() { cdromMount(i); })->setCheckable(true);
menu->addAction(tr("&Image"), [this, i]() { cdromMount(i); })->setCheckable(true);
cdromMenus[i] = menu;
cdromUpdateMenu(i);
});
@@ -105,15 +105,15 @@ void MediaMenu::refresh(QMenu *parentMenu) {
zipMenus.clear();
MachineStatus::iterateZIP([this, parentMenu](int i) {
auto* menu = parentMenu->addMenu("");
menu->addAction(tr("New Image"), [this, i]() { zipNewImage(i); });
menu->addAction(tr("&New image..."), [this, i]() { zipNewImage(i); });
menu->addSeparator();
menu->addAction(tr("Existing Image"), [this, i]() { zipSelectImage(i, false); });
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { zipSelectImage(i, true); });
menu->addAction(tr("&Existing image..."), [this, i]() { zipSelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { zipSelectImage(i, true); });
menu->addSeparator();
zipEjectPos = menu->children().count();
menu->addAction(tr("Eject"), [this, i]() { zipEject(i); });
menu->addAction(tr("E&ject"), [this, i]() { zipEject(i); });
zipReloadPos = menu->children().count();
menu->addAction(tr("Reload previous image"), [this, i]() { zipReload(i); });
menu->addAction(tr("&Reload previous image"), [this, i]() { zipReload(i); });
zipMenus[i] = menu;
zipUpdateMenu(i);
});
@@ -121,15 +121,15 @@ void MediaMenu::refresh(QMenu *parentMenu) {
moMenus.clear();
MachineStatus::iterateMO([this, parentMenu](int i) {
auto* menu = parentMenu->addMenu("");
menu->addAction(tr("New Image"), [this, i]() { moNewImage(i); });
menu->addAction(tr("&New image..."), [this, i]() { moNewImage(i); });
menu->addSeparator();
menu->addAction(tr("Existing Image"), [this, i]() { moSelectImage(i, false); });
menu->addAction(tr("Existing Image (Write Protected)"), [this, i]() { moSelectImage(i, true); });
menu->addAction(tr("&Existing image..."), [this, i]() { moSelectImage(i, false); });
menu->addAction(tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); });
menu->addSeparator();
moEjectPos = menu->children().count();
menu->addAction(tr("Eject"), [this, i]() { moEject(i); });
menu->addAction(tr("E&ject"), [this, i]() { moEject(i); });
moReloadPos = menu->children().count();
menu->addAction(tr("Reload previous image"), [this, i]() { moReload(i); });
menu->addAction(tr("&Reload previous image"), [this, i]() { moReload(i); });
moMenus[i] = menu;
moUpdateMenu(i);
});
@@ -195,7 +195,7 @@ void MediaMenu::cassetteUpdateMenu() {
recordMenu->setChecked(isSaving);
playMenu->setChecked(! isSaving);
cassetteMenu->setTitle(tr("Cassette: %1").arg(name.isEmpty() ? tr("(empty)") : name));
cassetteMenu->setTitle(QString::asprintf(tr("Cassette: %s").toUtf8().constData(), (name.isEmpty() ? tr("(empty)") : name).toUtf8().constData()));
}
void MediaMenu::cartridgeSelectImage(int i) {
@@ -227,7 +227,8 @@ void MediaMenu::cartridgeUpdateMenu(int i) {
auto childs = menu->children();
auto* ejectMenu = dynamic_cast<QAction*>(childs[cartridgeEjectPos]);
ejectMenu->setEnabled(!name.isEmpty());
menu->setTitle(tr("Cartridge %1: %2").arg(QString::number(i+1), name.isEmpty() ? tr("(empty)") : name));
//menu->setTitle(tr("Cartridge %1: %2").arg(QString::number(i+1), name.isEmpty() ? tr("(empty)") : name));
menu->setTitle(QString::asprintf(tr("Cartridge %i: %ls").toUtf8().constData(), i + 1, name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
}
void MediaMenu::floppyNewImage(int i) {
@@ -241,7 +242,7 @@ void MediaMenu::floppyNewImage(int i) {
}
void MediaMenu::floppySelectImage(int i, bool wp) {
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), tr("All images (*.0?? *.1?? *.??0 *.86F *.86f *.BIN *.bin *.CQ? *.CQ *.D?? *.d *.FLP *.flp *.HDM *.hdm *.IM? *.im? *.JSON *.json *.TD0 *.td0 *.*FD? *.*fd? *.MFM *.mfm *.XDF *.xdf);;Advanced sector images (*.IMD *.imd *.JSON *.json *.TD0 *.td0);;Basic sector images (*.0?? *.1?? *.??0 *.BIN *.bin *.CQ? *.cq? *.D?? *.d?? *.FLP *.flp *.HDM *.hdm *.IM? *.im? *.XDF *.xdf *.*FD? *.*fd?);;Flux images (*.FDI *.fdi);;Surface images (*.86F *.86f *.MFM *.mfm);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, "Open", QString(), tr("All images (*.86F *.86f *.DSK *.dsk *.FLP *.flp *.IM? *.im? *.*FD? *.*fd?);;Basic sector images (*.DSK *.dsk *.FLP *.flp *.IM? *.im? *.IMG *.img *.*FD? *.*fd?);;Surface images (*.86F *.86f)"));
floppyMount(i, filename, wp);
}
@@ -267,7 +268,7 @@ void MediaMenu::floppyEject(int i) {
}
void MediaMenu::floppyExportTo86f(int i) {
auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Save as 86f"), QString(), tr("Surface images (*.86f)"));
auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Save as 86f"), QString(), tr("Surface images (*.86F *.86f)"));
if (! filename.isEmpty()) {
QByteArray filenameBytes = filename.toUtf8();
plat_pause(1);
@@ -290,7 +291,8 @@ void MediaMenu::floppyUpdateMenu(int i) {
exportMenu->setEnabled(!name.isEmpty());
int type = fdd_get_type(i);
floppyMenus[i]->setTitle(tr("Floppy %1 (%2): %3").arg(QString::number(i+1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
//floppyMenus[i]->setTitle(tr("Floppy %1 (%2): %3").arg(QString::number(i+1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
floppyMenus[i]->setTitle(QString::asprintf("Floppy %i (%s): %ls", i + 1, fdd_getname(type), name.isEmpty() ? tr("(empty)").toStdU16String().data() : name.toStdU16String().data()));
}
void MediaMenu::cdromMute(int i) {
@@ -304,7 +306,7 @@ void MediaMenu::cdromMount(int i) {
QString dir;
QFileInfo fi(cdrom[i].image_path);
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("CD-ROM images (*.ISO *.CUE *.iso *.cue);;All files (*)"));
auto filename = QFileDialog::getOpenFileName(parentWidget, tr("Open"), QString(), tr("CD-ROM images (*.ISO *.iso *.CUE *.cue);;All files (*)"));
if (filename.isEmpty()) {
auto* imageMenu = dynamic_cast<QAction*>(cdromMenus[i]->children()[cdromImagePos]);
imageMenu->setChecked(false);

View File

@@ -99,17 +99,17 @@ NewFloppyDialog::NewFloppyDialog(MediaType type, QWidget *parent) :
switch (type) {
case MediaType::Floppy:
for (int i = 0; i < floppyTypes.size(); ++i) {
Models::AddEntry(model, floppyTypes[i], i);
Models::AddEntry(model, tr(floppyTypes[i].toUtf8().data()), i);
}
break;
case MediaType::Zip:
for (int i = 0; i < zipTypes.size(); ++i) {
Models::AddEntry(model, zipTypes[i], i);
Models::AddEntry(model, tr(zipTypes[i].toUtf8().data()), i);
}
break;
case MediaType::Mo:
for (int i = 0; i < moTypes.size(); ++i) {
Models::AddEntry(model, moTypes[i], i);
Models::AddEntry(model, tr(moTypes[i].toUtf8().data()), i);
}
break;
}
@@ -198,7 +198,7 @@ void NewFloppyDialog::onCreate() {
break;
}
QMessageBox::critical(this, "Unable to write file", "Make sure the file is being saved to a writable directory");
QMessageBox::critical(this, tr("Unable to write file"), tr("Make sure the file is being saved to a writable directory"));
reject();
}

View File

@@ -43,14 +43,14 @@
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>File Name</string>
<string>File name:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Disk Size</string>
<string>Disk size:</string>
</property>
</widget>
</item>
@@ -60,7 +60,7 @@
<item row="3" column="0">
<widget class="QLabel" name="labelRpm">
<property name="text">
<string>RPM Mode</string>
<string>RPM mode:</string>
</property>
</widget>
</item>

View File

@@ -23,7 +23,7 @@ static void setFloppyType(QAbstractItemModel* model, const QModelIndex& idx, int
icon = QIcon(ProgSettings::getIconSetPath() + "/floppy_35.ico");
}
model->setData(idx, fdd_getname(type));
model->setData(idx, QObject::tr(fdd_getname(type)));
model->setData(idx, type, Qt::UserRole);
model->setData(idx, icon, Qt::DecorationRole);
}
@@ -62,7 +62,7 @@ SettingsFloppyCDROM::SettingsFloppyCDROM(QWidget *parent) :
auto* model = ui->comboBoxFloppyType->model();
int i = 0;
while (true) {
QString name = fdd_getname(i);
QString name = tr(fdd_getname(i));
if (name.isEmpty()) {
break;
}

View File

@@ -68,21 +68,21 @@
<item>
<widget class="QPushButton" name="pushButtonNew">
<property name="text">
<string>New</string>
<string>&amp;New...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonExisting">
<property name="text">
<string>Existing</string>
<string>&amp;Existing...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonRemove">
<property name="text">
<string>Remove</string>
<string>&amp;Remove</string>
</property>
</widget>
</item>

View File

@@ -48,7 +48,7 @@ SettingsMachine::SettingsMachine(QWidget *parent) :
auto* waitStatesModel = ui->comboBoxWaitStates->model();
waitStatesModel->insertRows(0, 9);
auto idx = waitStatesModel->index(0, 0);
waitStatesModel->setData(idx, "Default", Qt::DisplayRole);
waitStatesModel->setData(idx, tr("Default"), Qt::DisplayRole);
waitStatesModel->setData(idx, 0, Qt::UserRole);
for (int i = 0; i < 8; ++i) {
idx = waitStatesModel->index(i+1, 0);

View File

@@ -40,7 +40,7 @@ static void setMOBus(QAbstractItemModel* model, const QModelIndex& idx, uint8_t
static void setMOType(QAbstractItemModel* model, const QModelIndex& idx, uint32_t type) {
auto i = idx.siblingAtColumn(1);
if (idx.siblingAtColumn(0).data(Qt::UserRole).toUInt() == MO_BUS_DISABLED) {
model->setData(i, "None");
model->setData(i, QCoreApplication::translate("", "None"));
} else {
model->setData(i, moDriveTypeName(type));
}
@@ -86,8 +86,8 @@ SettingsOtherRemovable::SettingsOtherRemovable(QWidget *parent) :
model = new QStandardItemModel(0, 2, this);
ui->tableViewMO->setModel(model);
model->setHeaderData(0, Qt::Horizontal, "Bus");
model->setHeaderData(1, Qt::Horizontal, "Type");
model->setHeaderData(0, Qt::Horizontal, tr("Bus"));
model->setHeaderData(1, Qt::Horizontal, tr("Type"));
model->insertRows(0, MO_NUM);
for (int i = 0; i < MO_NUM; i++) {
auto idx = model->index(i, 0);