refactor: 重构十六进制编辑器的后端;更暗黑的暗色主题;

This commit is contained in:
寂静的羽夏 2025-07-13 22:06:34 +08:00
parent 55ebbcd126
commit f40d9525b0
16 changed files with 1075 additions and 1108 deletions

View File

@ -1,25 +1,29 @@
/*==============================================================================
** Copyright (C) 2024-2027 WingSummer
**
** 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
** Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
** details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program. If not, see <https://www.gnu.org/licenses/>.
**
** The original License is LGPL from Andres6936/QHexEdit. I have modified a lot
** so I decide to change the Open Source License. You can use the original
** library under LGPL. Thanks for Andres6936's efforts.
** =============================================================================
*/
/*
* QHexEdit is a Hex Editor Widget for the Qt Framework
* Copyright (C) 2010-2025 Winfried Simon
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
* https://www.gnu.org/licenses/
*/
#include "chunks.h"
#include <limits.h>
#include <QBuffer>
#define NORMAL 0
#define HIGHLIGHTED 1
#define BUFFER_SIZE 0x10000
#define CHUNK_SIZE 0x1000
@ -29,38 +33,43 @@
// ***************************************** 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) {
setIODevice(ioDevice);
}
Chunks::~Chunks() {}
bool Chunks::setIODevice(QIODevice *ioDevice) {
if (ioDevice && ioDevice->isOpen()) {
ioDevice->setParent(this);
_size = ioDevice->size();
_ioDevice = ioDevice;
} else {
return false;
bool ok = _ioDevice->open(QIODevice::ReadOnly);
if (ok) // Try to open IODevice
{
ioDevice->setParent(this);
_size = _ioDevice->size();
_ioDevice->close();
} else // Fallback is an empty buffer
{
QBuffer *buf = new QBuffer(this);
_ioDevice = buf;
_size = 0;
}
_chunks.clear();
_pos = 0;
return true;
return ok;
}
// ***************************************** Getting data out of Chunks
QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
qsizetype ioDelta = 0;
qsizetype chunkIdx = 0;
QByteArray Chunks::data(qint64 pos, qint64 maxSize) const {
qint64 ioDelta = 0;
int chunkIdx = 0;
Chunk chunk;
QByteArray buffer;
// Do some checks and some arrangements
if (pos >= _size)
return buffer;
@ -69,8 +78,10 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
else if ((pos + maxSize) > _size)
maxSize = _size - pos;
_ioDevice->open(QIODevice::ReadOnly);
while (maxSize > 0) {
chunk.absPos = std::numeric_limits<qsizetype>::max();
chunk.absPos = LLONG_MAX;
bool chunksLoopOngoing = true;
while ((chunkIdx < _chunks.count()) && chunksLoopOngoing) {
// In this section, we track changes before our required data and
@ -84,16 +95,16 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
else {
chunkIdx += 1;
qint64 count;
qint64 chunkOfs = qint64(pos - chunk.absPos);
if (maxSize > (chunk.data.size() - chunkOfs)) {
count = qint64(chunk.data.size()) - chunkOfs;
ioDelta += CHUNK_SIZE - quint64(chunk.data.size());
qint64 chunkOfs = pos - chunk.absPos;
if (maxSize > ((qint64)chunk.data.size() - chunkOfs)) {
count = (qint64)chunk.data.size() - chunkOfs;
ioDelta += CHUNK_SIZE - chunk.data.size();
} else
count = maxSize;
if (count > 0) {
buffer += chunk.data.mid(int(chunkOfs), int(count));
buffer += chunk.data.mid(chunkOfs, (int)count);
maxSize -= count;
pos += quint64(count);
pos += count;
}
}
}
@ -104,7 +115,7 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
qint64 byteCount;
QByteArray readBuffer;
if (chunk.absPos - pos > qsizetype(maxSize))
if ((chunk.absPos - pos) > maxSize)
byteCount = maxSize;
else
byteCount = chunk.absPos - pos;
@ -113,134 +124,175 @@ QByteArray Chunks::data(qsizetype pos, qsizetype maxSize) {
_ioDevice->seek(pos + ioDelta);
readBuffer = _ioDevice->read(byteCount);
buffer += readBuffer;
pos += quint64(readBuffer.size());
pos += readBuffer.size();
}
}
_ioDevice->close();
return buffer;
}
bool Chunks::write(QIODevice *iODevice, qsizetype pos, qsizetype count) {
bool Chunks::write(QIODevice *iODevice, qint64 pos, qint64 count) {
if (count == -1)
count = _size;
bool ok = iODevice->isOpen() && iODevice->isWritable();
if (ok) {
for (auto idx = pos; idx < qsizetype(count); idx += BUFFER_SIZE) {
if (iODevice->isOpen()) {
if (iODevice->isWritable()) {
for (qint64 idx = pos; idx < count; idx += BUFFER_SIZE) {
QByteArray ba = data(idx, BUFFER_SIZE);
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;
}
}
// ***************************************** Search API
qsizetype Chunks::indexOf(const QByteArray &ba, qsizetype from) {
qsizetype result = -1;
qint64 Chunks::indexOf(const QByteArray &ba, qint64 from) const {
qint64 result = -1;
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);
int findPos = buffer.indexOf(ba);
if (findPos >= 0)
result = pos + findPos;
result = pos + (qint64)findPos;
}
return result;
}
qsizetype Chunks::lastIndexOf(const QByteArray &ba, qsizetype from) {
qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from) const {
qint64 result = -1;
QByteArray buffer;
for (auto pos = from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) {
auto sPos = pos - BUFFER_SIZE - ba.size() + 1;
/*if (sPos < 0)
sPos = 0;*/
for (qint64 pos = from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) {
qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1;
if (sPos < 0)
sPos = 0;
buffer = data(sPos, pos - sPos);
auto findPos = buffer.lastIndexOf(ba);
int findPos = buffer.lastIndexOf(ba);
if (findPos >= 0)
result = sPos + findPos;
result = sPos + (qint64)findPos;
}
return result;
}
// ***************************************** Char manipulations
bool Chunks::insert(qsizetype pos, char b) {
if (pos > _size)
bool Chunks::insert(qint64 pos, char b) {
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;
qsizetype chunkIdx;
if (pos == _size) {
if (ba.isEmpty()) {
return true;
}
auto length = ba.length();
int chunkIdx;
if (pos == _size)
chunkIdx = getChunkIndex(pos - 1);
} else
else
chunkIdx = getChunkIndex(pos);
auto posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].data.insert(int(posInBa), b);
_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);
qint64 posInBa = pos - _chunks[chunkIdx].absPos;
_chunks[chunkIdx].data.insert(posInBa, ba);
for (int idx = chunkIdx + 1; idx < _chunks.size(); idx++)
_chunks[idx].absPos -= 1;
_size -= 1;
_pos = pos;
_chunks[idx].absPos += length;
_size += length;
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;
}
// ***************************************** Utility functions
char Chunks::operator[](qsizetype pos) {
auto d = data(pos, 1);
if (d.isEmpty())
return '0';
return d.at(0);
}
char Chunks::at(qint64 pos) const { return data(pos, 1).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) {
// This routine checks, if there is already a copied chunk available. If so,
int Chunks::getChunkIndex(qint64 absPos) {
// 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,
// original data will be copied into a new chunk.
qsizetype foundIdx = -1;
qsizetype insertIdx = 0;
qsizetype 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;
}
int foundIdx = -1;
int insertIdx = 0;
qint64 ioDelta = 0;
for (int idx = 0; idx < _chunks.size(); idx++) {
Chunk chunk = _chunks[idx];
@ -259,14 +311,17 @@ qsizetype Chunks::getChunkIndex(qsizetype absPos) {
if (foundIdx == -1) {
Chunk newChunk;
qsizetype readAbsPos = absPos - ioDelta;
qsizetype readPos = (readAbsPos & READ_CHUNK_MASK);
_ioDevice->seek(qint64(readPos));
qint64 readAbsPos = absPos - ioDelta;
qint64 readPos = (readAbsPos & READ_CHUNK_MASK);
_ioDevice->open(QIODevice::ReadOnly);
_ioDevice->seek(readPos);
newChunk.data = _ioDevice->read(CHUNK_SIZE);
_ioDevice->close();
newChunk.absPos = absPos - (readAbsPos - readPos);
newChunk.dataChanged = QByteArray(newChunk.data.size(), char(0));
_chunks.insert(insertIdx, newChunk);
foundIdx = insertIdx;
}
return foundIdx;
}
QIODevice *Chunks::ioDevice() const { return _ioDevice; }

View File

@ -1,23 +1,21 @@
/*==============================================================================
** Copyright (C) 2024-2027 WingSummer
**
** 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
** Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
** details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program. If not, see <https://www.gnu.org/licenses/>.
**
** The original License is LGPL from Andres6936/QHexEdit. I have modified a lot
** so I decide to change the Open Source License. You can use the original
** library under LGPL. Thanks for Andres6936's efforts.
** =============================================================================
*/
/*
* QHexEdit is a Hex Editor Widget for the Qt Framework
* Copyright (C) 2010-2025 Winfried Simon
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
* https://www.gnu.org/licenses/
*/
#ifndef CHUNKS_H
#define CHUNKS_H
@ -40,49 +38,59 @@
*
*/
#include <QtCore>
#include <QtGlobal>
// I (wingsummer) made some modifications for supporting QByteArray
// manipulations, great thanks for Simsys's effort!
#include <QByteArray>
#include <QList>
#include <QObject>
struct Chunk {
QByteArray data;
QByteArray dataChanged;
qsizetype absPos;
qint64 absPos;
};
class Chunks : public QObject {
Q_OBJECT
public:
// Constructors and file settings
Chunks(QObject *parent = nullptr);
Chunks(QIODevice *ioDevice, QObject *parent);
~Chunks();
explicit Chunks(QObject *parent);
explicit Chunks(QIODevice *ioDevice, QObject *parent);
public:
QIODevice *ioDevice() const;
bool setIODevice(QIODevice *ioDevice);
// Getting data out of Chunks
QByteArray data(qsizetype pos = 0, qsizetype maxSize = -1);
bool write(QIODevice *iODevice, qsizetype pos = 0, qsizetype count = -1);
QByteArray data(qint64 pos = 0, qint64 count = -1) const;
bool write(QIODevice *iODevice, qint64 pos = 0, qint64 count = -1);
// Search API
qsizetype indexOf(const QByteArray &ba, qsizetype from);
qsizetype lastIndexOf(const QByteArray &ba, qsizetype from);
qint64 indexOf(const QByteArray &ba, qint64 from) const;
qint64 lastIndexOf(const QByteArray &ba, qint64 from) const;
// Char manipulations
bool insert(qsizetype pos, char b);
bool overwrite(qsizetype pos, char b);
bool removeAt(qsizetype pos);
bool insert(qint64 pos, char b);
bool overwrite(qint64 pos, char b);
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
char operator[](qsizetype pos);
qsizetype pos();
qsizetype size();
char at(qint64 pos) const; // by wingsummer
char operator[](qint64 pos) const;
qint64 size() const;
private:
int getChunkIndex(qint64 absPos);
private:
qsizetype getChunkIndex(qsizetype absPos);
QIODevice *_ioDevice;
qsizetype _pos;
qsizetype _size;
qint64 _size;
QList<Chunk> _chunks;
};

View File

@ -18,28 +18,24 @@
#include "QHexEdit2/chunks.h"
QFileBuffer::QFileBuffer(QObject *parent) : QHexBuffer(parent) {
_chunks = new Chunks(parent);
_chunks = new Chunks(this);
}
QFileBuffer::~QFileBuffer() {}
uchar QFileBuffer::at(qsizetype idx) {
auto data = _chunks->data(idx, 1);
return uchar(data[0]);
auto data = _chunks->at(idx);
return uchar(data);
}
qsizetype QFileBuffer::length() const { return _chunks->size(); }
void QFileBuffer::insert(qsizetype offset, const QByteArray &data) {
for (int i = 0; i < data.length(); i++) {
_chunks->insert(offset + i, data.at(i));
}
_chunks->insert(offset, data);
}
void QFileBuffer::remove(qsizetype offset, qsizetype length) {
for (uint i = 0; i < uint(length); i++) {
_chunks->removeAt(offset + i);
}
_chunks->remove(offset, length);
}
QByteArray QFileBuffer::read(qsizetype offset, qsizetype length) {
@ -47,7 +43,11 @@ QByteArray QFileBuffer::read(qsizetype offset, qsizetype length) {
}
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); }

View File

@ -617,6 +617,7 @@ QHexDocument::QHexDocument(QHexBuffer *buffer, bool readonly)
: QObject(nullptr), m_baseaddress(0), m_readonly(false), m_keepsize(false),
m_islocked(false) {
buffer->setParent(this);
m_buffer = buffer;
m_areaindent = DEFAULT_AREA_IDENTATION;
m_hexlinewidth = DEFAULT_HEX_LINE_LENGTH;
@ -874,28 +875,13 @@ qsizetype QHexDocument::findPreviousExt(qsizetype begin,
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; }
void QHexDocument::setBuffer(QHexBuffer *buffer) {
if (buffer) {
m_buffer->deleteLater();
m_buffer = buffer;
}
}
QUndoStack *QHexDocument::undoStack() const { return m_undostack; }

View File

@ -237,10 +237,9 @@ public:
template <typename T>
static QHexDocument *fromMemory(const QByteArray &ba,
bool readonly = false);
static QHexDocument *fromLargeFile(const QString &filename,
bool readonly = false);
QHexBuffer *buffer() const;
void setBuffer(QHexBuffer *buffer);
QUndoStack *undoStack() const;
@ -304,7 +303,6 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
if (!iodevice->isOpen()) {
needsclose = true;
iodevice->open(QIODevice::ReadOnly);
}
QHexBuffer *hexbuffer = new T();
@ -314,6 +312,9 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
return new QHexDocument(hexbuffer, readonly);
} else {
if (needsclose)
iodevice->close();
delete hexbuffer;
}
@ -322,17 +323,24 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly) {
template <typename T>
QHexDocument *QHexDocument::fromFile(QString filename, bool readonly) {
QFile f;
QHexDocument *doc;
if (filename.length()) {
f.setFileName(filename);
f.open(QFile::ReadOnly);
doc = QHexDocument::fromDevice<T>(&f, readonly);
f.close();
} else {
doc = new QHexDocument(new T(), readonly);
auto f = new QFile;
if (!filename.isEmpty()) {
f->setFileName(filename);
QHexBuffer *hexbuffer = new T();
if (f->open(readonly ? QFile::ReadOnly : QFile::ReadWrite)) {
f->close();
if (hexbuffer->read(f)) {
// modified by wingsummer
return new QHexDocument(hexbuffer, readonly);
}
return doc;
} else {
delete hexbuffer;
}
} else {
delete f;
return new QHexDocument(new T(), readonly);
}
return nullptr;
}
template <typename T>

View File

@ -269,60 +269,60 @@
<context>
<name>TestPlugin</name>
<message>
<location filename="../testplugin.cpp" line="69"/>
<location filename="../testplugin.cpp" line="68"/>
<source>Test</source>
<translation></translation>
</message>
<message>
<location filename="../testplugin.cpp" line="81"/>
<location filename="../testplugin.cpp" line="90"/>
<location filename="../testplugin.cpp" line="95"/>
<location filename="../testplugin.cpp" line="164"/>
<location filename="../testplugin.cpp" line="79"/>
<location filename="../testplugin.cpp" line="82"/>
<location filename="../testplugin.cpp" line="85"/>
<location filename="../testplugin.cpp" line="144"/>
<source>TestPlugin</source>
<translation></translation>
</message>
<message>
<location filename="../testplugin.cpp" line="99"/>
<location filename="../testplugin.cpp" line="89"/>
<source>Button - </source>
<translation> - </translation>
</message>
<message>
<location filename="../testplugin.cpp" line="103"/>
<location filename="../testplugin.cpp" line="92"/>
<source>Click</source>
<translation></translation>
</message>
<message>
<location filename="../testplugin.cpp" line="167"/>
<location filename="../testplugin.cpp" line="147"/>
<source>A Test Plugin for WingHexExplorer2.</source>
<translation>2</translation>
</message>
<message>
<location filename="../testplugin.cpp" line="196"/>
<location filename="../testplugin.cpp" line="204"/>
<location filename="../testplugin.cpp" line="213"/>
<location filename="../testplugin.cpp" line="234"/>
<location filename="../testplugin.cpp" line="250"/>
<location filename="../testplugin.cpp" line="257"/>
<location filename="../testplugin.cpp" line="264"/>
<location filename="../testplugin.cpp" line="271"/>
<location filename="../testplugin.cpp" line="278"/>
<location filename="../testplugin.cpp" line="307"/>
<location filename="../testplugin.cpp" line="315"/>
<location filename="../testplugin.cpp" line="323"/>
<location filename="../testplugin.cpp" line="331"/>
<location filename="../testplugin.cpp" line="340"/>
<location filename="../testplugin.cpp" line="347"/>
<location filename="../testplugin.cpp" line="176"/>
<location filename="../testplugin.cpp" line="184"/>
<location filename="../testplugin.cpp" line="193"/>
<location filename="../testplugin.cpp" line="214"/>
<location filename="../testplugin.cpp" line="230"/>
<location filename="../testplugin.cpp" line="237"/>
<location filename="../testplugin.cpp" line="244"/>
<location filename="../testplugin.cpp" line="251"/>
<location filename="../testplugin.cpp" line="258"/>
<location filename="../testplugin.cpp" line="287"/>
<location filename="../testplugin.cpp" line="295"/>
<location filename="../testplugin.cpp" line="303"/>
<location filename="../testplugin.cpp" line="311"/>
<location filename="../testplugin.cpp" line="320"/>
<location filename="../testplugin.cpp" line="327"/>
<source>InvalidParamsCount</source>
<translation></translation>
</message>
<message>
<location filename="../testplugin.cpp" line="227"/>
<location filename="../testplugin.cpp" line="243"/>
<location filename="../testplugin.cpp" line="207"/>
<location filename="../testplugin.cpp" line="223"/>
<source>InvalidParam</source>
<translation></translation>
</message>
<message>
<location filename="../testplugin.cpp" line="298"/>
<location filename="../testplugin.cpp" line="278"/>
<source>AllocArrayFailed</source>
<translation></translation>
</message>

View File

@ -58,7 +58,6 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
_tform->setMaximumHeight(500);
using TBInfo = WingHex::WingRibbonToolBoxInfo;
TBInfo::RibbonCatagories cats;
auto tb = new QToolButton;
// 这里有一个约定,对于含有图片的,前缀应为:/images/插件的 PUID
@ -74,61 +73,42 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
}
});
{
WingHex::WingRibbonToolBoxInfo rtinfo;
rtinfo.catagory = cats.PLUGIN;
TBInfo::Toolbox tbtb;
tbtb.name = tr("TestPlugin");
tbtb.tools = {tb};
rtinfo.toolboxs = {tbtb};
_rtbinfo.append(rtinfo);
}
{
WingHex::WingRibbonToolBoxInfo rtinfo;
rtinfo.catagory = QStringLiteral("TestPlugin");
rtinfo.displayName = tr("TestPlugin");
QIcon btnIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
_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;
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] {
tbtb.tools << createToolButton(
btnIcon,
tr("Button - ") + QStringLiteral("(%1, %2)").arg(i).arg(y),
this, [this] {
auto tb = qobject_cast<QToolButton *>(sender());
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(
QStringLiteral("Test1"), QStringLiteral("This is a Test1"), true));
_setpages = {new TestSettingPage(QStringLiteral("Test1"),
QStringLiteral("This is a Test1"), true),
new TestSettingPage(QStringLiteral("Test2"),
QStringLiteral("This is a Test2"), false)};
_setpages.append(new TestSettingPage(
QStringLiteral("Test2"), QStringLiteral("This is a Test2"), false));
{
WingHex::WingDockWidgetInfo info;
// DockWidget test
auto lbl = new QLabel(QStringLiteral("DockTest1"));
lbl->setAlignment(Qt::AlignCenter);
info.widget = lbl;
info.widgetName = QStringLiteral("DockTest1");
info.area = Qt::LeftDockWidgetArea;
_winfo.append(info);
}
_winfo << WingHex::createWingDockWidget(QStringLiteral("DockTest1"), lbl,
Qt::LeftDockWidgetArea);
{
auto ev = QSharedPointer<TestWingEditorViewWidget::Creator>::create();
_evws.append(ev);
}
_tmenu = new QMenu(QStringLiteral("TestPlugin"));
auto micon = QIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
@ -481,9 +461,8 @@ void TestPlugin::testCrash() {
}
WingHex::IWingPlugin::RegisteredEvents TestPlugin::registeredEvents() const {
RegisteredEvents evs;
evs.setFlag(RegisteredEvent::AppReady);
return evs;
return packupEvent(RegisteredEvent::AppReady,
RegisteredEvent::HexEditorViewPaint);
}
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

View File

@ -50,10 +50,8 @@ QString WingCStruct::retranslate(const QString &str) {
}
WingCStruct::RegisteredEvents WingCStruct::registeredEvents() const {
RegisteredEvents evs;
evs.setFlag(RegisteredEvent::ScriptPragma);
evs.setFlag(RegisteredEvent::ScriptPragmaInit);
return evs;
return packupEvent(RegisteredEvent::ScriptPragma,
RegisteredEvent::ScriptPragmaInit);
}
QList<WingHex::SettingPage *> WingCStruct::registeredSettingPages() const {

View File

@ -18,7 +18,6 @@
#include "editorview.h"
#include "QHexView/document/buffer/qfilebuffer.h"
#include "QHexView/document/buffer/qmemorybuffer.h"
#include "Qt-Advanced-Docking-System/src/DockWidgetTab.h"
#include "class/logger.h"
@ -36,7 +35,6 @@
#include <unistd.h>
#endif
constexpr qsizetype FILE_MAX_BUFFER = 0x32000000; // 800MB
constexpr auto CLONE_LIMIT = 3;
constexpr auto VIEW_PROPERTY = "__VIEW__";
@ -302,7 +300,7 @@ ErrFile EditorView::newFile(size_t index) {
m_docType = DocumentType::File;
m_isWorkSpace = false;
m_isNewFile = true;
auto p = QHexDocument::fromMemory<QMemoryBuffer>(QByteArray(), false);
auto p = QHexDocument::fromMemory<QFileBuffer>(QByteArray(), false);
p->setDocSaved();
m_hex->setDocument(QSharedPointer<QHexDocument>(p));
m_hex->cursor()->setInsertionMode(QHexCursor::InsertMode);
@ -323,11 +321,7 @@ ErrFile EditorView::openFile(const QString &filename) {
auto readonly = !Utilities::fileCanWrite(filename);
auto *p =
info.size() > FILE_MAX_BUFFER
? QHexDocument::fromLargeFile(filename, readonly)
: QHexDocument::fromFile<QMemoryBuffer>(filename, readonly);
auto *p = QHexDocument::fromFile<QFileBuffer>(filename, readonly);
if (Q_UNLIKELY(p == nullptr)) {
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)
? QHexDocument::fromDevice<QFileBuffer>(d, readonly)
: QHexDocument::fromDevice<QMemoryBuffer>(d, readonly);
auto *p = QHexDocument::fromDevice<QFileBuffer>(d, readonly);
if (Q_UNLIKELY(p == nullptr)) {
return ErrFile::Error;
@ -580,9 +572,15 @@ ErrFile EditorView::save(const QString &workSpaceName, const QString &path,
if (doc->saveTo(&file, !isExport)) {
file.close();
if (!isExport) {
m_fileName = QFileInfo(fileName).absoluteFilePath();
if (isNewFile()) {
auto buffer = new QFileBuffer;
buffer->read(new QFile(fileName));
doc->setBuffer(buffer);
}
m_isNewFile = false;
m_docType = DocumentType::File;
doc->setDocSaved();

View File

@ -361,7 +361,7 @@ private slots:
WING_API bool moveTo(QObject *caller, qsizetype offset,
bool clearSelection);
WING_API bool select(QObject *caller, qsizetype offset, qsizetype length,
SelectionMode mode);
WingHex::SelectionMode mode);
WING_API bool setInsertionMode(QObject *caller, bool isinsert);
// metadata

View File

@ -76,25 +76,21 @@ public:
if (ctx->IntegerConstant()) {
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
if (std::holds_alternative<qint64>(r)) {
lastAddr = std::get<qint64>(r);
} else if (std::holds_alternative<quint64>(r)) {
lastAddr = std::get<quint64>(r);
if (r) {
lastAddr = r.value();
} else {
lastPos = GotoWidget::SEEKPOS::Invaild;
lastAddr = 0;
}
} else {
auto r = visitAssignmentExpression(ctx->assignmentExpression());
if (r.type() == typeid(quint64)) {
lastAddr = std::any_cast<quint64>(r);
} else if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto addr = std::any_cast<qint64>(r);
if (addr < 0) {
lastPos = GotoWidget::SEEKPOS::Invaild;
lastAddr = 0;
}
lastAddr = quint64(addr);
lastAddr = addr;
} else {
lastPos = GotoWidget::SEEKPOS::Invaild;
lastAddr = 0;
@ -105,7 +101,7 @@ public:
}
public:
quint64 lastAddr = 0;
qint64 lastAddr = 0;
GotoWidget::SEEKPOS lastPos = GotoWidget::SEEKPOS::Invaild;
public:
@ -117,10 +113,8 @@ public:
if (ctx->IntegerConstant()) {
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
if (std::holds_alternative<qint64>(r)) {
return std::get<qint64>(r);
} else if (std::holds_alternative<quint64>(r)) {
return std::get<quint64>(r);
if (r) {
return r.value();
}
} else if (ctx->unaryExpression()) {
return visitUnaryExpression(ctx->unaryExpression());
@ -137,18 +131,7 @@ public:
auto op = ctx->unaryOperator();
auto r = visitCastExpression(ctx->castExpression());
if (r.type() == typeid(quint64)) {
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)) {
if (r.has_value()) {
auto v = std::any_cast<qint64>(r);
if (op->Minus()) {
return -v;
@ -170,13 +153,10 @@ public:
return defaultResult();
}
qulonglong ret = 0;
qint64 ret = 0;
for (auto &v : ctx->exclusiveOrExpression()) {
auto r = visitExclusiveOrExpression(v);
if (r.type() == typeid(quint64)) {
auto rr = std::any_cast<quint64>(r);
ret |= rr;
} else if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rr = std::any_cast<qint64>(r);
ret |= rr;
} else {
@ -195,10 +175,8 @@ public:
if (ctx->IntegerConstant()) {
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
if (std::holds_alternative<qint64>(r)) {
return std::get<qint64>(r);
} else if (std::holds_alternative<quint64>(r)) {
return std::get<quint64>(r);
if (r) {
return r.value();
}
} else if (ctx->inclusiveOrExpression()) {
return visitInclusiveOrExpression(ctx->inclusiveOrExpression());
@ -213,15 +191,12 @@ public:
return defaultResult();
}
quint64 v = 0;
qint64 v = 0;
for (auto &ex : ctx->andExpression()) {
auto r = visitAndExpression(ex);
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
v ^= rv;
} else if (r.type() == typeid(quint64)) {
auto rv = std::any_cast<quint64>(r);
v ^= rv;
} else {
return defaultResult();
}
@ -239,17 +214,14 @@ public:
quint64 v = std::numeric_limits<quint64>::max();
for (auto &ex : ctx->shiftExpression()) {
auto r = visitShiftExpression(ex);
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
v &= rv;
} else if (r.type() == typeid(quint64)) {
auto rv = std::any_cast<quint64>(r);
v &= rv;
v &= quint64(rv);
} else {
return defaultResult();
}
}
return v;
return qint64(v);
}
std::any
@ -261,12 +233,10 @@ public:
auto data = ctx->additiveExpression();
auto total = data.size();
quint64 ret = 0;
qint64 ret = 0;
auto retv = visitAdditiveExpression(data.front());
if (retv.type() == typeid(qint64)) {
if (retv.has_value()) {
ret = std::any_cast<qint64>(retv);
} else if (retv.type() == typeid(quint64)) {
ret = std::any_cast<quint64>(retv);
} else {
return defaultResult();
}
@ -275,22 +245,16 @@ public:
auto op = ctx->children[2 * i - 1]->getText();
auto r = visitAdditiveExpression(data.at(i));
if (op == "<<") {
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
ret <<= rv;
} else if (r.type() == typeid(quint64)) {
auto rv = std::any_cast<quint64>(r);
ret <<= rv;
} else {
return defaultResult();
}
} else if (op == ">>") {
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
ret >>= rv;
} else if (r.type() == typeid(quint64)) {
auto rv = std::any_cast<quint64>(r);
ret >>= rv;
} else {
return defaultResult();
}
@ -311,12 +275,10 @@ public:
auto data = ctx->multiplicativeExpression();
auto total = data.size();
quint64 ret = 0;
qint64 ret = 0;
auto retv = visitMultiplicativeExpression(data.front());
if (retv.type() == typeid(qint64)) {
if (retv.has_value()) {
ret = std::any_cast<qint64>(retv);
} else if (retv.type() == typeid(quint64)) {
ret = std::any_cast<quint64>(retv);
} else {
return defaultResult();
}
@ -324,7 +286,7 @@ public:
for (size_t i = 1; i < total; i++) {
auto r = visitMultiplicativeExpression(data.at(i));
auto op = ctx->children[2 * i - 1]->getText();
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
if (op == "+") {
ret += rv;
@ -333,15 +295,6 @@ public:
} else {
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 {
return defaultResult();
}
@ -359,12 +312,10 @@ public:
auto data = ctx->castExpression();
auto total = data.size();
quint64 ret = 0;
qint64 ret = 0;
auto retv = visitCastExpression(data.front());
if (retv.type() == typeid(qint64)) {
if (retv.has_value()) {
ret = std::any_cast<qint64>(retv);
} else if (retv.type() == typeid(quint64)) {
ret = std::any_cast<quint64>(retv);
} else {
return defaultResult();
}
@ -372,7 +323,7 @@ public:
for (size_t i = 1; i < total; i++) {
auto r = visitCastExpression(data.at(i));
auto op = ctx->children[2 * i - 1]->getText();
if (r.type() == typeid(qint64)) {
if (r.has_value()) {
auto rv = std::any_cast<qint64>(r);
if (op == "*") {
ret *= rv;
@ -383,17 +334,6 @@ public:
} else {
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 {
return defaultResult();
}
@ -410,10 +350,8 @@ public:
if (ctx->IntegerConstant()) {
auto r = parseIntegerConstant(ctx->IntegerConstant()->getText());
if (std::holds_alternative<qint64>(r)) {
return std::get<qint64>(r);
} else if (std::holds_alternative<quint64>(r)) {
return std::get<quint64>(r);
if (r) {
return r.value();
}
} else if (ctx->assignmentExpression()) {
return visitAssignmentExpression(ctx->assignmentExpression());
@ -423,8 +361,7 @@ public:
}
private:
std::variant<std::monostate, qint64, quint64>
parseIntegerConstant(const std::string &text) {
std::optional<qint64> parseIntegerConstant(const std::string &text) {
Q_STATIC_ASSERT_X(
QT_VERSION >= QT_VERSION_CHECK(6, 4, 0),
"If you want to support Qt version lower than 6.4.0, You should "
@ -436,11 +373,7 @@ private:
if (b) {
return num;
} else {
auto num = ct.toULongLong(&b, 0);
if (b) {
return num;
}
return {};
return std::nullopt;
}
}
};

View File

@ -245,8 +245,8 @@ MainWindow::MainWindow(SplashDialog *splash) : FramelessMainWindow() {
m_scriptConsole->setEnabled(false);
// configure error, so disable all script feature
WingHex::WingRibbonToolBoxInfo::RibbonCatagories catagories;
m_ribbonMaps[catagories.SCRIPT]->setEnabled(false);
m_ribbonMaps[WingHex::WingRibbonCatagories::SCRIPT]->setEnabled(
false);
} else {
ScriptMachine::RegCallBacks callbacks;
callbacks.getInputFn = [this]() -> QString {
@ -369,33 +369,35 @@ void MainWindow::buildUpRibbonBar() {
loadCacheIcon();
using RibbonCatagories = WingHex::WingRibbonToolBoxInfo::RibbonCatagories;
RibbonCatagories catagories;
using RibbonCatagories = WingHex::WingRibbonCatagories;
m_ribbonMaps[catagories.FILE] = buildFilePage(m_ribbon->addTab(tr("File")));
m_ribbonMaps[RibbonCatagories::FILE] =
buildFilePage(m_ribbon->addTab(tr("File")));
qApp->processEvents();
m_ribbonMaps[catagories.EDIT] = buildEditPage(m_ribbon->addTab(tr("Edit")));
m_ribbonMaps[RibbonCatagories::EDIT] =
buildEditPage(m_ribbon->addTab(tr("Edit")));
qApp->processEvents();
m_ribbonMaps[catagories.VIEW] = buildViewPage(m_ribbon->addTab(tr("View")));
m_ribbonMaps[RibbonCatagories::VIEW] =
buildViewPage(m_ribbon->addTab(tr("View")));
qApp->processEvents();
auto &set = SettingManager::instance();
if (set.scriptEnabled()) {
m_ribbonMaps[catagories.SCRIPT] =
m_ribbonMaps[RibbonCatagories::SCRIPT] =
buildScriptPage(m_ribbon->addTab(tr("Script")));
qApp->processEvents();
}
if (set.enablePlugin()) {
m_ribbonMaps[catagories.PLUGIN] =
m_ribbonMaps[RibbonCatagories::PLUGIN] =
buildPluginPage(m_ribbon->addTab(tr("Plugin")));
qApp->processEvents();
}
m_ribbonMaps[catagories.SETTING] =
m_ribbonMaps[RibbonCatagories::SETTING] =
buildSettingPage(m_ribbon->addTab(tr("Setting")));
qApp->processEvents();
m_ribbonMaps[catagories.ABOUT] =
m_ribbonMaps[RibbonCatagories::ABOUT] =
buildAboutPage(m_ribbon->addTab(tr("About")));
qApp->processEvents();

View File

@ -45,8 +45,8 @@ QToolTip
/* 0.2ex is the smallest value that's not ignored on Windows. */
border: 0.04em solid #eff0f1;
background-image: none;
background-color: #31363b;
alternate-background-color: #31363b;
background-color: #202326;
alternate-background-color: #202326;
color: #eff0f1;
padding: 0.1em;
opacity: 200;
@ -55,7 +55,7 @@ QToolTip
QWidget
{
color: #eff0f1;
background-color: #31363b;
background-color: #202326;
selection-background-color: #3daee9;
selection-color: #eff0f1;
background-clip: border;
@ -137,7 +137,7 @@ QWidget
QWidget:disabled
{
color: #454545;
background-color: #31363b;
background-color: #202326;
}
QCheckBox
@ -181,7 +181,7 @@ QGroupBox::title
top: -1.6em;
subcontrol-origin: content;
subcontrol-position: top center;
background: #31363b;
background: #202326;
padding-left: 0.2em;
padding-right: 0.2em;
}
@ -343,7 +343,7 @@ QRadioButton::indicator:unchecked:disabled
QMenuBar
{
background-color: #31363b;
background-color: #202326;
color: #eff0f1;
}
@ -404,7 +404,7 @@ QMenu::item:selected
QMenu::item:selected:disabled
{
background-color: #31363b;
background-color: #202326;
}
QMenu::item:disabled
@ -476,9 +476,9 @@ QMenu::right-arrow:disabled
QAbstractItemView
{
alternate-background-color: #31363b;
alternate-background-color: #202326;
color: #eff0f1;
border: 0.09em solid #31363b;
border: 0.09em solid #202326;
border-radius: 0.09em;
}
@ -513,7 +513,7 @@ QAbstractScrollArea
*/
QAbstractScrollArea::corner
{
background: #31363b;
background: #202326;
}
/**
@ -735,7 +735,7 @@ QFrame[frameShape="6"] /* QFrame::StyledPanel == 0x0006 */
border-width: 0.04em;
padding: 0.09em;
border-style: solid;
border-color: #31363b;
border-color: #202326;
background-color: #76797c;
border-radius: 0.23em;
}
@ -842,7 +842,7 @@ QDialog QToolBar QToolButton[popupMode="2"]
QPushButton
{
color: #eff0f1;
background-color: #31363b;
background-color: #202326;
border: 0.04em solid #76797c;
padding: 0.23em;
border-radius: 0.09em;
@ -872,7 +872,7 @@ QPushButton:closed
QPushButton:disabled
{
background-color: #31363b;
background-color: #202326;
border-width: 0.04em;
border-color: #76797c;
border-style: solid;
@ -919,7 +919,7 @@ QPushButton:checked
QPushButton:hover
{
background-color: #31363b;
background-color: #202326;
border: 0.04em solid #3daee9;
color: #eff0f1;
}
@ -958,12 +958,12 @@ QPlainTextEdit:hover:pressed,
QAbstractView:hover:pressed,
QTreeView:hover:pressed
{
background-color: #31363b;
background-color: #202326;
}
QColumnView
{
border: 0.04em transparent #31363b;
border: 0.04em transparent #202326;
}
QColumnViewGrip
@ -1365,7 +1365,7 @@ QTabBar::tab:top:only-one
border-left: 0.04em solid #76797c;
border-right: 0.04em solid #76797c;
border-top: 0.09em solid #3daee9;
background-color: #31363b;
background-color: #202326;
padding: 0.23em;
min-width: 50px;
border-radius: 0.09em;
@ -1376,7 +1376,7 @@ QTabBar::tab:top:only-one
QTabBar::tab:top:!selected
{
color: #eff0f1;
background-color: #2c3034;
background-color: #1b1d20;
border: 0.04em transparent black;
border-right: 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-right: 0.04em solid #76797c;
border-bottom: 0.09em solid #3daee9;
background-color: #31363b;
background-color: #202326;
padding: 0.23em;
min-width: 50px;
border-radius: 0.09em;
@ -1429,7 +1429,7 @@ QTabBar::tab:bottom:only-one
QTabBar::tab:bottom:!selected
{
color: #eff0f1;
background-color: #2c3034;
background-color: #1b1d20;
border: 0.04em transparent black;
border-top: 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-bottom: 0.04em solid #76797c;
border-left: 0.04em solid #76797c;
background-color: #31363b;
background-color: #202326;
padding: 0.23em;
min-height: 50px;
border-radius: 0.09em;
@ -1482,7 +1482,7 @@ QTabBar::tab:left:only-one
QTabBar::tab:left:!selected
{
color: #eff0f1;
background-color: #2c3034;
background-color: #1b1d20;
border: 0.04em transparent black;
border-top: 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-bottom: 0.04em solid #76797c;
border-right: 0.04em solid #76797c;
background-color: #31363b;
background-color: #202326;
padding: 0.23em;
min-height: 50px;
border-radius: 0.09em;
@ -1535,7 +1535,7 @@ QTabBar::tab:right:only-one
QTabBar::tab:right:!selected
{
color: #eff0f1;
background-color: #2c3034;
background-color: #1b1d20;
border: 0.04em transparent black;
border-top: 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. */
color: #3daee9;
background-color: #31363b;
background-color: #202326;
padding: 0.23em;
}
@ -1624,7 +1624,7 @@ QTabBar[shape="6"]::tab:!selected,
QTabBar[shape="7"]::tab:!selected
{
color: #eff0f1;
background-color: #2c3034;
background-color: #1b1d20;
}
/**
@ -1675,7 +1675,7 @@ QTabBar[shape="7"]::close-button
QDockWidget
{
background: #31363b;
background: #202326;
/**
* It doesn't seem possible to change the border of the
* QDockWidget without changing the content margins.
@ -1899,7 +1899,7 @@ QSlider::groove:horizontal,
QSlider::groove:vertical
{
background: #2c3034;
border: 0em solid #31363b;
border: 0em solid #202326;
border-radius: 0.19em;
}
@ -2003,14 +2003,14 @@ QDialog QToolBar QToolButton[hasMenu="false"][popupMode="2"]
QToolButton[autoRaise="false"]
{
background-color: #31363b;
background-color: #202326;
border: 0.04em solid #76797c;
border-radius: 0.09em;
}
QToolButton[autoRaise="true"]
{
background-color: #31363b;
background-color: #202326;
border: 0.04em solid transparent;
}
@ -2164,7 +2164,7 @@ QToolButton::menu-button:pressed
QTableView
{
border: 0em solid black;
gridline-color: #31363b;
gridline-color: #202326;
background-color: #1d2023;
}
@ -2220,7 +2220,7 @@ QAbstractItemView::item:selected:hover
QHeaderView
{
background-color: #31363b;
background-color: #202326;
border: 0.04em transparent;
border-radius: 0em;
margin: 0em;
@ -2229,7 +2229,7 @@ QHeaderView
QHeaderView::section
{
background-color: #31363b;
background-color: #202326;
border: 0.04em solid #76797c;
color: #eff0f1;
border-radius: 0em;
@ -2317,7 +2317,7 @@ QHeaderView::up-arrow
QTableView QTableCornerButton::section
{
background-color: #31363b;
background-color: #202326;
border: 0.04em transparent #76797c;
border-top: 0.04em solid #76797c;
border-left: 0.04em solid #76797c;
@ -2357,7 +2357,7 @@ QToolBox::tab:hover
QSplitter::handle
{
border: 0.09em solid #2c3034;
background: -0.5em solid #2c3034;
background: -0.5em solid #202326;
max-width: 0em;
max-height: 0em;
}
@ -2372,7 +2372,7 @@ QProgressBar:horizontal,
QProgressBar:vertical
{
background-color: #626568;
border: 0.9em solid #31363b;
border: 0.9em solid #202326;
border-radius: 0.13em;
padding: 0em;
}
@ -2462,7 +2462,7 @@ QMessageBox QPushButton
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
{
qproperty-icon: url(:/dark/transparent.svg);
background: #31363b;
background: #202326;
width: 1.2em;
height: 1.2em;
padding: 0em;
@ -2570,7 +2570,7 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton
#floatingTitleCloseButton:pressed,
#floatingTitleMaximizeButton:pressed
{
background: #31363b;
background: #202326;
}
#tabCloseButton,
@ -2713,7 +2713,7 @@ ads--CDockWidgetTab
{
border: 0.04em solid #76797c;
border-top: 0.09em solid #76797c;
background-color: #2c3034;
background-color: #1b1d20;
padding: 0.1em;
min-width: 30px;
border-radius: 0.09em;
@ -2723,7 +2723,7 @@ ads--CDockWidgetTab
ads--CDockWidgetTab[activeTab="true"][focused="true"]
{
background-color: #31363b;
background-color: #202326;
border-top: 0.09em solid #3de9e3;
border-left: 0.04em solid #76797c;
border-right: 0.04em solid #3de9e3;
@ -2732,7 +2732,7 @@ ads--CDockWidgetTab[activeTab="true"][focused="true"]
ads--CDockWidgetTab[activeTab="true"]
{
background-color: #31363b;
background-color: #202326;
border-top: 0.09em solid #3daee9;
border-left: 0.04em solid #76797c;
border-right: 0.04em solid #76797c;
@ -2741,12 +2741,12 @@ ads--CDockWidgetTab[activeTab="true"]
ads--CDockWidgetTab QLabel
{
background-color: #2c3034;
background-color: #1b1d20;
}
ads--CDockWidgetTab[activeTab="true"] QLabel
{
background-color: #31363b;
background-color: #202326;
}
ads--CDockContainerWidget > QSplitter{
@ -2942,7 +2942,7 @@ RibbonButtonGroup QFrame[frameShape="5"]:hover
border-width: 0.04em;
padding: 0.09em;
border-style: solid;
border-color: #31363b;
border-color: #202326;
background-color: #76797c;
border-radius: 0.23em;
}
@ -2950,7 +2950,7 @@ RibbonButtonGroup QFrame[frameShape="5"]:hover
QHexView
{
qproperty-bytesColor: #eff0f1;
qproperty-bytesBackground: #31363b;
qproperty-bytesBackground: #202326;
qproperty-bytesAlterBackground: #2C3136;
qproperty-selectionColor: #eff0f1;
qproperty-selBackgroundColor: #3daee9;