refactor: 重构十六进制编辑器的后端;更暗黑的暗色主题;
This commit is contained in:
parent
55ebbcd126
commit
f40d9525b0
|
@ -1,25 +1,29 @@
|
||||||
/*==============================================================================
|
/*
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
* QHexEdit is a Hex Editor Widget for the Qt Framework
|
||||||
**
|
* Copyright (C) 2010-2025 Winfried Simon
|
||||||
** This program is free software: you can redistribute it and/or modify it under
|
*
|
||||||
** the terms of the GNU Affero General Public License as published by the Free
|
* This library is free software; you can redistribute it and/or
|
||||||
** Software Foundation, version 3.
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
**
|
* License as published by the Free Software Foundation; either
|
||||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
*
|
||||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
* This library is distributed in the hope that it will be useful,
|
||||||
** details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
**
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
** You should have received a copy of the GNU Affero General Public License
|
* Lesser General Public License for more details.
|
||||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
*
|
||||||
**
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
** The original License is LGPL from Andres6936/QHexEdit. I have modified a lot
|
* License along with this library; if not, see
|
||||||
** so I decide to change the Open Source License. You can use the original
|
* https://www.gnu.org/licenses/
|
||||||
** library under LGPL. Thanks for Andres6936's efforts.
|
*/
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "chunks.h"
|
#include "chunks.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
|
#define NORMAL 0
|
||||||
|
#define HIGHLIGHTED 1
|
||||||
|
|
||||||
#define BUFFER_SIZE 0x10000
|
#define BUFFER_SIZE 0x10000
|
||||||
#define CHUNK_SIZE 0x1000
|
#define CHUNK_SIZE 0x1000
|
||||||
|
@ -29,38 +33,43 @@
|
||||||
|
|
||||||
// ***************************************** Constructors and file settings
|
// ***************************************** Constructors and file settings
|
||||||
|
|
||||||
Chunks::Chunks(QObject *parent) : QObject(parent) {}
|
Chunks::Chunks(QObject *parent) : QObject(parent) {
|
||||||
|
QBuffer *buf = new QBuffer(this);
|
||||||
|
setIODevice(buf);
|
||||||
|
}
|
||||||
|
|
||||||
Chunks::Chunks(QIODevice *ioDevice, QObject *parent) : QObject(parent) {
|
Chunks::Chunks(QIODevice *ioDevice, QObject *parent) : QObject(parent) {
|
||||||
setIODevice(ioDevice);
|
setIODevice(ioDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunks::~Chunks() {}
|
|
||||||
|
|
||||||
bool Chunks::setIODevice(QIODevice *ioDevice) {
|
bool Chunks::setIODevice(QIODevice *ioDevice) {
|
||||||
if (ioDevice && ioDevice->isOpen()) {
|
_ioDevice = ioDevice;
|
||||||
|
bool ok = _ioDevice->open(QIODevice::ReadOnly);
|
||||||
|
if (ok) // Try to open IODevice
|
||||||
|
{
|
||||||
ioDevice->setParent(this);
|
ioDevice->setParent(this);
|
||||||
_size = ioDevice->size();
|
_size = _ioDevice->size();
|
||||||
_ioDevice = ioDevice;
|
_ioDevice->close();
|
||||||
} else {
|
} else // Fallback is an empty buffer
|
||||||
return false;
|
{
|
||||||
|
QBuffer *buf = new QBuffer(this);
|
||||||
|
_ioDevice = buf;
|
||||||
|
_size = 0;
|
||||||
}
|
}
|
||||||
_chunks.clear();
|
_chunks.clear();
|
||||||
_pos = 0;
|
return ok;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************** Getting data out of Chunks
|
// ***************************************** Getting data out of Chunks
|
||||||
|
|
||||||
QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
|
QByteArray Chunks::data(qint64 pos, qint64 maxSize) const {
|
||||||
qsizetype ioDelta = 0;
|
qint64 ioDelta = 0;
|
||||||
qsizetype chunkIdx = 0;
|
int chunkIdx = 0;
|
||||||
|
|
||||||
Chunk chunk;
|
Chunk chunk;
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
|
|
||||||
// Do some checks and some arrangements
|
// Do some checks and some arrangements
|
||||||
|
|
||||||
if (pos >= _size)
|
if (pos >= _size)
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
||||||
|
@ -69,8 +78,10 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
|
||||||
else if ((pos + maxSize) > _size)
|
else if ((pos + maxSize) > _size)
|
||||||
maxSize = _size - pos;
|
maxSize = _size - pos;
|
||||||
|
|
||||||
|
_ioDevice->open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
while (maxSize > 0) {
|
while (maxSize > 0) {
|
||||||
chunk.absPos = std::numeric_limits<qsizetype>::max();
|
chunk.absPos = LLONG_MAX;
|
||||||
bool chunksLoopOngoing = true;
|
bool chunksLoopOngoing = true;
|
||||||
while ((chunkIdx < _chunks.count()) && chunksLoopOngoing) {
|
while ((chunkIdx < _chunks.count()) && chunksLoopOngoing) {
|
||||||
// In this section, we track changes before our required data and
|
// In this section, we track changes before our required data and
|
||||||
|
@ -84,16 +95,16 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
|
||||||
else {
|
else {
|
||||||
chunkIdx += 1;
|
chunkIdx += 1;
|
||||||
qint64 count;
|
qint64 count;
|
||||||
qint64 chunkOfs = qint64(pos - chunk.absPos);
|
qint64 chunkOfs = pos - chunk.absPos;
|
||||||
if (maxSize > (chunk.data.size() - chunkOfs)) {
|
if (maxSize > ((qint64)chunk.data.size() - chunkOfs)) {
|
||||||
count = qint64(chunk.data.size()) - chunkOfs;
|
count = (qint64)chunk.data.size() - chunkOfs;
|
||||||
ioDelta += CHUNK_SIZE - quint64(chunk.data.size());
|
ioDelta += CHUNK_SIZE - chunk.data.size();
|
||||||
} else
|
} else
|
||||||
count = maxSize;
|
count = maxSize;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
buffer += chunk.data.mid(int(chunkOfs), int(count));
|
buffer += chunk.data.mid(chunkOfs, (int)count);
|
||||||
maxSize -= count;
|
maxSize -= count;
|
||||||
pos += quint64(count);
|
pos += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +115,7 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
|
||||||
|
|
||||||
qint64 byteCount;
|
qint64 byteCount;
|
||||||
QByteArray readBuffer;
|
QByteArray readBuffer;
|
||||||
if (chunk.absPos - pos > qsizetype(maxSize))
|
if ((chunk.absPos - pos) > maxSize)
|
||||||
byteCount = maxSize;
|
byteCount = maxSize;
|
||||||
else
|
else
|
||||||
byteCount = chunk.absPos - pos;
|
byteCount = chunk.absPos - pos;
|
||||||
|
@ -113,134 +124,175 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
|
||||||
_ioDevice->seek(pos + ioDelta);
|
_ioDevice->seek(pos + ioDelta);
|
||||||
readBuffer = _ioDevice->read(byteCount);
|
readBuffer = _ioDevice->read(byteCount);
|
||||||
buffer += readBuffer;
|
buffer += readBuffer;
|
||||||
pos += quint64(readBuffer.size());
|
pos += readBuffer.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ioDevice->close();
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Chunks::write(QIODevice *iODevice, qsizetype pos, qsizetype count) {
|
bool Chunks::write(QIODevice *iODevice, qint64 pos, qint64 count) {
|
||||||
if (count == -1)
|
if (count == -1)
|
||||||
count = _size;
|
count = _size;
|
||||||
|
if (iODevice->isOpen()) {
|
||||||
bool ok = iODevice->isOpen() && iODevice->isWritable();
|
if (iODevice->isWritable()) {
|
||||||
if (ok) {
|
for (qint64 idx = pos; idx < count; idx += BUFFER_SIZE) {
|
||||||
for (auto idx = pos; idx < qsizetype(count); idx += BUFFER_SIZE) {
|
QByteArray ba = data(idx, BUFFER_SIZE);
|
||||||
QByteArray ba = data(idx, BUFFER_SIZE);
|
iODevice->write(ba);
|
||||||
iODevice->write(ba);
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
bool ok = iODevice->open(QIODevice::WriteOnly);
|
||||||
|
if (ok) {
|
||||||
|
for (qint64 idx = pos; idx < count; idx += BUFFER_SIZE) {
|
||||||
|
QByteArray ba = data(idx, BUFFER_SIZE);
|
||||||
|
iODevice->write(ba);
|
||||||
|
}
|
||||||
|
iODevice->close();
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************** Search API
|
// ***************************************** Search API
|
||||||
|
|
||||||
qsizetype Chunks::indexOf(const QByteArray &ba, qsizetype from) {
|
qint64 Chunks::indexOf(const QByteArray &ba, qint64 from) const {
|
||||||
qsizetype result = -1;
|
qint64 result = -1;
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
|
|
||||||
for (auto pos = from; (pos < _size) && (result < 0); pos += BUFFER_SIZE) {
|
for (qint64 pos = from; (pos < _size) && (result < 0); pos += BUFFER_SIZE) {
|
||||||
buffer = data(pos, BUFFER_SIZE + ba.size() - 1);
|
buffer = data(pos, BUFFER_SIZE + ba.size() - 1);
|
||||||
int findPos = buffer.indexOf(ba);
|
int findPos = buffer.indexOf(ba);
|
||||||
if (findPos >= 0)
|
if (findPos >= 0)
|
||||||
result = pos + findPos;
|
result = pos + (qint64)findPos;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsizetype Chunks::lastIndexOf(const QByteArray &ba, qsizetype from) {
|
qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from) const {
|
||||||
qint64 result = -1;
|
qint64 result = -1;
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
|
|
||||||
for (auto pos = from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) {
|
for (qint64 pos = from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) {
|
||||||
auto sPos = pos - BUFFER_SIZE - ba.size() + 1;
|
qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1;
|
||||||
/*if (sPos < 0)
|
if (sPos < 0)
|
||||||
sPos = 0;*/
|
sPos = 0;
|
||||||
buffer = data(sPos, pos - sPos);
|
buffer = data(sPos, pos - sPos);
|
||||||
auto findPos = buffer.lastIndexOf(ba);
|
int findPos = buffer.lastIndexOf(ba);
|
||||||
if (findPos >= 0)
|
if (findPos >= 0)
|
||||||
result = sPos + findPos;
|
result = sPos + (qint64)findPos;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************** Char manipulations
|
// ***************************************** Char manipulations
|
||||||
|
|
||||||
bool Chunks::insert(qsizetype pos, char b) {
|
bool Chunks::insert(qint64 pos, char b) {
|
||||||
if (pos > _size)
|
return insert(pos, QByteArray(1, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Chunks::overwrite(qint64 pos, char b) {
|
||||||
|
return overwrite(pos, QByteArray(1, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Chunks::removeAt(qint64 pos) { return remove(pos, 1); }
|
||||||
|
|
||||||
|
bool Chunks::insert(qint64 pos, const QByteArray &ba) {
|
||||||
|
if ((pos < 0) || (pos > _size))
|
||||||
return false;
|
return false;
|
||||||
qsizetype chunkIdx;
|
|
||||||
if (pos == _size) {
|
if (ba.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto length = ba.length();
|
||||||
|
int chunkIdx;
|
||||||
|
if (pos == _size)
|
||||||
chunkIdx = getChunkIndex(pos - 1);
|
chunkIdx = getChunkIndex(pos - 1);
|
||||||
} else
|
else
|
||||||
chunkIdx = getChunkIndex(pos);
|
chunkIdx = getChunkIndex(pos);
|
||||||
auto posInBa = pos - _chunks[chunkIdx].absPos;
|
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
|
||||||
_chunks[chunkIdx].data.insert(int(posInBa), b);
|
_chunks[chunkIdx].data.insert(posInBa, ba);
|
||||||
_chunks[chunkIdx].dataChanged.insert(int(posInBa), char(1));
|
|
||||||
for (auto idx = chunkIdx + 1; idx < _chunks.size(); idx++)
|
|
||||||
_chunks[idx].absPos += 1;
|
|
||||||
_size += 1;
|
|
||||||
_pos = pos;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Chunks::overwrite(qsizetype pos, char b) {
|
|
||||||
if (pos >= _size)
|
|
||||||
return false;
|
|
||||||
auto chunkIdx = getChunkIndex(pos);
|
|
||||||
auto posInBa = pos - _chunks[chunkIdx].absPos;
|
|
||||||
_chunks[chunkIdx].data[int(posInBa)] = b;
|
|
||||||
_chunks[chunkIdx].dataChanged[int(posInBa)] = char(1);
|
|
||||||
_pos = pos;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Chunks::removeAt(qsizetype pos) {
|
|
||||||
if (pos >= _size)
|
|
||||||
return false;
|
|
||||||
auto chunkIdx = getChunkIndex(pos);
|
|
||||||
auto posInBa = pos - _chunks[chunkIdx].absPos;
|
|
||||||
_chunks[chunkIdx].data.remove(int(posInBa), 1);
|
|
||||||
_chunks[chunkIdx].dataChanged.remove(int(posInBa), 1);
|
|
||||||
for (int idx = chunkIdx + 1; idx < _chunks.size(); idx++)
|
for (int idx = chunkIdx + 1; idx < _chunks.size(); idx++)
|
||||||
_chunks[idx].absPos -= 1;
|
_chunks[idx].absPos += length;
|
||||||
_size -= 1;
|
_size += length;
|
||||||
_pos = pos;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Chunks::overwrite(qint64 pos, const QByteArray &ba) {
|
||||||
|
if ((pos < 0) || (pos >= _size))
|
||||||
|
return false;
|
||||||
|
int chunkIdx = getChunkIndex(pos);
|
||||||
|
|
||||||
|
auto &chunk = _chunks[chunkIdx];
|
||||||
|
qint64 posInBa = pos - chunk.absPos;
|
||||||
|
|
||||||
|
auto length = ba.length();
|
||||||
|
auto clen = chunk.data.size();
|
||||||
|
auto dist = length + posInBa - clen;
|
||||||
|
|
||||||
|
if (dist <= 0) {
|
||||||
|
chunk.data.replace(posInBa, length, ba);
|
||||||
|
} else {
|
||||||
|
auto len = clen - posInBa;
|
||||||
|
chunk.data.replace(posInBa, len, ba.left(len));
|
||||||
|
if (!overwrite(pos + clen, ba.right(dist))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Chunks::remove(qint64 pos, qint64 length) {
|
||||||
|
if ((pos < 0) || (pos >= _size))
|
||||||
|
return false;
|
||||||
|
int chunkIdx = getChunkIndex(pos);
|
||||||
|
|
||||||
|
auto &chunk = _chunks[chunkIdx];
|
||||||
|
qint64 posInBa = pos - chunk.absPos;
|
||||||
|
|
||||||
|
auto clen = chunk.data.size();
|
||||||
|
auto dist = length + posInBa - clen;
|
||||||
|
|
||||||
|
if (dist <= 0) {
|
||||||
|
chunk.data.remove(posInBa, length);
|
||||||
|
for (int idx = chunkIdx + 1; idx < _chunks.size(); idx++)
|
||||||
|
_chunks[idx].absPos += length;
|
||||||
|
_size -= length;
|
||||||
|
} else {
|
||||||
|
auto len = clen - posInBa;
|
||||||
|
chunk.data.remove(posInBa, len);
|
||||||
|
for (int idx = chunkIdx + 1; idx < _chunks.size(); idx++)
|
||||||
|
_chunks[idx].absPos -= len;
|
||||||
|
_size -= len;
|
||||||
|
|
||||||
|
if (!remove(pos + clen, dist)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************** Utility functions
|
// ***************************************** Utility functions
|
||||||
|
|
||||||
char Chunks::operator[](qsizetype pos) {
|
char Chunks::at(qint64 pos) const { return data(pos, 1).at(0); }
|
||||||
auto d = data(pos, 1);
|
|
||||||
if (d.isEmpty())
|
|
||||||
return '0';
|
|
||||||
return d.at(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
qsizetype Chunks::pos() { return _pos; }
|
char Chunks::operator[](qint64 pos) const { return this->at(pos); }
|
||||||
|
|
||||||
qsizetype Chunks::size() { return _size; }
|
qint64 Chunks::size() const { return _size; }
|
||||||
|
|
||||||
qsizetype Chunks::getChunkIndex(qsizetype absPos) {
|
int Chunks::getChunkIndex(qint64 absPos) {
|
||||||
// This routine checks, if there is already a copied chunk available. If so,
|
// This routine checks, if there is already a copied chunk available. If os,
|
||||||
// it returns a reference to it. If there is no copied chunk available,
|
// it returns a reference to it. If there is no copied chunk available,
|
||||||
// original data will be copied into a new chunk.
|
// original data will be copied into a new chunk.
|
||||||
|
|
||||||
qsizetype foundIdx = -1;
|
int foundIdx = -1;
|
||||||
qsizetype insertIdx = 0;
|
int insertIdx = 0;
|
||||||
qsizetype ioDelta = 0;
|
qint64 ioDelta = 0;
|
||||||
|
|
||||||
// fix the bug by wingsummer
|
|
||||||
if (absPos < 0) {
|
|
||||||
Chunk newChunk;
|
|
||||||
newChunk.data = QByteArray(CHUNK_SIZE, 0);
|
|
||||||
newChunk.absPos = 0;
|
|
||||||
newChunk.dataChanged = nullptr;
|
|
||||||
_chunks.insert(insertIdx, newChunk);
|
|
||||||
return insertIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int idx = 0; idx < _chunks.size(); idx++) {
|
for (int idx = 0; idx < _chunks.size(); idx++) {
|
||||||
Chunk chunk = _chunks[idx];
|
Chunk chunk = _chunks[idx];
|
||||||
|
@ -259,14 +311,17 @@ qsizetype Chunks::getChunkIndex(qsizetype absPos) {
|
||||||
|
|
||||||
if (foundIdx == -1) {
|
if (foundIdx == -1) {
|
||||||
Chunk newChunk;
|
Chunk newChunk;
|
||||||
qsizetype readAbsPos = absPos - ioDelta;
|
qint64 readAbsPos = absPos - ioDelta;
|
||||||
qsizetype readPos = (readAbsPos & READ_CHUNK_MASK);
|
qint64 readPos = (readAbsPos & READ_CHUNK_MASK);
|
||||||
_ioDevice->seek(qint64(readPos));
|
_ioDevice->open(QIODevice::ReadOnly);
|
||||||
|
_ioDevice->seek(readPos);
|
||||||
newChunk.data = _ioDevice->read(CHUNK_SIZE);
|
newChunk.data = _ioDevice->read(CHUNK_SIZE);
|
||||||
|
_ioDevice->close();
|
||||||
newChunk.absPos = absPos - (readAbsPos - readPos);
|
newChunk.absPos = absPos - (readAbsPos - readPos);
|
||||||
newChunk.dataChanged = QByteArray(newChunk.data.size(), char(0));
|
|
||||||
_chunks.insert(insertIdx, newChunk);
|
_chunks.insert(insertIdx, newChunk);
|
||||||
foundIdx = insertIdx;
|
foundIdx = insertIdx;
|
||||||
}
|
}
|
||||||
return foundIdx;
|
return foundIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIODevice *Chunks::ioDevice() const { return _ioDevice; }
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
/*==============================================================================
|
/*
|
||||||
** Copyright (C) 2024-2027 WingSummer
|
* QHexEdit is a Hex Editor Widget for the Qt Framework
|
||||||
**
|
* Copyright (C) 2010-2025 Winfried Simon
|
||||||
** This program is free software: you can redistribute it and/or modify it under
|
*
|
||||||
** the terms of the GNU Affero General Public License as published by the Free
|
* This library is free software; you can redistribute it and/or
|
||||||
** Software Foundation, version 3.
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
**
|
* License as published by the Free Software Foundation; either
|
||||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
*
|
||||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
* This library is distributed in the hope that it will be useful,
|
||||||
** details.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
**
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
** You should have received a copy of the GNU Affero General Public License
|
* Lesser General Public License for more details.
|
||||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
*
|
||||||
**
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
** The original License is LGPL from Andres6936/QHexEdit. I have modified a lot
|
* License along with this library; if not, see
|
||||||
** so I decide to change the Open Source License. You can use the original
|
* https://www.gnu.org/licenses/
|
||||||
** library under LGPL. Thanks for Andres6936's efforts.
|
*/
|
||||||
** =============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CHUNKS_H
|
#ifndef CHUNKS_H
|
||||||
#define CHUNKS_H
|
#define CHUNKS_H
|
||||||
|
@ -40,49 +38,59 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QtCore>
|
// I (wingsummer) made some modifications for supporting QByteArray
|
||||||
#include <QtGlobal>
|
// manipulations, great thanks for Simsys's effort!
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QList>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
struct Chunk {
|
struct Chunk {
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QByteArray dataChanged;
|
qint64 absPos;
|
||||||
qsizetype absPos;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Chunks : public QObject {
|
class Chunks : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors and file settings
|
// Constructors and file settings
|
||||||
Chunks(QObject *parent = nullptr);
|
explicit Chunks(QObject *parent);
|
||||||
Chunks(QIODevice *ioDevice, QObject *parent);
|
explicit Chunks(QIODevice *ioDevice, QObject *parent);
|
||||||
|
|
||||||
~Chunks();
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
QIODevice *ioDevice() const;
|
||||||
bool setIODevice(QIODevice *ioDevice);
|
bool setIODevice(QIODevice *ioDevice);
|
||||||
|
|
||||||
// Getting data out of Chunks
|
// Getting data out of Chunks
|
||||||
QByteArray data(qsizetype pos = 0, qsizetype maxSize = -1);
|
QByteArray data(qint64 pos = 0, qint64 count = -1) const;
|
||||||
bool write(QIODevice *iODevice, qsizetype pos = 0, qsizetype count = -1);
|
bool write(QIODevice *iODevice, qint64 pos = 0, qint64 count = -1);
|
||||||
|
|
||||||
// Search API
|
// Search API
|
||||||
qsizetype indexOf(const QByteArray &ba, qsizetype from);
|
qint64 indexOf(const QByteArray &ba, qint64 from) const;
|
||||||
qsizetype lastIndexOf(const QByteArray &ba, qsizetype from);
|
qint64 lastIndexOf(const QByteArray &ba, qint64 from) const;
|
||||||
|
|
||||||
// Char manipulations
|
// Char manipulations
|
||||||
bool insert(qsizetype pos, char b);
|
bool insert(qint64 pos, char b);
|
||||||
bool overwrite(qsizetype pos, char b);
|
bool overwrite(qint64 pos, char b);
|
||||||
bool removeAt(qsizetype pos);
|
bool removeAt(qint64 pos);
|
||||||
|
|
||||||
|
// QByteArray manipulations by wingsummer
|
||||||
|
bool insert(qint64 pos, const QByteArray &ba);
|
||||||
|
bool overwrite(qint64 pos, const QByteArray &ba);
|
||||||
|
bool remove(qint64 pos, qint64 length);
|
||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
char operator[](qsizetype pos);
|
char at(qint64 pos) const; // by wingsummer
|
||||||
qsizetype pos();
|
char operator[](qint64 pos) const;
|
||||||
qsizetype size();
|
qint64 size() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int getChunkIndex(qint64 absPos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qsizetype getChunkIndex(qsizetype absPos);
|
|
||||||
QIODevice *_ioDevice;
|
QIODevice *_ioDevice;
|
||||||
qsizetype _pos;
|
qint64 _size;
|
||||||
qsizetype _size;
|
|
||||||
QList<Chunk> _chunks;
|
QList<Chunk> _chunks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,28 +18,24 @@
|
||||||
#include "QHexEdit2/chunks.h"
|
#include "QHexEdit2/chunks.h"
|
||||||
|
|
||||||
QFileBuffer::QFileBuffer(QObject *parent) : QHexBuffer(parent) {
|
QFileBuffer::QFileBuffer(QObject *parent) : QHexBuffer(parent) {
|
||||||
_chunks = new Chunks(parent);
|
_chunks = new Chunks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileBuffer::~QFileBuffer() {}
|
QFileBuffer::~QFileBuffer() {}
|
||||||
|
|
||||||
uchar QFileBuffer::at(qsizetype idx) {
|
uchar QFileBuffer::at(qsizetype idx) {
|
||||||
auto data = _chunks->data(idx, 1);
|
auto data = _chunks->at(idx);
|
||||||
return uchar(data[0]);
|
return uchar(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
qsizetype QFileBuffer::length() const { return _chunks->size(); }
|
qsizetype QFileBuffer::length() const { return _chunks->size(); }
|
||||||
|
|
||||||
void QFileBuffer::insert(qsizetype offset, const QByteArray &data) {
|
void QFileBuffer::insert(qsizetype offset, const QByteArray &data) {
|
||||||
for (int i = 0; i < data.length(); i++) {
|
_chunks->insert(offset, data);
|
||||||
_chunks->insert(offset + i, data.at(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFileBuffer::remove(qsizetype offset, qsizetype length) {
|
void QFileBuffer::remove(qsizetype offset, qsizetype length) {
|
||||||
for (uint i = 0; i < uint(length); i++) {
|
_chunks->remove(offset, length);
|
||||||
_chunks->removeAt(offset + i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray QFileBuffer::read(qsizetype offset, qsizetype length) {
|
QByteArray QFileBuffer::read(qsizetype offset, qsizetype length) {
|
||||||
|
@ -47,7 +43,11 @@ QByteArray QFileBuffer::read(qsizetype offset, qsizetype length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFileBuffer::read(QIODevice *device) {
|
bool QFileBuffer::read(QIODevice *device) {
|
||||||
return _chunks->setIODevice(device);
|
auto d = _chunks->ioDevice();
|
||||||
|
auto ret = _chunks->setIODevice(device);
|
||||||
|
d->setParent(nullptr);
|
||||||
|
d->deleteLater();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFileBuffer::write(QIODevice *device) { _chunks->write(device); }
|
void QFileBuffer::write(QIODevice *device) { _chunks->write(device); }
|
||||||
|
|
|
@ -617,6 +617,7 @@ QHexDocument::QHexDocument(QHexBuffer *buffer, bool readonly)
|
||||||
: QObject(nullptr), m_baseaddress(0), m_readonly(false), m_keepsize(false),
|
: QObject(nullptr), m_baseaddress(0), m_readonly(false), m_keepsize(false),
|
||||||
m_islocked(false) {
|
m_islocked(false) {
|
||||||
|
|
||||||
|
buffer->setParent(this);
|
||||||
m_buffer = buffer;
|
m_buffer = buffer;
|
||||||
m_areaindent = DEFAULT_AREA_IDENTATION;
|
m_areaindent = DEFAULT_AREA_IDENTATION;
|
||||||
m_hexlinewidth = DEFAULT_HEX_LINE_LENGTH;
|
m_hexlinewidth = DEFAULT_HEX_LINE_LENGTH;
|
||||||
|
@ -874,28 +875,13 @@ qsizetype QHexDocument::findPreviousExt(qsizetype begin,
|
||||||
return findPreviousExt(begin, patterns);
|
return findPreviousExt(begin, patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHexDocument *QHexDocument::fromLargeFile(const QString &filename,
|
|
||||||
bool readonly) {
|
|
||||||
|
|
||||||
auto f = new QFile;
|
|
||||||
if (!filename.isEmpty()) {
|
|
||||||
f->setFileName(filename);
|
|
||||||
QHexBuffer *hexbuffer = new QFileBuffer();
|
|
||||||
if (f->open(readonly ? QFile::ReadOnly : QFile::ReadWrite) &&
|
|
||||||
hexbuffer->read(f)) {
|
|
||||||
return new QHexDocument(hexbuffer,
|
|
||||||
readonly); // modified by wingsummer
|
|
||||||
} else {
|
|
||||||
delete hexbuffer;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete f;
|
|
||||||
return new QHexDocument(new QFileBuffer(), readonly);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QHexBuffer *QHexDocument::buffer() const { return m_buffer; }
|
QHexBuffer *QHexDocument::buffer() const { return m_buffer; }
|
||||||
|
|
||||||
|
void QHexDocument::setBuffer(QHexBuffer *buffer) {
|
||||||
|
if (buffer) {
|
||||||
|
m_buffer->deleteLater();
|
||||||
|
m_buffer = buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QUndoStack *QHexDocument::undoStack() const { return m_undostack; }
|
QUndoStack *QHexDocument::undoStack() const { return m_undostack; }
|
||||||
|
|
|
@ -237,10 +237,9 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static QHexDocument *fromMemory(const QByteArray &ba,
|
static QHexDocument *fromMemory(const QByteArray &ba,
|
||||||
bool readonly = false);
|
bool readonly = false);
|
||||||
static QHexDocument *fromLargeFile(const QString &filename,
|
|
||||||
bool readonly = false);
|
|
||||||
|
|
||||||
QHexBuffer *buffer() const;
|
QHexBuffer *buffer() const;
|
||||||
|
void setBuffer(QHexBuffer *buffer);
|
||||||
|
|
||||||
QUndoStack *undoStack() const;
|
QUndoStack *undoStack() const;
|
||||||
|
|
||||||
|
@ -304,7 +303,6 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
|
||||||
|
|
||||||
if (!iodevice->isOpen()) {
|
if (!iodevice->isOpen()) {
|
||||||
needsclose = true;
|
needsclose = true;
|
||||||
iodevice->open(QIODevice::ReadOnly);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QHexBuffer *hexbuffer = new T();
|
QHexBuffer *hexbuffer = new T();
|
||||||
|
@ -314,6 +312,9 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
|
||||||
|
|
||||||
return new QHexDocument(hexbuffer, readonly);
|
return new QHexDocument(hexbuffer, readonly);
|
||||||
} else {
|
} else {
|
||||||
|
if (needsclose)
|
||||||
|
iodevice->close();
|
||||||
|
|
||||||
delete hexbuffer;
|
delete hexbuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,17 +323,24 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
QHexDocument *QHexDocument::fromFile(QString filename, bool readonly) {
|
QHexDocument *QHexDocument::fromFile(QString filename, bool readonly) {
|
||||||
QFile f;
|
auto f = new QFile;
|
||||||
QHexDocument *doc;
|
if (!filename.isEmpty()) {
|
||||||
if (filename.length()) {
|
f->setFileName(filename);
|
||||||
f.setFileName(filename);
|
QHexBuffer *hexbuffer = new T();
|
||||||
f.open(QFile::ReadOnly);
|
if (f->open(readonly ? QFile::ReadOnly : QFile::ReadWrite)) {
|
||||||
doc = QHexDocument::fromDevice<T>(&f, readonly);
|
f->close();
|
||||||
f.close();
|
if (hexbuffer->read(f)) {
|
||||||
|
// modified by wingsummer
|
||||||
|
return new QHexDocument(hexbuffer, readonly);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delete hexbuffer;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
doc = new QHexDocument(new T(), readonly);
|
delete f;
|
||||||
|
return new QHexDocument(new T(), readonly);
|
||||||
}
|
}
|
||||||
return doc;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -269,60 +269,60 @@
|
||||||
<context>
|
<context>
|
||||||
<name>TestPlugin</name>
|
<name>TestPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="69"/>
|
<location filename="../testplugin.cpp" line="68"/>
|
||||||
<source>Test</source>
|
<source>Test</source>
|
||||||
<translation>测试</translation>
|
<translation>测试</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="81"/>
|
<location filename="../testplugin.cpp" line="79"/>
|
||||||
<location filename="../testplugin.cpp" line="90"/>
|
<location filename="../testplugin.cpp" line="82"/>
|
||||||
<location filename="../testplugin.cpp" line="95"/>
|
<location filename="../testplugin.cpp" line="85"/>
|
||||||
<location filename="../testplugin.cpp" line="164"/>
|
<location filename="../testplugin.cpp" line="144"/>
|
||||||
<source>TestPlugin</source>
|
<source>TestPlugin</source>
|
||||||
<translation>测试插件</translation>
|
<translation>测试插件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="99"/>
|
<location filename="../testplugin.cpp" line="89"/>
|
||||||
<source>Button - </source>
|
<source>Button - </source>
|
||||||
<translation>按钮 - </translation>
|
<translation>按钮 - </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="103"/>
|
<location filename="../testplugin.cpp" line="92"/>
|
||||||
<source>Click</source>
|
<source>Click</source>
|
||||||
<translation>点击</translation>
|
<translation>点击</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="167"/>
|
<location filename="../testplugin.cpp" line="147"/>
|
||||||
<source>A Test Plugin for WingHexExplorer2.</source>
|
<source>A Test Plugin for WingHexExplorer2.</source>
|
||||||
<translation>一个用来测试羽云十六进制编辑器2的插件</translation>
|
<translation>一个用来测试羽云十六进制编辑器2的插件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="196"/>
|
<location filename="../testplugin.cpp" line="176"/>
|
||||||
<location filename="../testplugin.cpp" line="204"/>
|
<location filename="../testplugin.cpp" line="184"/>
|
||||||
<location filename="../testplugin.cpp" line="213"/>
|
<location filename="../testplugin.cpp" line="193"/>
|
||||||
<location filename="../testplugin.cpp" line="234"/>
|
<location filename="../testplugin.cpp" line="214"/>
|
||||||
<location filename="../testplugin.cpp" line="250"/>
|
<location filename="../testplugin.cpp" line="230"/>
|
||||||
<location filename="../testplugin.cpp" line="257"/>
|
<location filename="../testplugin.cpp" line="237"/>
|
||||||
<location filename="../testplugin.cpp" line="264"/>
|
<location filename="../testplugin.cpp" line="244"/>
|
||||||
<location filename="../testplugin.cpp" line="271"/>
|
<location filename="../testplugin.cpp" line="251"/>
|
||||||
<location filename="../testplugin.cpp" line="278"/>
|
<location filename="../testplugin.cpp" line="258"/>
|
||||||
<location filename="../testplugin.cpp" line="307"/>
|
<location filename="../testplugin.cpp" line="287"/>
|
||||||
<location filename="../testplugin.cpp" line="315"/>
|
<location filename="../testplugin.cpp" line="295"/>
|
||||||
<location filename="../testplugin.cpp" line="323"/>
|
<location filename="../testplugin.cpp" line="303"/>
|
||||||
<location filename="../testplugin.cpp" line="331"/>
|
<location filename="../testplugin.cpp" line="311"/>
|
||||||
<location filename="../testplugin.cpp" line="340"/>
|
<location filename="../testplugin.cpp" line="320"/>
|
||||||
<location filename="../testplugin.cpp" line="347"/>
|
<location filename="../testplugin.cpp" line="327"/>
|
||||||
<source>InvalidParamsCount</source>
|
<source>InvalidParamsCount</source>
|
||||||
<translation>无效参数个数</translation>
|
<translation>无效参数个数</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="227"/>
|
<location filename="../testplugin.cpp" line="207"/>
|
||||||
<location filename="../testplugin.cpp" line="243"/>
|
<location filename="../testplugin.cpp" line="223"/>
|
||||||
<source>InvalidParam</source>
|
<source>InvalidParam</source>
|
||||||
<translation>非法参数</translation>
|
<translation>非法参数</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../testplugin.cpp" line="298"/>
|
<location filename="../testplugin.cpp" line="278"/>
|
||||||
<source>AllocArrayFailed</source>
|
<source>AllocArrayFailed</source>
|
||||||
<translation>分配数组失败</translation>
|
<translation>分配数组失败</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -58,7 +58,6 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
|
||||||
_tform->setMaximumHeight(500);
|
_tform->setMaximumHeight(500);
|
||||||
|
|
||||||
using TBInfo = WingHex::WingRibbonToolBoxInfo;
|
using TBInfo = WingHex::WingRibbonToolBoxInfo;
|
||||||
TBInfo::RibbonCatagories cats;
|
|
||||||
auto tb = new QToolButton;
|
auto tb = new QToolButton;
|
||||||
|
|
||||||
// 这里有一个约定,对于含有图片的,前缀应为:/images/插件的 PUID
|
// 这里有一个约定,对于含有图片的,前缀应为:/images/插件的 PUID
|
||||||
|
@ -74,61 +73,42 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
QIcon btnIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
|
||||||
WingHex::WingRibbonToolBoxInfo rtinfo;
|
|
||||||
rtinfo.catagory = cats.PLUGIN;
|
_rtbinfo << createRibbonToolBox(WingHex::WingRibbonCatagories::PLUGIN,
|
||||||
|
createToolBox(tr("TestPlugin"), tb));
|
||||||
|
|
||||||
|
auto rtb =
|
||||||
|
createRibbonToolBox(QStringLiteral("TestPlugin"), tr("TestPlugin"));
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
TBInfo::Toolbox tbtb;
|
TBInfo::Toolbox tbtb;
|
||||||
tbtb.name = tr("TestPlugin");
|
tbtb.name = tr("TestPlugin") + QStringLiteral("(%1)").arg(i);
|
||||||
tbtb.tools = {tb};
|
for (int y = 0; y < 5; ++y) {
|
||||||
rtinfo.toolboxs = {tbtb};
|
tbtb.tools << createToolButton(
|
||||||
_rtbinfo.append(rtinfo);
|
btnIcon,
|
||||||
}
|
tr("Button - ") + QStringLiteral("(%1, %2)").arg(i).arg(y),
|
||||||
|
this, [this] {
|
||||||
{
|
|
||||||
WingHex::WingRibbonToolBoxInfo rtinfo;
|
|
||||||
rtinfo.catagory = QStringLiteral("TestPlugin");
|
|
||||||
rtinfo.displayName = tr("TestPlugin");
|
|
||||||
|
|
||||||
QIcon btnIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
TBInfo::Toolbox tbtb;
|
|
||||||
tbtb.name = tr("TestPlugin") + QStringLiteral("(%1)").arg(i);
|
|
||||||
for (int y = 0; y < 5; ++y) {
|
|
||||||
auto tb = new QToolButton;
|
|
||||||
tb->setIcon(btnIcon);
|
|
||||||
tb->setText(tr("Button - ") +
|
|
||||||
QStringLiteral("(%1, %2)").arg(i).arg(y));
|
|
||||||
connect(tb, &QToolButton::clicked, this, [this] {
|
|
||||||
auto tb = qobject_cast<QToolButton *>(sender());
|
auto tb = qobject_cast<QToolButton *>(sender());
|
||||||
msgInformation(nullptr, tr("Click"), tb->text());
|
msgInformation(nullptr, tr("Click"), tb->text());
|
||||||
});
|
});
|
||||||
tbtb.tools.append(tb);
|
|
||||||
}
|
|
||||||
rtinfo.toolboxs.append(tbtb);
|
|
||||||
}
|
}
|
||||||
_rtbinfo.append(rtinfo);
|
rtb.toolboxs.append(tbtb);
|
||||||
}
|
}
|
||||||
|
_rtbinfo.append(rtb);
|
||||||
|
|
||||||
_setpages.append(new TestSettingPage(
|
_setpages = {new TestSettingPage(QStringLiteral("Test1"),
|
||||||
QStringLiteral("Test1"), QStringLiteral("This is a Test1"), true));
|
QStringLiteral("This is a Test1"), true),
|
||||||
|
new TestSettingPage(QStringLiteral("Test2"),
|
||||||
|
QStringLiteral("This is a Test2"), false)};
|
||||||
|
|
||||||
_setpages.append(new TestSettingPage(
|
// DockWidget test
|
||||||
QStringLiteral("Test2"), QStringLiteral("This is a Test2"), false));
|
auto lbl = new QLabel(QStringLiteral("DockTest1"));
|
||||||
|
lbl->setAlignment(Qt::AlignCenter);
|
||||||
|
_winfo << WingHex::createWingDockWidget(QStringLiteral("DockTest1"), lbl,
|
||||||
|
Qt::LeftDockWidgetArea);
|
||||||
|
|
||||||
{
|
auto ev = QSharedPointer<TestWingEditorViewWidget::Creator>::create();
|
||||||
WingHex::WingDockWidgetInfo info;
|
_evws.append(ev);
|
||||||
auto lbl = new QLabel(QStringLiteral("DockTest1"));
|
|
||||||
lbl->setAlignment(Qt::AlignCenter);
|
|
||||||
info.widget = lbl;
|
|
||||||
info.widgetName = QStringLiteral("DockTest1");
|
|
||||||
info.area = Qt::LeftDockWidgetArea;
|
|
||||||
_winfo.append(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto ev = QSharedPointer<TestWingEditorViewWidget::Creator>::create();
|
|
||||||
_evws.append(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
_tmenu = new QMenu(QStringLiteral("TestPlugin"));
|
_tmenu = new QMenu(QStringLiteral("TestPlugin"));
|
||||||
auto micon = QIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
|
auto micon = QIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
|
||||||
|
@ -481,9 +461,8 @@ void TestPlugin::testCrash() {
|
||||||
}
|
}
|
||||||
|
|
||||||
WingHex::IWingPlugin::RegisteredEvents TestPlugin::registeredEvents() const {
|
WingHex::IWingPlugin::RegisteredEvents TestPlugin::registeredEvents() const {
|
||||||
RegisteredEvents evs;
|
return packupEvent(RegisteredEvent::AppReady,
|
||||||
evs.setFlag(RegisteredEvent::AppReady);
|
RegisteredEvent::HexEditorViewPaint);
|
||||||
return evs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlugin::eventReady() {
|
void TestPlugin::eventReady() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 420ad38ba767c180c7edc726aa8641a631e24559
|
Subproject commit 3942f52c8ee7e828ba56328106eb6c03ae14a623
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -50,10 +50,8 @@ QString WingCStruct::retranslate(const QString &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WingCStruct::RegisteredEvents WingCStruct::registeredEvents() const {
|
WingCStruct::RegisteredEvents WingCStruct::registeredEvents() const {
|
||||||
RegisteredEvents evs;
|
return packupEvent(RegisteredEvent::ScriptPragma,
|
||||||
evs.setFlag(RegisteredEvent::ScriptPragma);
|
RegisteredEvent::ScriptPragmaInit);
|
||||||
evs.setFlag(RegisteredEvent::ScriptPragmaInit);
|
|
||||||
return evs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<WingHex::SettingPage *> WingCStruct::registeredSettingPages() const {
|
QList<WingHex::SettingPage *> WingCStruct::registeredSettingPages() const {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "editorview.h"
|
#include "editorview.h"
|
||||||
|
|
||||||
#include "QHexView/document/buffer/qfilebuffer.h"
|
#include "QHexView/document/buffer/qfilebuffer.h"
|
||||||
#include "QHexView/document/buffer/qmemorybuffer.h"
|
|
||||||
#include "Qt-Advanced-Docking-System/src/DockWidgetTab.h"
|
#include "Qt-Advanced-Docking-System/src/DockWidgetTab.h"
|
||||||
|
|
||||||
#include "class/logger.h"
|
#include "class/logger.h"
|
||||||
|
@ -36,7 +35,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr qsizetype FILE_MAX_BUFFER = 0x32000000; // 800MB
|
|
||||||
constexpr auto CLONE_LIMIT = 3;
|
constexpr auto CLONE_LIMIT = 3;
|
||||||
|
|
||||||
constexpr auto VIEW_PROPERTY = "__VIEW__";
|
constexpr auto VIEW_PROPERTY = "__VIEW__";
|
||||||
|
@ -302,7 +300,7 @@ ErrFile EditorView::newFile(size_t index) {
|
||||||
m_docType = DocumentType::File;
|
m_docType = DocumentType::File;
|
||||||
m_isWorkSpace = false;
|
m_isWorkSpace = false;
|
||||||
m_isNewFile = true;
|
m_isNewFile = true;
|
||||||
auto p = QHexDocument::fromMemory<QMemoryBuffer>(QByteArray(), false);
|
auto p = QHexDocument::fromMemory<QFileBuffer>(QByteArray(), false);
|
||||||
p->setDocSaved();
|
p->setDocSaved();
|
||||||
m_hex->setDocument(QSharedPointer<QHexDocument>(p));
|
m_hex->setDocument(QSharedPointer<QHexDocument>(p));
|
||||||
m_hex->cursor()->setInsertionMode(QHexCursor::InsertMode);
|
m_hex->cursor()->setInsertionMode(QHexCursor::InsertMode);
|
||||||
|
@ -323,11 +321,7 @@ ErrFile EditorView::openFile(const QString &filename) {
|
||||||
|
|
||||||
auto readonly = !Utilities::fileCanWrite(filename);
|
auto readonly = !Utilities::fileCanWrite(filename);
|
||||||
|
|
||||||
auto *p =
|
auto *p = QHexDocument::fromFile<QFileBuffer>(filename, readonly);
|
||||||
info.size() > FILE_MAX_BUFFER
|
|
||||||
? QHexDocument::fromLargeFile(filename, readonly)
|
|
||||||
: QHexDocument::fromFile<QMemoryBuffer>(filename, readonly);
|
|
||||||
|
|
||||||
if (Q_UNLIKELY(p == nullptr)) {
|
if (Q_UNLIKELY(p == nullptr)) {
|
||||||
return ErrFile::Permission;
|
return ErrFile::Permission;
|
||||||
}
|
}
|
||||||
|
@ -380,9 +374,7 @@ ErrFile EditorView::openExtFile(const QString &ext, const QString &file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *p = (d->size() > FILE_MAX_BUFFER || d->size() < 0)
|
auto *p = QHexDocument::fromDevice<QFileBuffer>(d, readonly);
|
||||||
? QHexDocument::fromDevice<QFileBuffer>(d, readonly)
|
|
||||||
: QHexDocument::fromDevice<QMemoryBuffer>(d, readonly);
|
|
||||||
|
|
||||||
if (Q_UNLIKELY(p == nullptr)) {
|
if (Q_UNLIKELY(p == nullptr)) {
|
||||||
return ErrFile::Error;
|
return ErrFile::Error;
|
||||||
|
@ -580,9 +572,15 @@ ErrFile EditorView::save(const QString &workSpaceName, const QString &path,
|
||||||
|
|
||||||
if (doc->saveTo(&file, !isExport)) {
|
if (doc->saveTo(&file, !isExport)) {
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if (!isExport) {
|
if (!isExport) {
|
||||||
m_fileName = QFileInfo(fileName).absoluteFilePath();
|
m_fileName = QFileInfo(fileName).absoluteFilePath();
|
||||||
|
|
||||||
|
if (isNewFile()) {
|
||||||
|
auto buffer = new QFileBuffer;
|
||||||
|
buffer->read(new QFile(fileName));
|
||||||
|
doc->setBuffer(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
m_isNewFile = false;
|
m_isNewFile = false;
|
||||||
m_docType = DocumentType::File;
|
m_docType = DocumentType::File;
|
||||||
doc->setDocSaved();
|
doc->setDocSaved();
|
||||||
|
|
|
@ -361,7 +361,7 @@ private slots:
|
||||||
WING_API bool moveTo(QObject *caller, qsizetype offset,
|
WING_API bool moveTo(QObject *caller, qsizetype offset,
|
||||||
bool clearSelection);
|
bool clearSelection);
|
||||||
WING_API bool select(QObject *caller, qsizetype offset, qsizetype length,
|
WING_API bool select(QObject *caller, qsizetype offset, qsizetype length,
|
||||||
SelectionMode mode);
|
WingHex::SelectionMode mode);
|
||||||
WING_API bool setInsertionMode(QObject *caller, bool isinsert);
|
WING_API bool setInsertionMode(QObject *caller, bool isinsert);
|
||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
|
|
|
@ -76,25 +76,21 @@ public:
|
||||||
|
|
||||||
if (ctx->IntegerConstant()) {
|
if (ctx->IntegerConstant()) {
|
||||||
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
||||||
if (std::holds_alternative<qint64>(r)) {
|
if (r) {
|
||||||
lastAddr = std::get<qint64>(r);
|
lastAddr = r.value();
|
||||||
} else if (std::holds_alternative<quint64>(r)) {
|
|
||||||
lastAddr = std::get<quint64>(r);
|
|
||||||
} else {
|
} else {
|
||||||
lastPos = GotoWidget::SEEKPOS::Invaild;
|
lastPos = GotoWidget::SEEKPOS::Invaild;
|
||||||
lastAddr = 0;
|
lastAddr = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto r = visitAssignmentExpression(ctx->assignmentExpression());
|
auto r = visitAssignmentExpression(ctx->assignmentExpression());
|
||||||
if (r.type() == typeid(quint64)) {
|
if (r.has_value()) {
|
||||||
lastAddr = std::any_cast<quint64>(r);
|
|
||||||
} else if (r.type() == typeid(qint64)) {
|
|
||||||
auto addr = std::any_cast<qint64>(r);
|
auto addr = std::any_cast<qint64>(r);
|
||||||
if (addr < 0) {
|
if (addr < 0) {
|
||||||
lastPos = GotoWidget::SEEKPOS::Invaild;
|
lastPos = GotoWidget::SEEKPOS::Invaild;
|
||||||
lastAddr = 0;
|
lastAddr = 0;
|
||||||
}
|
}
|
||||||
lastAddr = quint64(addr);
|
lastAddr = addr;
|
||||||
} else {
|
} else {
|
||||||
lastPos = GotoWidget::SEEKPOS::Invaild;
|
lastPos = GotoWidget::SEEKPOS::Invaild;
|
||||||
lastAddr = 0;
|
lastAddr = 0;
|
||||||
|
@ -105,7 +101,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
quint64 lastAddr = 0;
|
qint64 lastAddr = 0;
|
||||||
GotoWidget::SEEKPOS lastPos = GotoWidget::SEEKPOS::Invaild;
|
GotoWidget::SEEKPOS lastPos = GotoWidget::SEEKPOS::Invaild;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -117,10 +113,8 @@ public:
|
||||||
|
|
||||||
if (ctx->IntegerConstant()) {
|
if (ctx->IntegerConstant()) {
|
||||||
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
||||||
if (std::holds_alternative<qint64>(r)) {
|
if (r) {
|
||||||
return std::get<qint64>(r);
|
return r.value();
|
||||||
} else if (std::holds_alternative<quint64>(r)) {
|
|
||||||
return std::get<quint64>(r);
|
|
||||||
}
|
}
|
||||||
} else if (ctx->unaryExpression()) {
|
} else if (ctx->unaryExpression()) {
|
||||||
return visitUnaryExpression(ctx->unaryExpression());
|
return visitUnaryExpression(ctx->unaryExpression());
|
||||||
|
@ -137,18 +131,7 @@ public:
|
||||||
|
|
||||||
auto op = ctx->unaryOperator();
|
auto op = ctx->unaryOperator();
|
||||||
auto r = visitCastExpression(ctx->castExpression());
|
auto r = visitCastExpression(ctx->castExpression());
|
||||||
if (r.type() == typeid(quint64)) {
|
if (r.has_value()) {
|
||||||
auto v = std::any_cast<quint64>(r);
|
|
||||||
if (op->Minus()) {
|
|
||||||
return -v;
|
|
||||||
} else if (op->Plus()) {
|
|
||||||
return +v;
|
|
||||||
} else if (op->Tilde()) {
|
|
||||||
return ~v;
|
|
||||||
} else {
|
|
||||||
return defaultResult();
|
|
||||||
}
|
|
||||||
} else if (r.type() == typeid(qint64)) {
|
|
||||||
auto v = std::any_cast<qint64>(r);
|
auto v = std::any_cast<qint64>(r);
|
||||||
if (op->Minus()) {
|
if (op->Minus()) {
|
||||||
return -v;
|
return -v;
|
||||||
|
@ -170,13 +153,10 @@ public:
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
qulonglong ret = 0;
|
qint64 ret = 0;
|
||||||
for (auto &v : ctx->exclusiveOrExpression()) {
|
for (auto &v : ctx->exclusiveOrExpression()) {
|
||||||
auto r = visitExclusiveOrExpression(v);
|
auto r = visitExclusiveOrExpression(v);
|
||||||
if (r.type() == typeid(quint64)) {
|
if (r.has_value()) {
|
||||||
auto rr = std::any_cast<quint64>(r);
|
|
||||||
ret |= rr;
|
|
||||||
} else if (r.type() == typeid(qint64)) {
|
|
||||||
auto rr = std::any_cast<qint64>(r);
|
auto rr = std::any_cast<qint64>(r);
|
||||||
ret |= rr;
|
ret |= rr;
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,10 +175,8 @@ public:
|
||||||
|
|
||||||
if (ctx->IntegerConstant()) {
|
if (ctx->IntegerConstant()) {
|
||||||
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
||||||
if (std::holds_alternative<qint64>(r)) {
|
if (r) {
|
||||||
return std::get<qint64>(r);
|
return r.value();
|
||||||
} else if (std::holds_alternative<quint64>(r)) {
|
|
||||||
return std::get<quint64>(r);
|
|
||||||
}
|
}
|
||||||
} else if (ctx->inclusiveOrExpression()) {
|
} else if (ctx->inclusiveOrExpression()) {
|
||||||
return visitInclusiveOrExpression(ctx->inclusiveOrExpression());
|
return visitInclusiveOrExpression(ctx->inclusiveOrExpression());
|
||||||
|
@ -213,15 +191,12 @@ public:
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 v = 0;
|
qint64 v = 0;
|
||||||
for (auto &ex : ctx->andExpression()) {
|
for (auto &ex : ctx->andExpression()) {
|
||||||
auto r = visitAndExpression(ex);
|
auto r = visitAndExpression(ex);
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
v ^= rv;
|
v ^= rv;
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
v ^= rv;
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -239,17 +214,14 @@ public:
|
||||||
quint64 v = std::numeric_limits<quint64>::max();
|
quint64 v = std::numeric_limits<quint64>::max();
|
||||||
for (auto &ex : ctx->shiftExpression()) {
|
for (auto &ex : ctx->shiftExpression()) {
|
||||||
auto r = visitShiftExpression(ex);
|
auto r = visitShiftExpression(ex);
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
v &= rv;
|
v &= quint64(rv);
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
v &= rv;
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return qint64(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::any
|
std::any
|
||||||
|
@ -261,12 +233,10 @@ public:
|
||||||
auto data = ctx->additiveExpression();
|
auto data = ctx->additiveExpression();
|
||||||
auto total = data.size();
|
auto total = data.size();
|
||||||
|
|
||||||
quint64 ret = 0;
|
qint64 ret = 0;
|
||||||
auto retv = visitAdditiveExpression(data.front());
|
auto retv = visitAdditiveExpression(data.front());
|
||||||
if (retv.type() == typeid(qint64)) {
|
if (retv.has_value()) {
|
||||||
ret = std::any_cast<qint64>(retv);
|
ret = std::any_cast<qint64>(retv);
|
||||||
} else if (retv.type() == typeid(quint64)) {
|
|
||||||
ret = std::any_cast<quint64>(retv);
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -275,22 +245,16 @@ public:
|
||||||
auto op = ctx->children[2 * i - 1]->getText();
|
auto op = ctx->children[2 * i - 1]->getText();
|
||||||
auto r = visitAdditiveExpression(data.at(i));
|
auto r = visitAdditiveExpression(data.at(i));
|
||||||
if (op == "<<") {
|
if (op == "<<") {
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
ret <<= rv;
|
ret <<= rv;
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
ret <<= rv;
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
} else if (op == ">>") {
|
} else if (op == ">>") {
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
ret >>= rv;
|
ret >>= rv;
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
ret >>= rv;
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -311,12 +275,10 @@ public:
|
||||||
auto data = ctx->multiplicativeExpression();
|
auto data = ctx->multiplicativeExpression();
|
||||||
auto total = data.size();
|
auto total = data.size();
|
||||||
|
|
||||||
quint64 ret = 0;
|
qint64 ret = 0;
|
||||||
auto retv = visitMultiplicativeExpression(data.front());
|
auto retv = visitMultiplicativeExpression(data.front());
|
||||||
if (retv.type() == typeid(qint64)) {
|
if (retv.has_value()) {
|
||||||
ret = std::any_cast<qint64>(retv);
|
ret = std::any_cast<qint64>(retv);
|
||||||
} else if (retv.type() == typeid(quint64)) {
|
|
||||||
ret = std::any_cast<quint64>(retv);
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -324,7 +286,7 @@ public:
|
||||||
for (size_t i = 1; i < total; i++) {
|
for (size_t i = 1; i < total; i++) {
|
||||||
auto r = visitMultiplicativeExpression(data.at(i));
|
auto r = visitMultiplicativeExpression(data.at(i));
|
||||||
auto op = ctx->children[2 * i - 1]->getText();
|
auto op = ctx->children[2 * i - 1]->getText();
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
if (op == "+") {
|
if (op == "+") {
|
||||||
ret += rv;
|
ret += rv;
|
||||||
|
@ -333,15 +295,6 @@ public:
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
if (op == "+") {
|
|
||||||
ret += rv;
|
|
||||||
} else if (op == "-") {
|
|
||||||
ret -= rv;
|
|
||||||
} else {
|
|
||||||
return defaultResult();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -359,12 +312,10 @@ public:
|
||||||
auto data = ctx->castExpression();
|
auto data = ctx->castExpression();
|
||||||
auto total = data.size();
|
auto total = data.size();
|
||||||
|
|
||||||
quint64 ret = 0;
|
qint64 ret = 0;
|
||||||
auto retv = visitCastExpression(data.front());
|
auto retv = visitCastExpression(data.front());
|
||||||
if (retv.type() == typeid(qint64)) {
|
if (retv.has_value()) {
|
||||||
ret = std::any_cast<qint64>(retv);
|
ret = std::any_cast<qint64>(retv);
|
||||||
} else if (retv.type() == typeid(quint64)) {
|
|
||||||
ret = std::any_cast<quint64>(retv);
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -372,7 +323,7 @@ public:
|
||||||
for (size_t i = 1; i < total; i++) {
|
for (size_t i = 1; i < total; i++) {
|
||||||
auto r = visitCastExpression(data.at(i));
|
auto r = visitCastExpression(data.at(i));
|
||||||
auto op = ctx->children[2 * i - 1]->getText();
|
auto op = ctx->children[2 * i - 1]->getText();
|
||||||
if (r.type() == typeid(qint64)) {
|
if (r.has_value()) {
|
||||||
auto rv = std::any_cast<qint64>(r);
|
auto rv = std::any_cast<qint64>(r);
|
||||||
if (op == "*") {
|
if (op == "*") {
|
||||||
ret *= rv;
|
ret *= rv;
|
||||||
|
@ -383,17 +334,6 @@ public:
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
} else if (r.type() == typeid(quint64)) {
|
|
||||||
auto rv = std::any_cast<quint64>(r);
|
|
||||||
if (op == "*") {
|
|
||||||
ret *= rv;
|
|
||||||
} else if (op == "/") {
|
|
||||||
ret /= rv;
|
|
||||||
} else if (op == "%") {
|
|
||||||
ret %= rv;
|
|
||||||
} else {
|
|
||||||
return defaultResult();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return defaultResult();
|
return defaultResult();
|
||||||
}
|
}
|
||||||
|
@ -410,10 +350,8 @@ public:
|
||||||
|
|
||||||
if (ctx->IntegerConstant()) {
|
if (ctx->IntegerConstant()) {
|
||||||
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
|
||||||
if (std::holds_alternative<qint64>(r)) {
|
if (r) {
|
||||||
return std::get<qint64>(r);
|
return r.value();
|
||||||
} else if (std::holds_alternative<quint64>(r)) {
|
|
||||||
return std::get<quint64>(r);
|
|
||||||
}
|
}
|
||||||
} else if (ctx->assignmentExpression()) {
|
} else if (ctx->assignmentExpression()) {
|
||||||
return visitAssignmentExpression(ctx->assignmentExpression());
|
return visitAssignmentExpression(ctx->assignmentExpression());
|
||||||
|
@ -423,8 +361,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::variant<std::monostate, qint64, quint64>
|
std::optional<qint64> parseIntegerConstant(const std::string &text) {
|
||||||
parseIntegerConstant(const std::string &text) {
|
|
||||||
Q_STATIC_ASSERT_X(
|
Q_STATIC_ASSERT_X(
|
||||||
QT_VERSION >= QT_VERSION_CHECK(6, 4, 0),
|
QT_VERSION >= QT_VERSION_CHECK(6, 4, 0),
|
||||||
"If you want to support Qt version lower than 6.4.0, You should "
|
"If you want to support Qt version lower than 6.4.0, You should "
|
||||||
|
@ -436,11 +373,7 @@ private:
|
||||||
if (b) {
|
if (b) {
|
||||||
return num;
|
return num;
|
||||||
} else {
|
} else {
|
||||||
auto num = ct.toULongLong(&b, 0);
|
return std::nullopt;
|
||||||
if (b) {
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -245,8 +245,8 @@ MainWindow::MainWindow(SplashDialog *splash) : FramelessMainWindow() {
|
||||||
m_scriptConsole->setEnabled(false);
|
m_scriptConsole->setEnabled(false);
|
||||||
|
|
||||||
// configure error, so disable all script feature
|
// configure error, so disable all script feature
|
||||||
WingHex::WingRibbonToolBoxInfo::RibbonCatagories catagories;
|
m_ribbonMaps[WingHex::WingRibbonCatagories::SCRIPT]->setEnabled(
|
||||||
m_ribbonMaps[catagories.SCRIPT]->setEnabled(false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
ScriptMachine::RegCallBacks callbacks;
|
ScriptMachine::RegCallBacks callbacks;
|
||||||
callbacks.getInputFn = [this]() -> QString {
|
callbacks.getInputFn = [this]() -> QString {
|
||||||
|
@ -369,33 +369,35 @@ void MainWindow::buildUpRibbonBar() {
|
||||||
|
|
||||||
loadCacheIcon();
|
loadCacheIcon();
|
||||||
|
|
||||||
using RibbonCatagories = WingHex::WingRibbonToolBoxInfo::RibbonCatagories;
|
using RibbonCatagories = WingHex::WingRibbonCatagories;
|
||||||
RibbonCatagories catagories;
|
|
||||||
|
|
||||||
m_ribbonMaps[catagories.FILE] = buildFilePage(m_ribbon->addTab(tr("File")));
|
m_ribbonMaps[RibbonCatagories::FILE] =
|
||||||
|
buildFilePage(m_ribbon->addTab(tr("File")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
m_ribbonMaps[catagories.EDIT] = buildEditPage(m_ribbon->addTab(tr("Edit")));
|
m_ribbonMaps[RibbonCatagories::EDIT] =
|
||||||
|
buildEditPage(m_ribbon->addTab(tr("Edit")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
m_ribbonMaps[catagories.VIEW] = buildViewPage(m_ribbon->addTab(tr("View")));
|
m_ribbonMaps[RibbonCatagories::VIEW] =
|
||||||
|
buildViewPage(m_ribbon->addTab(tr("View")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
auto &set = SettingManager::instance();
|
auto &set = SettingManager::instance();
|
||||||
if (set.scriptEnabled()) {
|
if (set.scriptEnabled()) {
|
||||||
m_ribbonMaps[catagories.SCRIPT] =
|
m_ribbonMaps[RibbonCatagories::SCRIPT] =
|
||||||
buildScriptPage(m_ribbon->addTab(tr("Script")));
|
buildScriptPage(m_ribbon->addTab(tr("Script")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set.enablePlugin()) {
|
if (set.enablePlugin()) {
|
||||||
m_ribbonMaps[catagories.PLUGIN] =
|
m_ribbonMaps[RibbonCatagories::PLUGIN] =
|
||||||
buildPluginPage(m_ribbon->addTab(tr("Plugin")));
|
buildPluginPage(m_ribbon->addTab(tr("Plugin")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ribbonMaps[catagories.SETTING] =
|
m_ribbonMaps[RibbonCatagories::SETTING] =
|
||||||
buildSettingPage(m_ribbon->addTab(tr("Setting")));
|
buildSettingPage(m_ribbon->addTab(tr("Setting")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
m_ribbonMaps[catagories.ABOUT] =
|
m_ribbonMaps[RibbonCatagories::ABOUT] =
|
||||||
buildAboutPage(m_ribbon->addTab(tr("About")));
|
buildAboutPage(m_ribbon->addTab(tr("About")));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ QToolTip
|
||||||
/* 0.2ex is the smallest value that's not ignored on Windows. */
|
/* 0.2ex is the smallest value that's not ignored on Windows. */
|
||||||
border: 0.04em solid #eff0f1;
|
border: 0.04em solid #eff0f1;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
alternate-background-color: #31363b;
|
alternate-background-color: #202326;
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
padding: 0.1em;
|
padding: 0.1em;
|
||||||
opacity: 200;
|
opacity: 200;
|
||||||
|
@ -55,7 +55,7 @@ QToolTip
|
||||||
QWidget
|
QWidget
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
selection-background-color: #3daee9;
|
selection-background-color: #3daee9;
|
||||||
selection-color: #eff0f1;
|
selection-color: #eff0f1;
|
||||||
background-clip: border;
|
background-clip: border;
|
||||||
|
@ -137,7 +137,7 @@ QWidget
|
||||||
QWidget:disabled
|
QWidget:disabled
|
||||||
{
|
{
|
||||||
color: #454545;
|
color: #454545;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCheckBox
|
QCheckBox
|
||||||
|
@ -181,7 +181,7 @@ QGroupBox::title
|
||||||
top: -1.6em;
|
top: -1.6em;
|
||||||
subcontrol-origin: content;
|
subcontrol-origin: content;
|
||||||
subcontrol-position: top center;
|
subcontrol-position: top center;
|
||||||
background: #31363b;
|
background: #202326;
|
||||||
padding-left: 0.2em;
|
padding-left: 0.2em;
|
||||||
padding-right: 0.2em;
|
padding-right: 0.2em;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ QRadioButton::indicator:unchecked:disabled
|
||||||
|
|
||||||
QMenuBar
|
QMenuBar
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ QMenu::item:selected
|
||||||
|
|
||||||
QMenu::item:selected:disabled
|
QMenu::item:selected:disabled
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu::item:disabled
|
QMenu::item:disabled
|
||||||
|
@ -476,9 +476,9 @@ QMenu::right-arrow:disabled
|
||||||
|
|
||||||
QAbstractItemView
|
QAbstractItemView
|
||||||
{
|
{
|
||||||
alternate-background-color: #31363b;
|
alternate-background-color: #202326;
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
border: 0.09em solid #31363b;
|
border: 0.09em solid #202326;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ QAbstractScrollArea
|
||||||
*/
|
*/
|
||||||
QAbstractScrollArea::corner
|
QAbstractScrollArea::corner
|
||||||
{
|
{
|
||||||
background: #31363b;
|
background: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -735,7 +735,7 @@ QFrame[frameShape="6"] /* QFrame::StyledPanel == 0x0006 */
|
||||||
border-width: 0.04em;
|
border-width: 0.04em;
|
||||||
padding: 0.09em;
|
padding: 0.09em;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #31363b;
|
border-color: #202326;
|
||||||
background-color: #76797c;
|
background-color: #76797c;
|
||||||
border-radius: 0.23em;
|
border-radius: 0.23em;
|
||||||
}
|
}
|
||||||
|
@ -842,7 +842,7 @@ QDialog QToolBar QToolButton[popupMode="2"]
|
||||||
QPushButton
|
QPushButton
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em solid #76797c;
|
border: 0.04em solid #76797c;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -872,7 +872,7 @@ QPushButton:closed
|
||||||
|
|
||||||
QPushButton:disabled
|
QPushButton:disabled
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border-width: 0.04em;
|
border-width: 0.04em;
|
||||||
border-color: #76797c;
|
border-color: #76797c;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
@ -919,7 +919,7 @@ QPushButton:checked
|
||||||
|
|
||||||
QPushButton:hover
|
QPushButton:hover
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em solid #3daee9;
|
border: 0.04em solid #3daee9;
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
}
|
}
|
||||||
|
@ -958,12 +958,12 @@ QPlainTextEdit:hover:pressed,
|
||||||
QAbstractView:hover:pressed,
|
QAbstractView:hover:pressed,
|
||||||
QTreeView:hover:pressed
|
QTreeView:hover:pressed
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColumnView
|
QColumnView
|
||||||
{
|
{
|
||||||
border: 0.04em transparent #31363b;
|
border: 0.04em transparent #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColumnViewGrip
|
QColumnViewGrip
|
||||||
|
@ -1365,7 +1365,7 @@ QTabBar::tab:top:only-one
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
border-top: 0.09em solid #3daee9;
|
border-top: 0.09em solid #3daee9;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -1376,7 +1376,7 @@ QTabBar::tab:top:only-one
|
||||||
QTabBar::tab:top:!selected
|
QTabBar::tab:top:!selected
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
border: 0.04em transparent black;
|
border: 0.04em transparent black;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
border-bottom: 0.04em solid #76797c;
|
border-bottom: 0.04em solid #76797c;
|
||||||
|
@ -1418,7 +1418,7 @@ QTabBar::tab:bottom:only-one
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
border-bottom: 0.09em solid #3daee9;
|
border-bottom: 0.09em solid #3daee9;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -1429,7 +1429,7 @@ QTabBar::tab:bottom:only-one
|
||||||
QTabBar::tab:bottom:!selected
|
QTabBar::tab:bottom:!selected
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
border: 0.04em transparent black;
|
border: 0.04em transparent black;
|
||||||
border-top: 0.04em solid #76797c;
|
border-top: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
|
@ -1471,7 +1471,7 @@ QTabBar::tab:left:only-one
|
||||||
border-top: 0.09em solid #3daee9;
|
border-top: 0.09em solid #3daee9;
|
||||||
border-bottom: 0.04em solid #76797c;
|
border-bottom: 0.04em solid #76797c;
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -1482,7 +1482,7 @@ QTabBar::tab:left:only-one
|
||||||
QTabBar::tab:left:!selected
|
QTabBar::tab:left:!selected
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
border: 0.04em transparent black;
|
border: 0.04em transparent black;
|
||||||
border-top: 0.04em solid #76797c;
|
border-top: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
|
@ -1524,7 +1524,7 @@ QTabBar::tab:right:only-one
|
||||||
border-top: 0.09em solid #3daee9;
|
border-top: 0.09em solid #3daee9;
|
||||||
border-bottom: 0.04em solid #76797c;
|
border-bottom: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -1535,7 +1535,7 @@ QTabBar::tab:right:only-one
|
||||||
QTabBar::tab:right:!selected
|
QTabBar::tab:right:!selected
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
border: 0.04em transparent black;
|
border: 0.04em transparent black;
|
||||||
border-top: 0.04em solid #76797c;
|
border-top: 0.04em solid #76797c;
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
|
@ -1594,7 +1594,7 @@ QTabBar[shape="7"]::tab:only-one
|
||||||
{
|
{
|
||||||
/* Need a dark color without alpha channel since it affects the text. */
|
/* Need a dark color without alpha channel since it affects the text. */
|
||||||
color: #3daee9;
|
color: #3daee9;
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
padding: 0.23em;
|
padding: 0.23em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1624,7 +1624,7 @@ QTabBar[shape="6"]::tab:!selected,
|
||||||
QTabBar[shape="7"]::tab:!selected
|
QTabBar[shape="7"]::tab:!selected
|
||||||
{
|
{
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1675,7 +1675,7 @@ QTabBar[shape="7"]::close-button
|
||||||
|
|
||||||
QDockWidget
|
QDockWidget
|
||||||
{
|
{
|
||||||
background: #31363b;
|
background: #202326;
|
||||||
/**
|
/**
|
||||||
* It doesn't seem possible to change the border of the
|
* It doesn't seem possible to change the border of the
|
||||||
* QDockWidget without changing the content margins.
|
* QDockWidget without changing the content margins.
|
||||||
|
@ -1899,7 +1899,7 @@ QSlider::groove:horizontal,
|
||||||
QSlider::groove:vertical
|
QSlider::groove:vertical
|
||||||
{
|
{
|
||||||
background: #2c3034;
|
background: #2c3034;
|
||||||
border: 0em solid #31363b;
|
border: 0em solid #202326;
|
||||||
border-radius: 0.19em;
|
border-radius: 0.19em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2003,14 +2003,14 @@ QDialog QToolBar QToolButton[hasMenu="false"][popupMode="2"]
|
||||||
|
|
||||||
QToolButton[autoRaise="false"]
|
QToolButton[autoRaise="false"]
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em solid #76797c;
|
border: 0.04em solid #76797c;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton[autoRaise="true"]
|
QToolButton[autoRaise="true"]
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em solid transparent;
|
border: 0.04em solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2164,7 +2164,7 @@ QToolButton::menu-button:pressed
|
||||||
QTableView
|
QTableView
|
||||||
{
|
{
|
||||||
border: 0em solid black;
|
border: 0em solid black;
|
||||||
gridline-color: #31363b;
|
gridline-color: #202326;
|
||||||
background-color: #1d2023;
|
background-color: #1d2023;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2220,7 +2220,7 @@ QAbstractItemView::item:selected:hover
|
||||||
|
|
||||||
QHeaderView
|
QHeaderView
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em transparent;
|
border: 0.04em transparent;
|
||||||
border-radius: 0em;
|
border-radius: 0em;
|
||||||
margin: 0em;
|
margin: 0em;
|
||||||
|
@ -2229,7 +2229,7 @@ QHeaderView
|
||||||
|
|
||||||
QHeaderView::section
|
QHeaderView::section
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em solid #76797c;
|
border: 0.04em solid #76797c;
|
||||||
color: #eff0f1;
|
color: #eff0f1;
|
||||||
border-radius: 0em;
|
border-radius: 0em;
|
||||||
|
@ -2317,7 +2317,7 @@ QHeaderView::up-arrow
|
||||||
|
|
||||||
QTableView QTableCornerButton::section
|
QTableView QTableCornerButton::section
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border: 0.04em transparent #76797c;
|
border: 0.04em transparent #76797c;
|
||||||
border-top: 0.04em solid #76797c;
|
border-top: 0.04em solid #76797c;
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
|
@ -2357,7 +2357,7 @@ QToolBox::tab:hover
|
||||||
QSplitter::handle
|
QSplitter::handle
|
||||||
{
|
{
|
||||||
border: 0.09em solid #2c3034;
|
border: 0.09em solid #2c3034;
|
||||||
background: -0.5em solid #2c3034;
|
background: -0.5em solid #202326;
|
||||||
max-width: 0em;
|
max-width: 0em;
|
||||||
max-height: 0em;
|
max-height: 0em;
|
||||||
}
|
}
|
||||||
|
@ -2372,7 +2372,7 @@ QProgressBar:horizontal,
|
||||||
QProgressBar:vertical
|
QProgressBar:vertical
|
||||||
{
|
{
|
||||||
background-color: #626568;
|
background-color: #626568;
|
||||||
border: 0.9em solid #31363b;
|
border: 0.9em solid #202326;
|
||||||
border-radius: 0.13em;
|
border-radius: 0.13em;
|
||||||
padding: 0em;
|
padding: 0em;
|
||||||
}
|
}
|
||||||
|
@ -2462,7 +2462,7 @@ QMessageBox QPushButton
|
||||||
QWidget[isTitlebar="true"],
|
QWidget[isTitlebar="true"],
|
||||||
QWidget[isTitlebar="true"] *
|
QWidget[isTitlebar="true"] *
|
||||||
{
|
{
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2542,7 +2542,7 @@ QFrame[frameShape][isWindow="true"][windowFrame="5"]
|
||||||
ads--CAutoHideDockContainer #dockAreaAutoHideButton
|
ads--CAutoHideDockContainer #dockAreaAutoHideButton
|
||||||
{
|
{
|
||||||
qproperty-icon: url(:/dark/transparent.svg);
|
qproperty-icon: url(:/dark/transparent.svg);
|
||||||
background: #31363b;
|
background: #202326;
|
||||||
width: 1.2em;
|
width: 1.2em;
|
||||||
height: 1.2em;
|
height: 1.2em;
|
||||||
padding: 0em;
|
padding: 0em;
|
||||||
|
@ -2570,7 +2570,7 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton
|
||||||
#floatingTitleCloseButton:pressed,
|
#floatingTitleCloseButton:pressed,
|
||||||
#floatingTitleMaximizeButton:pressed
|
#floatingTitleMaximizeButton:pressed
|
||||||
{
|
{
|
||||||
background: #31363b;
|
background: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tabCloseButton,
|
#tabCloseButton,
|
||||||
|
@ -2713,7 +2713,7 @@ ads--CDockWidgetTab
|
||||||
{
|
{
|
||||||
border: 0.04em solid #76797c;
|
border: 0.04em solid #76797c;
|
||||||
border-top: 0.09em solid #76797c;
|
border-top: 0.09em solid #76797c;
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
padding: 0.1em;
|
padding: 0.1em;
|
||||||
min-width: 30px;
|
min-width: 30px;
|
||||||
border-radius: 0.09em;
|
border-radius: 0.09em;
|
||||||
|
@ -2723,7 +2723,7 @@ ads--CDockWidgetTab
|
||||||
|
|
||||||
ads--CDockWidgetTab[activeTab="true"][focused="true"]
|
ads--CDockWidgetTab[activeTab="true"][focused="true"]
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border-top: 0.09em solid #3de9e3;
|
border-top: 0.09em solid #3de9e3;
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #3de9e3;
|
border-right: 0.04em solid #3de9e3;
|
||||||
|
@ -2732,7 +2732,7 @@ ads--CDockWidgetTab[activeTab="true"][focused="true"]
|
||||||
|
|
||||||
ads--CDockWidgetTab[activeTab="true"]
|
ads--CDockWidgetTab[activeTab="true"]
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
border-top: 0.09em solid #3daee9;
|
border-top: 0.09em solid #3daee9;
|
||||||
border-left: 0.04em solid #76797c;
|
border-left: 0.04em solid #76797c;
|
||||||
border-right: 0.04em solid #76797c;
|
border-right: 0.04em solid #76797c;
|
||||||
|
@ -2741,12 +2741,12 @@ ads--CDockWidgetTab[activeTab="true"]
|
||||||
|
|
||||||
ads--CDockWidgetTab QLabel
|
ads--CDockWidgetTab QLabel
|
||||||
{
|
{
|
||||||
background-color: #2c3034;
|
background-color: #1b1d20;
|
||||||
}
|
}
|
||||||
|
|
||||||
ads--CDockWidgetTab[activeTab="true"] QLabel
|
ads--CDockWidgetTab[activeTab="true"] QLabel
|
||||||
{
|
{
|
||||||
background-color: #31363b;
|
background-color: #202326;
|
||||||
}
|
}
|
||||||
|
|
||||||
ads--CDockContainerWidget > QSplitter{
|
ads--CDockContainerWidget > QSplitter{
|
||||||
|
@ -2942,7 +2942,7 @@ RibbonButtonGroup QFrame[frameShape="5"]:hover
|
||||||
border-width: 0.04em;
|
border-width: 0.04em;
|
||||||
padding: 0.09em;
|
padding: 0.09em;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #31363b;
|
border-color: #202326;
|
||||||
background-color: #76797c;
|
background-color: #76797c;
|
||||||
border-radius: 0.23em;
|
border-radius: 0.23em;
|
||||||
}
|
}
|
||||||
|
@ -2950,7 +2950,7 @@ RibbonButtonGroup QFrame[frameShape="5"]:hover
|
||||||
QHexView
|
QHexView
|
||||||
{
|
{
|
||||||
qproperty-bytesColor: #eff0f1;
|
qproperty-bytesColor: #eff0f1;
|
||||||
qproperty-bytesBackground: #31363b;
|
qproperty-bytesBackground: #202326;
|
||||||
qproperty-bytesAlterBackground: #2C3136;
|
qproperty-bytesAlterBackground: #2C3136;
|
||||||
qproperty-selectionColor: #eff0f1;
|
qproperty-selectionColor: #eff0f1;
|
||||||
qproperty-selBackgroundColor: #3daee9;
|
qproperty-selBackgroundColor: #3daee9;
|
||||||
|
|
Loading…
Reference in New Issue