From e851a0fb04e249f2c2b547d2e62bd478729ca45f Mon Sep 17 00:00:00 2001 From: forth32 Date: Thu, 7 Jun 2018 11:15:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=B2=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D0=BA=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWindow.cpp | 1 + MainWindow.h | 1 + main.cpp | 92 ++++++++++++++++++++++++++++---------------------- 3 files changed, 53 insertions(+), 41 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index 7197af5..7f0d75d 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -300,6 +300,7 @@ cpio=0; if (!startfile.isEmpty()) { OpenFwFile(startfile); } +partlist->setFocus(); } //***************************************** diff --git a/MainWindow.h b/MainWindow.h index 8349145..b80f7d7 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -108,6 +108,7 @@ QToolButton *RefreshPorts; void open_recent(int n); void settitle() {setWindowTitle("Huawei firmware editor/flasher");} void ask_save(); +void removeEditor(); // Слоты обработчиков главного меню public slots: diff --git a/main.cpp b/main.cpp index e4a56f6..0dfc900 100644 --- a/main.cpp +++ b/main.cpp @@ -251,47 +251,11 @@ head_copy(); SelectPart(); } -//***************************************** -//* Выбор раздела из списка -//***************************************** -void MainWindow::SelectPart() { - -QString txt; -QStringList(plst); - -int idx=partlist->currentRow(); -if (idx == -1) return; // пустой список -// Проверяем и, если надо, сохраняем измененные данные -if ((hrow != -1)&&(hrow != idx)) { - HeaderChanged(); // сохраняем заголовок - DataChanged(); // сохранияем блок данных -} - -if ((hrow == idx) && (structure_mode_save == structure_mode->isChecked())) return; // ложный сигнал, выбран все тот же элемент списка - -modebuttons->hide(); - -structure_mode_save=structure_mode->isChecked(); -hrow=idx; // сохранияем для будущей записи заголовка - - -// Вывод значений заголовка -txt.sprintf("%-8.8s",ptable->platform(idx)); -Platform_input->setText(txt); -txt.sprintf("%-16.16s",ptable->date(idx)); -Date_input->setText(txt); - -txt.sprintf("%-16.16s",ptable->time(idx)); -Time_input->setText(txt); - -txt.sprintf("%-32.32s",ptable->version(idx)); -Version_input->setText(txt); - -txt.sprintf("%04x",ptable->code(idx)>>16); -pcode->setText(txt); - -// Удаляем все элементы просмотра разделов +//********************************************* +//* Удаляем все элементы просмотра разделов +//********************************************* +void MainWindow::removeEditor() { if (hexedit != 0) { EditorLayout->removeWidget(hexedit); @@ -340,6 +304,50 @@ if (spacer != 0) { delete spacer; spacer=0; } +} + +//***************************************** +//* Выбор раздела из списка +//***************************************** +void MainWindow::SelectPart() { + +QString txt; +QStringList(plst); + +int idx=partlist->currentRow(); +if (idx == -1) return; // пустой список +// Проверяем и, если надо, сохраняем измененные данные +if ((hrow != -1)&&(hrow != idx)) { + HeaderChanged(); // сохраняем заголовок + DataChanged(); // сохранияем блок данных +} + +if ((hrow == idx) && (structure_mode_save == structure_mode->isChecked())) return; // ложный сигнал, выбран все тот же элемент списка + +modebuttons->hide(); + +structure_mode_save=structure_mode->isChecked(); +hrow=idx; // сохранияем для будущей записи заголовка + + +// Вывод значений заголовка +txt.sprintf("%-8.8s",ptable->platform(idx)); +Platform_input->setText(txt); + +txt.sprintf("%-16.16s",ptable->date(idx)); +Date_input->setText(txt); + +txt.sprintf("%-16.16s",ptable->time(idx)); +Time_input->setText(txt); + +txt.sprintf("%-32.32s",ptable->version(idx)); +Version_input->setText(txt); + +txt.sprintf("%04x",ptable->code(idx)>>16); +pcode->setText(txt); + +// удаляем преддущий редактор +removeEditor(); modebuttons->show(); @@ -544,6 +552,7 @@ void MainWindow::Menu_Part_Delete() { int32_t ci=partlist->currentRow(); if (ptable->index() == 1) return; // последний раздел удалять нельзя +removeEditor(); // удаляем текущий редактор ptable->delpart(ci); regenerate_partlist(); if (ci< (ptable->index()-1)) partlist->setCurrentRow(ci); @@ -751,7 +760,8 @@ usbload(); //* Установка признака модификации //******************************************** void MainWindow::setModified() { - + +if (modified) return; modified=true; // добавляем звездочку в заголовок QString str=windowTitle();