From e6e4e69b4bdc2f0b2556d3a3d286c3247bed89cb Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Wed, 20 Nov 2013 02:19:48 +0100 Subject: [PATCH] Version 0.9.3 - minor bugfix thanks to XCode built-in static analyzer --- LZMA/LzmaCompress.c | 8 +- LZMA/LzmaCompress.h | 8 +- descriptor.h | 11 +- ffsengine.cpp | 32 ++-- moc_ffsengine.cpp | 80 ++++++++++ moc_treemodel.cpp | 80 ++++++++++ moc_uefitool.cpp | 145 +++++++++++++++++ treeitem.h | 1 - treemodel.cpp | 4 +- uefitool.cpp | 6 +- uefitool.ui | 22 +-- ui_uefitool.h | 370 ++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 717 insertions(+), 50 deletions(-) create mode 100644 moc_ffsengine.cpp create mode 100644 moc_treemodel.cpp create mode 100644 moc_uefitool.cpp create mode 100644 ui_uefitool.h diff --git a/LZMA/LzmaCompress.c b/LZMA/LzmaCompress.c index e0406bf..a6019ef 100644 --- a/LZMA/LzmaCompress.c +++ b/LZMA/LzmaCompress.c @@ -60,10 +60,10 @@ VOID INT32 EFIAPI LzmaCompress ( - CONST VOID *Source, - SizeT SourceSize, - VOID *Destination, - SizeT *DestinationSize + CONST UINT8 *Source, + UINT32 SourceSize, + UINT8 *Destination, + UINT32 *DestinationSize ) { SRes LzmaResult; diff --git a/LZMA/LzmaCompress.h b/LZMA/LzmaCompress.h index 5955087..b6a7f18 100644 --- a/LZMA/LzmaCompress.h +++ b/LZMA/LzmaCompress.h @@ -27,10 +27,10 @@ extern "C" { INT32 EFIAPI LzmaCompress ( - const VOID *Source, - SizeT SourceSize, - VOID *Destination, - SizeT *DestinationSize + const UINT8 *Source, + UINT32 SourceSize, + UINT8 *Destination, + UINT32 *DestinationSize ); #ifdef __cplusplus diff --git a/descriptor.h b/descriptor.h index 09d2720..13a1883 100644 --- a/descriptor.h +++ b/descriptor.h @@ -65,7 +65,7 @@ typedef struct { UINT8 FlashReadStatusFrequency : 3; UINT8 FlashWriteFrequency : 3; UINT8 DualOutputFastReadSupported : 1; - UINT8 ReservedZero3 : 1; // Still unknown, zero in all descriptors I have seen + UINT8 ReservedZero3 : 1; // Still unknown, zero in all descriptors I have seen } FLASH_PARAMETERS; // Flash densities @@ -89,14 +89,14 @@ typedef struct { UINT8 InvalidInstruction2; // UINT8 InvalidInstruction3; // UINT16 PartitionBoundary; // Upper 16 bit of partition boundary address. Default is 0x0000, which makes the boundary to be 0x00001000 - UINT16 RezervedZero; // Still unknown, zero in all descriptors I have seen + UINT16 ReservedZero; // Still unknown, zero in all descriptors I have seen } FLASH_DESCRIPTOR_COMPONENT_SECTION; // Region section // All base and limit register are storing upper part of actual UINT32 base and limit // If limit is zero - region is not present typedef struct { - UINT16 RezervedZero; // Still unknown, zero in all descriptors I have seen + UINT16 ReservedZero; // Still unknown, zero in all descriptors I have seen UINT16 FlashBlockEraseSize; // Size of block erased by single BLOCK ERASE command UINT16 BiosBase; UINT16 BiosLimit; @@ -154,6 +154,7 @@ typedef struct { // Restore previous packing rules #pragma pack(pop) +// Returns name of region by it's type extern QString regionTypeToQString(const UINT8 type); // Calculate address of data structure addressed by descriptor address format @@ -162,8 +163,8 @@ extern UINT8* calculateAddress8(UINT8* baseAddress, const UINT8 baseOrLimit); // 16 bit base or limit extern UINT8* calculateAddress16(UINT8* baseAddress, const UINT16 baseOrLimit); -// Calculate offset of region using its base +// Calculate offset of region using it's base extern UINT32 calculateRegionOffset(const UINT16 base); -// Calculate size of region using its base and limit +// Calculate size of region using it's base and limit extern UINT32 calculateRegionSize(const UINT16 base, const UINT16 limit); #endif \ No newline at end of file diff --git a/ffsengine.cpp b/ffsengine.cpp index 2c15c70..390ce12 100644 --- a/ffsengine.cpp +++ b/ffsengine.cpp @@ -96,7 +96,7 @@ UINT8 FfsEngine::parseInputFile(const QByteArray & buffer) QByteArray flashImage; // Check buffer size to be more or equal then sizeof(EFI_CAPSULE_HEADER) - if (buffer.size() <= sizeof(EFI_CAPSULE_HEADER)) + if ((UINT32) buffer.size() <= sizeof(EFI_CAPSULE_HEADER)) { msg(tr("parseInputFile: Input file is smaller then minimum size of %1 bytes").arg(sizeof(EFI_CAPSULE_HEADER))); return ERR_INVALID_PARAMETER; @@ -164,7 +164,7 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & flashImage, const QModelInde { FLASH_DESCRIPTOR_MAP* descriptorMap; FLASH_DESCRIPTOR_REGION_SECTION* regionSection; - FLASH_DESCRIPTOR_COMPONENT_SECTION* componentSection; + //FLASH_DESCRIPTOR_COMPONENT_SECTION* componentSection; // Store the beginning of descriptor as descriptor base address UINT8* descriptor = (UINT8*) flashImage.constData(); @@ -180,7 +180,7 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & flashImage, const QModelInde // Parse descriptor map descriptorMap = (FLASH_DESCRIPTOR_MAP*) (descriptor + sizeof(FLASH_DESCRIPTOR_HEADER)); regionSection = (FLASH_DESCRIPTOR_REGION_SECTION*) calculateAddress8(descriptor, descriptorMap->RegionBase); - componentSection = (FLASH_DESCRIPTOR_COMPONENT_SECTION*) calculateAddress8(descriptor, descriptorMap->ComponentBase); + //componentSection = (FLASH_DESCRIPTOR_COMPONENT_SECTION*) calculateAddress8(descriptor, descriptorMap->ComponentBase); // GbE region QByteArray gbe; @@ -320,7 +320,7 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & flashImage, const QModelInde qSort(offsets); // Parse regions - UINT8 result; + UINT8 result = 0; for (int i = 0; i < offsets.count(); i++) { // Parse GbE region if (offsets.at(i) == gbeBegin) { @@ -382,7 +382,7 @@ UINT8 FfsEngine::parseMeRegion(const QByteArray & me, const QModelIndex & parent arg(me.size(), 8, 16, QChar('0')); ME_VERSION* version; - UINT32 versionOffset = me.indexOf(ME_VERSION_SIGNATURE); + INT32 versionOffset = me.indexOf(ME_VERSION_SIGNATURE); if (versionOffset < 0){ info += tr("\nVersion: unknown"); msg(tr("parseRegion: ME region version is unknown, it can be damaged"), parent); @@ -561,7 +561,7 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent) } else if (volumeHeader->Revision == 2) { // Acquire alignment - alignment = pow(2, (volumeHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16); + alignment = (UINT32) pow(2.0, (int) (volumeHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16); // Check alignment if (volumeOffset % alignment) { @@ -734,7 +734,7 @@ UINT8 FfsEngine::parseVolume(const QByteArray & volume, const QModelIndex & par // Check file alignment EFI_FFS_FILE_HEADER* fileHeader = (EFI_FFS_FILE_HEADER*) header.constData(); UINT8 alignmentPower = ffsAlignmentTable[(fileHeader->Attributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3]; - UINT32 alignment = pow(2, alignmentPower); + UINT32 alignment = (UINT32) pow(2.0, alignmentPower); if ((fileOffset + sizeof(EFI_FFS_FILE_HEADER)) % alignment) { msg(tr("parseVolume: %1, unaligned file").arg(guidToQString(fileHeader->Name)), index); } @@ -1364,8 +1364,8 @@ UINT8 FfsEngine::decompress(const QByteArray & compressedData, const UINT8 compr // Both algorithms work if(memcmp(decompressed, tianoDecompressed, decompressedSize)) { // If decompressed data are different - it's Tiano for sure - delete decompressed; - delete scratch; + delete[] decompressed; + delete[] scratch; decompressed = tianoDecompressed; scratch = tianoScratch; if (algorithm) @@ -1482,10 +1482,10 @@ UINT8 FfsEngine::compress(const QByteArray & data, const UINT8 algorithm, QByteA break; case COMPRESSION_ALGORITHM_LZMA: { - if (LzmaCompress((UINT8*) data.constData(), data.size(), NULL, &compressedSize) != ERR_BUFFER_TOO_SMALL) + if (LzmaCompress((const UINT8*) data.constData(), data.size(), NULL, &compressedSize) != ERR_BUFFER_TOO_SMALL) return ERR_CUSTOMIZED_COMPRESSION_FAILED; compressed = new UINT8[compressedSize]; - if (LzmaCompress((UINT8*) data.constData(), data.size(), compressed, &compressedSize) != ERR_SUCCESS) + if (LzmaCompress((const UINT8*) data.constData(), data.size(), compressed, &compressedSize) != ERR_SUCCESS) return ERR_CUSTOMIZED_COMPRESSION_FAILED; compressedData = QByteArray((const char*) compressed, compressedSize); delete[] compressed; @@ -1791,7 +1791,7 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue & que UINT8 alignmentPower; UINT32 base; alignmentPower = ffsAlignmentTable[(fileHeader->Attributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3]; - alignment = pow(2, alignmentPower); + alignment = (UINT32) pow(2.0, alignmentPower); base = header.size() + offset + sizeof(EFI_FFS_FILE_HEADER); if (base % alignment) { // File will be unaligned if added as is, so we must add pad file before it @@ -1887,6 +1887,8 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue & que // Grow volume to fit new body UINT32 newSize = header.size() + reconstructed.size(); result = growVolume(header, volumeSize, newSize); + if (result) + return result; // Fill volume end with empty char reconstructed.append(QByteArray(newSize - header.size() - reconstructed.size(), empty)); volumeSize = newSize; @@ -1958,7 +1960,6 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue & que // File is marked for update, the mark must be removed msg(tr("reconstruct: %1, file MARKED_FOR_UPDATE state cleared") .arg(guidToQString(fileHeader->Name)), index); - state &= ~EFI_FILE_MARKED_FOR_UPDATE; } else if (state & EFI_FILE_DATA_VALID) { // File is in good condition, reconstruct it @@ -1975,7 +1976,7 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue & que .arg(guidToQString(fileHeader->Name)), index); return ERR_SUCCESS; } - + // Reconstruct file body if (item->childCount()) { for (int i = 0; i < item->childCount(); i++) { @@ -2038,7 +2039,8 @@ UINT8 FfsEngine::reconstruct(const QModelIndex & index, QQueue & que state = EFI_FILE_DATA_VALID | EFI_FILE_HEADER_VALID | EFI_FILE_HEADER_CONSTRUCTION; if (erasePolarity == ERASE_POLARITY_TRUE) state = ~state; - + fileHeader->State = state; + // Enqueue reconstructed item queue.enqueue(header.append(reconstructed)); } diff --git a/moc_ffsengine.cpp b/moc_ffsengine.cpp new file mode 100644 index 0000000..bbf3bd0 --- /dev/null +++ b/moc_ffsengine.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'ffsengine.h' +** +** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.5) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "ffsengine.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'ffsengine.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.5. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_FfsEngine[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_FfsEngine[] = { + "FfsEngine\0" +}; + +void FfsEngine::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData FfsEngine::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject FfsEngine::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_FfsEngine, + qt_meta_data_FfsEngine, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &FfsEngine::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *FfsEngine::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *FfsEngine::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_FfsEngine)) + return static_cast(const_cast< FfsEngine*>(this)); + return QObject::qt_metacast(_clname); +} + +int FfsEngine::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/moc_treemodel.cpp b/moc_treemodel.cpp new file mode 100644 index 0000000..82801e1 --- /dev/null +++ b/moc_treemodel.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'treemodel.h' +** +** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.5) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "treemodel.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'treemodel.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.5. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_TreeModel[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_TreeModel[] = { + "TreeModel\0" +}; + +void TreeModel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData TreeModel::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject TreeModel::staticMetaObject = { + { &QAbstractItemModel::staticMetaObject, qt_meta_stringdata_TreeModel, + qt_meta_data_TreeModel, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &TreeModel::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *TreeModel::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *TreeModel::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_TreeModel)) + return static_cast(const_cast< TreeModel*>(this)); + return QAbstractItemModel::qt_metacast(_clname); +} + +int TreeModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QAbstractItemModel::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/moc_uefitool.cpp b/moc_uefitool.cpp new file mode 100644 index 0000000..b2897f8 --- /dev/null +++ b/moc_uefitool.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'uefitool.h' +** +** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.5) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "uefitool.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'uefitool.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.5. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_UEFITool[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 23, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 10, 9, 9, 9, 0x08, + 17, 9, 9, 9, 0x08, + 33, 9, 9, 9, 0x08, + 57, 49, 9, 9, 0x08, + 81, 9, 9, 9, 0x08, + 109, 104, 9, 9, 0x08, + 124, 9, 9, 9, 0x08, + 138, 9, 9, 9, 0x08, + 152, 9, 9, 9, 0x08, + 174, 104, 9, 9, 0x08, + 188, 9, 9, 9, 0x08, + 201, 9, 9, 9, 0x08, + 216, 9, 9, 9, 0x08, + 230, 9, 9, 9, 0x08, + 240, 9, 9, 9, 0x08, + 249, 9, 9, 9, 0x08, + 259, 9, 9, 9, 0x08, + 274, 9, 9, 9, 0x08, + 290, 9, 9, 9, 0x08, + 306, 9, 9, 9, 0x08, + 321, 9, 9, 9, 0x08, + 329, 9, 9, 9, 0x08, + 344, 339, 9, 9, 0x08, + + 0 // eod +}; + +static const char qt_meta_stringdata_UEFITool[] = { + "UEFITool\0\0init()\0openImageFile()\0" + "saveImageFile()\0current\0populateUi(QModelIndex)\0" + "resizeTreeViewColums()\0mode\0extract(UINT8)\0" + "extractAsIs()\0extractBody()\0" + "extractUncompressed()\0insert(UINT8)\0" + "insertInto()\0insertBefore()\0insertAfter()\0" + "replace()\0remove()\0rebuild()\0" + "changeToNone()\0changeToEfi11()\0" + "changeToTiano()\0changeToLzma()\0about()\0" + "aboutQt()\0item\0scrollTreeView(QListWidgetItem*)\0" +}; + +void UEFITool::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + Q_ASSERT(staticMetaObject.cast(_o)); + UEFITool *_t = static_cast(_o); + switch (_id) { + case 0: _t->init(); break; + case 1: _t->openImageFile(); break; + case 2: _t->saveImageFile(); break; + case 3: _t->populateUi((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; + case 4: _t->resizeTreeViewColums(); break; + case 5: _t->extract((*reinterpret_cast< const UINT8(*)>(_a[1]))); break; + case 6: _t->extractAsIs(); break; + case 7: _t->extractBody(); break; + case 8: _t->extractUncompressed(); break; + case 9: _t->insert((*reinterpret_cast< const UINT8(*)>(_a[1]))); break; + case 10: _t->insertInto(); break; + case 11: _t->insertBefore(); break; + case 12: _t->insertAfter(); break; + case 13: _t->replace(); break; + case 14: _t->remove(); break; + case 15: _t->rebuild(); break; + case 16: _t->changeToNone(); break; + case 17: _t->changeToEfi11(); break; + case 18: _t->changeToTiano(); break; + case 19: _t->changeToLzma(); break; + case 20: _t->about(); break; + case 21: _t->aboutQt(); break; + case 22: _t->scrollTreeView((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; + default: ; + } + } +} + +const QMetaObjectExtraData UEFITool::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject UEFITool::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_UEFITool, + qt_meta_data_UEFITool, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &UEFITool::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *UEFITool::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *UEFITool::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_UEFITool)) + return static_cast(const_cast< UEFITool*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int UEFITool::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 23) + qt_static_metacall(this, _c, _id, _a); + _id -= 23; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/treeitem.h b/treeitem.h index 50903c9..1802884 100644 --- a/treeitem.h +++ b/treeitem.h @@ -125,7 +125,6 @@ private: UINT8 itemType; UINT8 itemSubtype; UINT8 itemCompression; - UINT8 itemNewCompression; QByteArray itemHeader; QByteArray itemBody; QByteArray itemTail; diff --git a/treemodel.cpp b/treemodel.cpp index e31ab3f..b8cf8c6 100644 --- a/treemodel.cpp +++ b/treemodel.cpp @@ -168,8 +168,8 @@ QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT const QByteArray & header, const QByteArray & body, const QByteArray & tail, const QModelIndex & index, const UINT8 mode) { - TreeItem *item; - TreeItem *parentItem; + TreeItem *item = 0; + TreeItem *parentItem = 0; int parentColumn = 0; if (!index.isValid()) diff --git a/uefitool.cpp b/uefitool.cpp index 241a968..042f195 100644 --- a/uefitool.cpp +++ b/uefitool.cpp @@ -40,7 +40,8 @@ UEFITool::UEFITool(QWidget *parent) : connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(exit())); - // Enable Drag-and-Drop actions + + // Enable Drag-and-Drop actions this->setAcceptDrops(true); // Initialize non-persistent data @@ -59,7 +60,7 @@ void UEFITool::init() ui->messageListWidget->clear(); ui->infoEdit->clear(); - // Disable all actions except openImageFile + // Disable actions and menus ui->actionExtract->setDisabled(true); ui->actionExtractBody->setDisabled(true); ui->actionExtractUncompressed->setDisabled(true); @@ -70,6 +71,7 @@ void UEFITool::init() ui->actionInsertBefore->setDisabled(true); ui->actionInsertAfter->setDisabled(true); ui->actionSaveImageFile->setDisabled(true); + ui->menuChangeCompressionTo->setDisabled(true); // Make new ffsEngine if (ffsEngine) diff --git a/uefitool.ui b/uefitool.ui index a65270f..1d0206d 100644 --- a/uefitool.ui +++ b/uefitool.ui @@ -6,8 +6,8 @@ 0 0 - 1100 - 700 + 800 + 483 @@ -20,7 +20,7 @@ true - UEFITool 0.9.2 + UEFITool 0.9.3 @@ -56,12 +56,6 @@ - - - Consolas - 10 - - 10 @@ -114,12 +108,6 @@ 0 - - - Consolas - 10 - - false @@ -202,8 +190,8 @@ 0 0 - 1100 - 21 + 800 + 22 diff --git a/ui_uefitool.h b/ui_uefitool.h new file mode 100644 index 0000000..ade0788 --- /dev/null +++ b/ui_uefitool.h @@ -0,0 +1,370 @@ +/******************************************************************************** +** Form generated from reading UI file 'uefitool.ui' +** +** Created by: Qt User Interface Compiler version 4.8.5 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_UEFITOOL_H +#define UI_UEFITOOL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_UEFITool +{ +public: + QAction *actionInsertAfter; + QAction *actionInsertBefore; + QAction *actionReplace; + QAction *actionExtract; + QAction *actionExtractBody; + QAction *actionExtractUncompressed; + QAction *actionRemove; + QAction *actionOpenImageFile; + QAction *actionInsertInto; + QAction *actionSaveImageFile; + QAction *actionRebuild; + QAction *actionChangeToTiano; + QAction *actionChangeToEfi11; + QAction *actionChangeToLzma; + QAction *actionAbout; + QAction *actionAboutQt; + QAction *actionQuit; + QAction *actionChangeToNone; + QWidget *centralWidget; + QGridLayout *gridLayout_2; + QGroupBox *structureGroupBox; + QGridLayout *gridLayout; + QTreeView *structureTreeView; + QGroupBox *infoGroupBox; + QVBoxLayout *verticalLayout; + QPlainTextEdit *infoEdit; + QGroupBox *messageGroupBox; + QHBoxLayout *horizontalLayout; + QListWidget *messageListWidget; + QStatusBar *statusBar; + QToolBar *toolBar; + QMenuBar *menuBar; + QMenu *menuFile; + QMenu *menuAction; + QMenu *menuChangeCompressionTo; + QMenu *menuHelp; + + void setupUi(QMainWindow *UEFITool) + { + if (UEFITool->objectName().isEmpty()) + UEFITool->setObjectName(QString::fromUtf8("UEFITool")); + UEFITool->resize(800, 483); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(UEFITool->sizePolicy().hasHeightForWidth()); + UEFITool->setSizePolicy(sizePolicy); + UEFITool->setAcceptDrops(true); + actionInsertAfter = new QAction(UEFITool); + actionInsertAfter->setObjectName(QString::fromUtf8("actionInsertAfter")); + actionInsertAfter->setEnabled(false); + actionInsertBefore = new QAction(UEFITool); + actionInsertBefore->setObjectName(QString::fromUtf8("actionInsertBefore")); + actionInsertBefore->setEnabled(false); + actionReplace = new QAction(UEFITool); + actionReplace->setObjectName(QString::fromUtf8("actionReplace")); + actionReplace->setEnabled(false); + actionExtract = new QAction(UEFITool); + actionExtract->setObjectName(QString::fromUtf8("actionExtract")); + actionExtract->setEnabled(false); + actionExtractBody = new QAction(UEFITool); + actionExtractBody->setObjectName(QString::fromUtf8("actionExtractBody")); + actionExtractBody->setEnabled(false); + actionExtractUncompressed = new QAction(UEFITool); + actionExtractUncompressed->setObjectName(QString::fromUtf8("actionExtractUncompressed")); + actionExtractUncompressed->setEnabled(false); + actionRemove = new QAction(UEFITool); + actionRemove->setObjectName(QString::fromUtf8("actionRemove")); + actionRemove->setEnabled(false); + actionOpenImageFile = new QAction(UEFITool); + actionOpenImageFile->setObjectName(QString::fromUtf8("actionOpenImageFile")); + actionInsertInto = new QAction(UEFITool); + actionInsertInto->setObjectName(QString::fromUtf8("actionInsertInto")); + actionInsertInto->setEnabled(false); + actionSaveImageFile = new QAction(UEFITool); + actionSaveImageFile->setObjectName(QString::fromUtf8("actionSaveImageFile")); + actionSaveImageFile->setEnabled(false); + actionRebuild = new QAction(UEFITool); + actionRebuild->setObjectName(QString::fromUtf8("actionRebuild")); + actionRebuild->setEnabled(false); + actionChangeToTiano = new QAction(UEFITool); + actionChangeToTiano->setObjectName(QString::fromUtf8("actionChangeToTiano")); + actionChangeToEfi11 = new QAction(UEFITool); + actionChangeToEfi11->setObjectName(QString::fromUtf8("actionChangeToEfi11")); + actionChangeToLzma = new QAction(UEFITool); + actionChangeToLzma->setObjectName(QString::fromUtf8("actionChangeToLzma")); + actionAbout = new QAction(UEFITool); + actionAbout->setObjectName(QString::fromUtf8("actionAbout")); + actionAbout->setMenuRole(QAction::AboutRole); + actionAboutQt = new QAction(UEFITool); + actionAboutQt->setObjectName(QString::fromUtf8("actionAboutQt")); + actionAboutQt->setMenuRole(QAction::AboutQtRole); + actionQuit = new QAction(UEFITool); + actionQuit->setObjectName(QString::fromUtf8("actionQuit")); + actionQuit->setMenuRole(QAction::QuitRole); + actionChangeToNone = new QAction(UEFITool); + actionChangeToNone->setObjectName(QString::fromUtf8("actionChangeToNone")); + centralWidget = new QWidget(UEFITool); + centralWidget->setObjectName(QString::fromUtf8("centralWidget")); + QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth()); + centralWidget->setSizePolicy(sizePolicy1); + gridLayout_2 = new QGridLayout(centralWidget); + gridLayout_2->setSpacing(5); + gridLayout_2->setContentsMargins(5, 5, 5, 5); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + structureGroupBox = new QGroupBox(centralWidget); + structureGroupBox->setObjectName(QString::fromUtf8("structureGroupBox")); + sizePolicy.setHeightForWidth(structureGroupBox->sizePolicy().hasHeightForWidth()); + structureGroupBox->setSizePolicy(sizePolicy); + gridLayout = new QGridLayout(structureGroupBox); + gridLayout->setSpacing(5); + gridLayout->setContentsMargins(5, 5, 5, 5); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + structureTreeView = new QTreeView(structureGroupBox); + structureTreeView->setObjectName(QString::fromUtf8("structureTreeView")); + structureTreeView->setIndentation(10); + structureTreeView->setHeaderHidden(false); + structureTreeView->header()->setCascadingSectionResizes(true); + structureTreeView->header()->setDefaultSectionSize(200); + structureTreeView->header()->setStretchLastSection(true); + + gridLayout->addWidget(structureTreeView, 0, 0, 1, 2); + + + gridLayout_2->addWidget(structureGroupBox, 0, 0, 1, 1); + + infoGroupBox = new QGroupBox(centralWidget); + infoGroupBox->setObjectName(QString::fromUtf8("infoGroupBox")); + QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(infoGroupBox->sizePolicy().hasHeightForWidth()); + infoGroupBox->setSizePolicy(sizePolicy2); + infoGroupBox->setMaximumSize(QSize(220, 16777215)); + verticalLayout = new QVBoxLayout(infoGroupBox); + verticalLayout->setSpacing(5); + verticalLayout->setContentsMargins(5, 5, 5, 5); + verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + infoEdit = new QPlainTextEdit(infoGroupBox); + infoEdit->setObjectName(QString::fromUtf8("infoEdit")); + sizePolicy.setHeightForWidth(infoEdit->sizePolicy().hasHeightForWidth()); + infoEdit->setSizePolicy(sizePolicy); + infoEdit->setUndoRedoEnabled(false); + infoEdit->setReadOnly(true); + infoEdit->setCenterOnScroll(false); + + verticalLayout->addWidget(infoEdit); + + + gridLayout_2->addWidget(infoGroupBox, 0, 1, 1, 1); + + messageGroupBox = new QGroupBox(centralWidget); + messageGroupBox->setObjectName(QString::fromUtf8("messageGroupBox")); + QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizePolicy3.setHorizontalStretch(0); + sizePolicy3.setVerticalStretch(0); + sizePolicy3.setHeightForWidth(messageGroupBox->sizePolicy().hasHeightForWidth()); + messageGroupBox->setSizePolicy(sizePolicy3); + messageGroupBox->setMaximumSize(QSize(16777215, 120)); + horizontalLayout = new QHBoxLayout(messageGroupBox); + horizontalLayout->setSpacing(5); + horizontalLayout->setContentsMargins(5, 5, 5, 5); + horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); + messageListWidget = new QListWidget(messageGroupBox); + messageListWidget->setObjectName(QString::fromUtf8("messageListWidget")); + + horizontalLayout->addWidget(messageListWidget); + + + gridLayout_2->addWidget(messageGroupBox, 1, 0, 1, 2); + + UEFITool->setCentralWidget(centralWidget); + statusBar = new QStatusBar(UEFITool); + statusBar->setObjectName(QString::fromUtf8("statusBar")); + UEFITool->setStatusBar(statusBar); + toolBar = new QToolBar(UEFITool); + toolBar->setObjectName(QString::fromUtf8("toolBar")); + toolBar->setEnabled(true); + UEFITool->addToolBar(Qt::LeftToolBarArea, toolBar); + menuBar = new QMenuBar(UEFITool); + menuBar->setObjectName(QString::fromUtf8("menuBar")); + menuBar->setGeometry(QRect(0, 0, 800, 22)); + menuFile = new QMenu(menuBar); + menuFile->setObjectName(QString::fromUtf8("menuFile")); + menuAction = new QMenu(menuBar); + menuAction->setObjectName(QString::fromUtf8("menuAction")); + menuChangeCompressionTo = new QMenu(menuAction); + menuChangeCompressionTo->setObjectName(QString::fromUtf8("menuChangeCompressionTo")); + menuChangeCompressionTo->setEnabled(true); + menuHelp = new QMenu(menuBar); + menuHelp->setObjectName(QString::fromUtf8("menuHelp")); + UEFITool->setMenuBar(menuBar); + + toolBar->addAction(actionOpenImageFile); + toolBar->addAction(actionSaveImageFile); + toolBar->addSeparator(); + toolBar->addAction(actionRebuild); + toolBar->addSeparator(); + toolBar->addAction(actionRemove); + toolBar->addSeparator(); + toolBar->addAction(actionExtract); + toolBar->addAction(actionExtractBody); + toolBar->addAction(actionExtractUncompressed); + toolBar->addSeparator(); + toolBar->addAction(actionInsertInto); + toolBar->addAction(actionInsertBefore); + toolBar->addAction(actionInsertAfter); + toolBar->addSeparator(); + toolBar->addAction(actionReplace); + menuBar->addAction(menuFile->menuAction()); + menuBar->addAction(menuAction->menuAction()); + menuBar->addAction(menuHelp->menuAction()); + menuFile->addAction(actionOpenImageFile); + menuFile->addAction(actionSaveImageFile); + menuFile->addSeparator(); + menuFile->addAction(actionQuit); + menuAction->addAction(actionRebuild); + menuAction->addSeparator(); + menuAction->addAction(actionRemove); + menuAction->addSeparator(); + menuAction->addAction(actionExtract); + menuAction->addAction(actionExtractBody); + menuAction->addAction(actionExtractUncompressed); + menuAction->addSeparator(); + menuAction->addAction(actionInsertInto); + menuAction->addAction(actionInsertAfter); + menuAction->addAction(actionInsertBefore); + menuAction->addSeparator(); + menuAction->addAction(actionReplace); + menuAction->addSeparator(); + menuAction->addAction(menuChangeCompressionTo->menuAction()); + menuChangeCompressionTo->addAction(actionChangeToNone); + menuChangeCompressionTo->addAction(actionChangeToTiano); + menuChangeCompressionTo->addAction(actionChangeToEfi11); + menuChangeCompressionTo->addAction(actionChangeToLzma); + menuHelp->addAction(actionAbout); + menuHelp->addAction(actionAboutQt); + + retranslateUi(UEFITool); + + QMetaObject::connectSlotsByName(UEFITool); + } // setupUi + + void retranslateUi(QMainWindow *UEFITool) + { + UEFITool->setWindowTitle(QApplication::translate("UEFITool", "UEFITool 0.9.3", 0, QApplication::UnicodeUTF8)); + actionInsertAfter->setText(QApplication::translate("UEFITool", "Insert &after...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionInsertAfter->setToolTip(QApplication::translate("UEFITool", "Insert an object from file after selected object", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionInsertAfter->setShortcut(QApplication::translate("UEFITool", "Ctrl+Shift+I", 0, QApplication::UnicodeUTF8)); + actionInsertBefore->setText(QApplication::translate("UEFITool", "Insert &before...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionInsertBefore->setToolTip(QApplication::translate("UEFITool", "Insert object from file before selected object", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionInsertBefore->setShortcut(QApplication::translate("UEFITool", "Ctrl+Alt+I", 0, QApplication::UnicodeUTF8)); + actionReplace->setText(QApplication::translate("UEFITool", "Rep&lace", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionReplace->setToolTip(QApplication::translate("UEFITool", "Replace selected object with an object from file", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionReplace->setShortcut(QApplication::translate("UEFITool", "Ctrl+R", 0, QApplication::UnicodeUTF8)); + actionExtract->setText(QApplication::translate("UEFITool", "E&xtract as is...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionExtract->setToolTip(QApplication::translate("UEFITool", "Extract selected object as is to file", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionExtract->setShortcut(QApplication::translate("UEFITool", "Ctrl+E", 0, QApplication::UnicodeUTF8)); + actionExtractBody->setText(QApplication::translate("UEFITool", "Extract &without header...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionExtractBody->setToolTip(QApplication::translate("UEFITool", "Extract selected object without header to file", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionExtractBody->setShortcut(QApplication::translate("UEFITool", "Ctrl+Shift+E", 0, QApplication::UnicodeUTF8)); + actionExtractUncompressed->setText(QApplication::translate("UEFITool", "Extract &uncompressed...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionExtractUncompressed->setToolTip(QApplication::translate("UEFITool", "Extract selected FFS file uncompressing it ", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionExtractUncompressed->setShortcut(QApplication::translate("UEFITool", "Ctrl+Alt+E", 0, QApplication::UnicodeUTF8)); + actionRemove->setText(QApplication::translate("UEFITool", "Re&move", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionRemove->setToolTip(QApplication::translate("UEFITool", "Remove selected object", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionRemove->setShortcut(QApplication::translate("UEFITool", "Ctrl+Del", 0, QApplication::UnicodeUTF8)); + actionOpenImageFile->setText(QApplication::translate("UEFITool", "&Open image file...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionOpenImageFile->setToolTip(QApplication::translate("UEFITool", "Open image file", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionOpenImageFile->setShortcut(QApplication::translate("UEFITool", "Ctrl+O", 0, QApplication::UnicodeUTF8)); + actionInsertInto->setText(QApplication::translate("UEFITool", "Insert &into...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionInsertInto->setToolTip(QApplication::translate("UEFITool", "Insert object from file into selected object", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionInsertInto->setShortcut(QApplication::translate("UEFITool", "Ctrl+I", 0, QApplication::UnicodeUTF8)); + actionSaveImageFile->setText(QApplication::translate("UEFITool", "&Save image file...", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionSaveImageFile->setToolTip(QApplication::translate("UEFITool", "Save modified image file", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionSaveImageFile->setShortcut(QApplication::translate("UEFITool", "Ctrl+S", 0, QApplication::UnicodeUTF8)); + actionRebuild->setText(QApplication::translate("UEFITool", "&Rebuild", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionRebuild->setToolTip(QApplication::translate("UEFITool", "Rebuild selected object", 0, QApplication::UnicodeUTF8)); +#endif // QT_NO_TOOLTIP + actionRebuild->setShortcut(QApplication::translate("UEFITool", "Ctrl+Space", 0, QApplication::UnicodeUTF8)); + actionChangeToTiano->setText(QApplication::translate("UEFITool", "&Tiano", 0, QApplication::UnicodeUTF8)); + actionChangeToTiano->setShortcut(QApplication::translate("UEFITool", "Ctrl+T", 0, QApplication::UnicodeUTF8)); + actionChangeToEfi11->setText(QApplication::translate("UEFITool", "&EFI 1.1", 0, QApplication::UnicodeUTF8)); + actionChangeToEfi11->setShortcut(QApplication::translate("UEFITool", "Ctrl+Shift+T", 0, QApplication::UnicodeUTF8)); + actionChangeToLzma->setText(QApplication::translate("UEFITool", "&LZMA", 0, QApplication::UnicodeUTF8)); + actionChangeToLzma->setShortcut(QApplication::translate("UEFITool", "Ctrl+L", 0, QApplication::UnicodeUTF8)); + actionAbout->setText(QApplication::translate("UEFITool", "&About UEFITool", 0, QApplication::UnicodeUTF8)); + actionAbout->setShortcut(QApplication::translate("UEFITool", "F1", 0, QApplication::UnicodeUTF8)); + actionAboutQt->setText(QApplication::translate("UEFITool", "About &Qt", 0, QApplication::UnicodeUTF8)); + actionQuit->setText(QApplication::translate("UEFITool", "&Quit", 0, QApplication::UnicodeUTF8)); + actionChangeToNone->setText(QApplication::translate("UEFITool", "&Uncompressed", 0, QApplication::UnicodeUTF8)); + actionChangeToNone->setShortcut(QApplication::translate("UEFITool", "Ctrl+U", 0, QApplication::UnicodeUTF8)); + structureGroupBox->setTitle(QApplication::translate("UEFITool", "Structure", 0, QApplication::UnicodeUTF8)); + infoGroupBox->setTitle(QApplication::translate("UEFITool", "Information", 0, QApplication::UnicodeUTF8)); + messageGroupBox->setTitle(QApplication::translate("UEFITool", "Message", 0, QApplication::UnicodeUTF8)); + toolBar->setWindowTitle(QApplication::translate("UEFITool", "toolBar", 0, QApplication::UnicodeUTF8)); + menuFile->setTitle(QApplication::translate("UEFITool", "&File", 0, QApplication::UnicodeUTF8)); + menuAction->setTitle(QApplication::translate("UEFITool", "A&ction", 0, QApplication::UnicodeUTF8)); + menuChangeCompressionTo->setTitle(QApplication::translate("UEFITool", "Change &compression to", 0, QApplication::UnicodeUTF8)); + menuHelp->setTitle(QApplication::translate("UEFITool", "H&elp", 0, QApplication::UnicodeUTF8)); + } // retranslateUi + +}; + +namespace Ui { + class UEFITool: public Ui_UEFITool {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_UEFITOOL_H