Compare commits
13 Commits
f77f7ae1b1
...
1e3b24bca0
Author | SHA1 | Date |
---|---|---|
|
1e3b24bca0 | |
|
435056a2af | |
|
75a7a8b262 | |
|
04551684d2 | |
|
6b020b7f70 | |
|
5efff1b4c0 | |
|
ac4bd1bef2 | |
|
23e968cdd4 | |
|
32b2002187 | |
|
b3671054bf | |
|
a873757504 | |
|
ac932c36ee | |
|
7316bb8d3c |
|
@ -25,6 +25,7 @@ jobs:
|
|||
host: 'windows'
|
||||
target: 'desktop'
|
||||
arch: 'win64_msvc2019_64'
|
||||
modules: 'qtactiveqt'
|
||||
cache: true
|
||||
- name: Add Chinese support file for InnoSetup
|
||||
run: |
|
||||
|
|
|
@ -39,6 +39,7 @@ jobs:
|
|||
host: ${{ matrix.os == 'windows-latest' && 'windows' || 'linux' }}
|
||||
target: 'desktop'
|
||||
arch: ${{ matrix.arch }}
|
||||
modules: ${{ matrix.os == 'windows-latest' && matrix.qt_version == '6.6.2' && 'qtactiveqt' || '' }}
|
||||
cache: true
|
||||
|
||||
- name: Configure CMake
|
||||
|
|
|
@ -222,7 +222,13 @@ void QConsoleWidget::keyPressEvent(QKeyEvent *e) {
|
|||
cut();
|
||||
else {
|
||||
// cursor must be in edit zone
|
||||
if (textCursor <= inpos_)
|
||||
QDocumentCursor pos;
|
||||
if (textCursor.hasSelection()) {
|
||||
pos = textCursor.selectionStart();
|
||||
} else {
|
||||
pos = textCursor;
|
||||
}
|
||||
if (pos <= inpos_)
|
||||
QApplication::beep();
|
||||
else
|
||||
QEditor::keyPressEvent(e);
|
||||
|
@ -264,7 +270,7 @@ bool QConsoleWidget::isSelectionInEditZone() const {
|
|||
auto selectionStart = textCursor.selectionStart();
|
||||
auto selectionEnd = textCursor.selectionEnd();
|
||||
|
||||
return selectionStart > inpos_ && selectionEnd >= inpos_;
|
||||
return selectionStart >= inpos_ && selectionEnd > inpos_;
|
||||
}
|
||||
|
||||
bool QConsoleWidget::isCursorInEditZone() const { return cursor() >= inpos_; }
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "chunks.h"
|
||||
|
||||
#define BUFFER_SIZE 0x10000
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef CHUNKS_H
|
||||
#define CHUNKS_H
|
||||
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
#include "qfilebuffer.h"
|
||||
#include "QHexEdit2/chunks.h"
|
||||
|
||||
/*
|
||||
* this file is implemented by wingsummer,
|
||||
* 使用 QHexEdit2 的代码来实现轻松访问上 GB 的文件,
|
||||
* 该类作者并未实现
|
||||
*/
|
||||
|
||||
QFileBuffer::QFileBuffer(QObject *parent) : QHexBuffer(parent) {
|
||||
_chunks = new Chunks(parent);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QFILEBUFFER_H
|
||||
#define QFILEBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
#include "qfileregionbuffer.h"
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QFILEREGIONBUFFER_H
|
||||
#define QFILEREGIONBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexbuffer.h"
|
||||
#include <QBuffer>
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QHEXBUFFER_H
|
||||
#define QHEXBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qmemorybuffer.h"
|
||||
|
||||
QMemoryBuffer::QMemoryBuffer(QObject *parent) : QHexBuffer(parent) {}
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QMEMORYBUFFER_H
|
||||
#define QMEMORYBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qmemoryrefbuffer.h"
|
||||
|
||||
#include <QObject>
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QMEMORYREFBUFFER_H
|
||||
#define QMEMORYREFBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "baseaddrcommand.h"
|
||||
|
||||
BaseAddrCommand::BaseAddrCommand(QHexDocument *doc, quint64 oldaddr,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BASEADDRCOMMAND_H
|
||||
#define BASEADDRCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "bookmarkaddcommand.h"
|
||||
|
||||
BookMarkAddCommand::BookMarkAddCommand(QHexDocument *doc, qsizetype pos,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKADDCOMMAND_H
|
||||
#define BOOKMARKADDCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "bookmarkclearcommand.h"
|
||||
|
||||
BookMarkClearCommand::BookMarkClearCommand(
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKCLEARCOMMAND_H
|
||||
#define BOOKMARKCLEARCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "bookmarkcommand.h"
|
||||
|
||||
BookMarkCommand::BookMarkCommand(QHexDocument *doc, qsizetype pos,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKCOMMAND_H
|
||||
#define BOOKMARKCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "bookmarkremovecommand.h"
|
||||
|
||||
BookMarkRemoveCommand::BookMarkRemoveCommand(QHexDocument *doc, qsizetype pos,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKREMOVECOMMAND_H
|
||||
#define BOOKMARKREMOVECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "bookmarkreplacecommand.h"
|
||||
|
||||
BookMarkReplaceCommand::BookMarkReplaceCommand(QHexDocument *doc, qsizetype pos,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef BOOKMARKREPLACECOMMAND_H
|
||||
#define BOOKMARKREPLACECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "appendcommand.h"
|
||||
|
||||
AppendCommand::AppendCommand(QHexDocument *doc, QHexCursor *cursor,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef APPENDCOMMAND_H
|
||||
#define APPENDCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "hexcommand.h"
|
||||
|
||||
HexCommand::HexCommand(QHexDocument *doc, QHexCursor *cursor, int nibbleindex,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef HEXCOMMAND_H
|
||||
#define HEXCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "insertcommand.h"
|
||||
|
||||
InsertCommand::InsertCommand(QHexDocument *doc, QHexCursor *cursor,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef INSERTCOMMAND_H
|
||||
#define INSERTCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "removecommand.h"
|
||||
|
||||
RemoveCommand::RemoveCommand(QHexDocument *doc, qsizetype offset,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef REMOVECOMMAND_H
|
||||
#define REMOVECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "replacecommand.h"
|
||||
#include "document/qhexdocument.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef REPLACECOMMAND_H
|
||||
#define REPLACECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metaaddcommand.h"
|
||||
|
||||
MetaAddCommand::MetaAddCommand(QHexMetadata *hexmeta,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METAADDCOMMAND_H
|
||||
#define METAADDCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metaclearcommand.h"
|
||||
|
||||
MetaClearCommand::MetaClearCommand(QHexMetadata *hexmeta,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METACLEARCOMMAND_H
|
||||
#define METACLEARCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metacommand.h"
|
||||
|
||||
MetaCommand::MetaCommand(QHexMetadata *hexmeta, const QHexMetadataItem &meta,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METACOMMAND_H
|
||||
#define METACOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metaremovecommand.h"
|
||||
|
||||
MetaRemoveCommand::MetaRemoveCommand(QHexMetadata *hexmeta,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METAREMOVECOMMAND_H
|
||||
#define METAREMOVECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metaremoveposcommand.h"
|
||||
|
||||
MetaRemovePosCommand::MetaRemovePosCommand(QHexMetadata *hexmeta, qsizetype pos,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METAREMOVEPOSCOMMAND_H
|
||||
#define METAREMOVEPOSCOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "metareplacecommand.h"
|
||||
|
||||
MetaReplaceCommand::MetaReplaceCommand(QHexMetadata *hexmeta,
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef METAREPLACECOMMAND_H
|
||||
#define METAREPLACECOMMAND_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexcursor.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QHEXCURSOR_H
|
||||
#define QHEXCURSOR_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 LPGL from Andres6936/QHexEdit. I have modified a lot
|
||||
** so I decide to change the Open Source License. You can use the original
|
||||
** library under LPGL. Thanks for Andres6936's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexdocument.h"
|
||||
#include "buffer/qfilebuffer.h"
|
||||
#include "buffer/qfileregionbuffer.h"
|
||||
|
@ -219,6 +240,10 @@ bool QHexDocument::isReadOnly() { return m_readonly; }
|
|||
bool QHexDocument::isKeepSize() { return m_keepsize; }
|
||||
bool QHexDocument::isLocked() { return m_islocked; }
|
||||
|
||||
void QHexDocument::setLockKeepSize(bool b) { m_lockKeepSize = b; }
|
||||
|
||||
bool QHexDocument::lockKeepSize() const { return m_lockKeepSize; }
|
||||
|
||||
bool QHexDocument::setLockedFile(bool b) {
|
||||
if (m_readonly)
|
||||
return false;
|
||||
|
@ -227,7 +252,7 @@ bool QHexDocument::setLockedFile(bool b) {
|
|||
return true;
|
||||
}
|
||||
bool QHexDocument::setKeepSize(bool b) {
|
||||
if (m_readonly)
|
||||
if (m_readonly || m_lockKeepSize)
|
||||
return false;
|
||||
|
||||
m_keepsize = b;
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** 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 LPGL from Andres6936/QHexEdit. I have modified a lot
|
||||
** so I decide to change the Open Source License. You can use the original
|
||||
** library under LPGL. Thanks for Andres6936's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QHEXDOCUMENT_H
|
||||
#define QHEXDOCUMENT_H
|
||||
|
||||
|
@ -44,6 +64,9 @@ public:
|
|||
bool isKeepSize();
|
||||
bool isLocked();
|
||||
|
||||
void setLockKeepSize(bool b);
|
||||
bool lockKeepSize() const;
|
||||
|
||||
//----------------------------------
|
||||
bool AddBookMark(qsizetype pos, const QString &comment);
|
||||
bool RemoveBookMark(qsizetype pos);
|
||||
|
@ -242,6 +265,7 @@ private:
|
|||
bool m_readonly;
|
||||
bool m_keepsize;
|
||||
bool m_islocked;
|
||||
bool m_lockKeepSize = false;
|
||||
QMap<qsizetype, QString> _bookmarks;
|
||||
|
||||
bool m_metafg = true;
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexmetadata.h"
|
||||
#include "commands/meta/metaaddcommand.h"
|
||||
#include "commands/meta/metaclearcommand.h"
|
||||
|
@ -601,8 +622,8 @@ bool QHexMetadata::checkValidMetadata(qsizetype begin, qsizetype end,
|
|||
if (begin > end)
|
||||
return false;
|
||||
|
||||
if (!fgcolor.isValid() || fgcolor.alpha() == 0) {
|
||||
if (!bgcolor.isValid() || bgcolor.alpha() == 0) {
|
||||
if (!fgcolor.isValid() || fgcolor.alpha() != 255) {
|
||||
if (!bgcolor.isValid() || bgcolor.alpha() != 255) {
|
||||
if (comment.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QHEXMETADATA_H
|
||||
#define QHEXMETADATA_H
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QHEXREGIONOBJECT_H
|
||||
#define QHEXREGIONOBJECT_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexrenderer.h"
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QHEXRENDERER_H
|
||||
#define QHEXRENDERER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qstoragedevice.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
#ifndef QSTORAGEDEVICE_H
|
||||
#define QSTORAGEDEVICE_H
|
||||
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qhexview.h"
|
||||
#include "document/buffer/qmemorybuffer.h"
|
||||
#include <QApplication>
|
||||
|
@ -35,6 +56,10 @@ bool QHexView::setKeepSize(bool b) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void QHexView::setLockKeepSize(bool b) { m_document->setLockKeepSize(b); }
|
||||
|
||||
bool QHexView::lockKeepSize() const { return m_document->lockKeepSize(); }
|
||||
|
||||
qsizetype QHexView::documentLines() { return m_renderer->documentLines(); }
|
||||
qsizetype QHexView::documentBytes() { return m_document->length(); }
|
||||
qsizetype QHexView::currentRow() { return m_cursor->currentLine(); }
|
||||
|
@ -108,14 +133,6 @@ void QHexView::establishSignal(QHexDocument *doc) {
|
|||
this->viewport()->update();
|
||||
});
|
||||
|
||||
connect(m_cursor, &QHexCursor::positionChanged, this,
|
||||
&QHexView::moveToSelection);
|
||||
connect(m_cursor, &QHexCursor::selectionChanged, this, [this]() {
|
||||
this->viewport()->update();
|
||||
emit cursorSelectionChanged();
|
||||
});
|
||||
connect(m_cursor, &QHexCursor::insertionModeChanged, this,
|
||||
&QHexView::renderCurrentLine);
|
||||
connect(doc, &QHexDocument::canUndoChanged, this,
|
||||
&QHexView::canUndoChanged);
|
||||
connect(doc, &QHexDocument::canRedoChanged, this,
|
||||
|
@ -188,7 +205,7 @@ void QHexView::setDocument(const QSharedPointer<QHexDocument> &document,
|
|||
}
|
||||
|
||||
if (m_document) {
|
||||
m_document->disconnect();
|
||||
m_document->disconnect(this);
|
||||
m_document.clear();
|
||||
}
|
||||
|
||||
|
@ -211,6 +228,16 @@ void QHexView::setDocument(const QSharedPointer<QHexDocument> &document,
|
|||
}
|
||||
|
||||
establishSignal(m_document.data());
|
||||
|
||||
connect(m_cursor, &QHexCursor::positionChanged, this,
|
||||
&QHexView::moveToSelection);
|
||||
connect(m_cursor, &QHexCursor::selectionChanged, this, [this]() {
|
||||
this->viewport()->update();
|
||||
emit cursorSelectionChanged();
|
||||
});
|
||||
connect(m_cursor, &QHexCursor::insertionModeChanged, this,
|
||||
&QHexView::renderCurrentLine);
|
||||
|
||||
emit documentChanged(document.data());
|
||||
|
||||
this->adjustScrollBars();
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
/*==============================================================================
|
||||
** 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 MIT from Dax89/QHexView. I have modified a lot so I
|
||||
** decide to change the Open Source License. You can use the original library
|
||||
** under MIT. Thanks for Dax89's efforts.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef QHEXVIEW_H
|
||||
#define QHEXVIEW_H
|
||||
|
||||
#define QHEXVIEW_VERSION 3.0
|
||||
#define QHEXVIEW_VERSION 3.1
|
||||
|
||||
#include "document/qhexdocument.h"
|
||||
#include "document/qhexrenderer.h"
|
||||
|
@ -43,6 +64,10 @@ public:
|
|||
// added by wingsummer
|
||||
bool setLockedFile(bool b);
|
||||
bool setKeepSize(bool b);
|
||||
|
||||
void setLockKeepSize(bool b);
|
||||
bool lockKeepSize() const;
|
||||
|
||||
bool isReadOnly();
|
||||
bool isKeepSize();
|
||||
bool isLocked();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 147afda646faa0a8b10309dd2716b961bcb54051
|
||||
Subproject commit f9becd7ca224f32bc8d86ca09d697e2455a9d97e
|
|
@ -1 +1 @@
|
|||
Subproject commit 60c48755e3f717eace7830d7bbc0d8f1a5e0cc8a
|
||||
Subproject commit 606b6347edf0758c531abb6c36743e09a4c48a84
|
|
@ -29,8 +29,6 @@ set(DOCUMENT_SRC
|
|||
lib/document/qdocument.cpp)
|
||||
|
||||
set(WIDGETS_SRC
|
||||
lib/widgets/qcalltip.cpp
|
||||
lib/widgets/qcalltip.h
|
||||
lib/widgets/qfoldpanel.cpp
|
||||
lib/widgets/qfoldpanel.h
|
||||
lib/widgets/qlinechangepanel.cpp
|
||||
|
@ -46,11 +44,6 @@ set(QNFA_SRC
|
|||
lib/qnfa/light_vector.h lib/qnfa/qnfadefinition.h lib/qnfa/qnfa.h
|
||||
lib/qnfa/xml2qnfa.cpp lib/qnfa/qnfa.cpp lib/qnfa/qnfadefinition.cpp)
|
||||
|
||||
set(SNIPPET_SRC
|
||||
lib/snippets/qsnippet.cpp lib/snippets/qsnippet.h lib/snippets/qsnippet_p.h
|
||||
lib/snippets/qsnippetmanager.cpp lib/snippets/qsnippetmanager.h
|
||||
lib/snippets/qsnippetpatternloader.h)
|
||||
|
||||
set(SOURCE_FILES
|
||||
lib/qce-config.h
|
||||
lib/qcodecompletionengine.h
|
||||
|
@ -77,7 +70,7 @@ set(SOURCE_FILES
|
|||
lib/qreliablefilewatch.cpp)
|
||||
|
||||
add_library(QCodeEditor2 STATIC ${SOURCE_FILES} ${DOCUMENT_SRC} ${WIDGETS_SRC}
|
||||
${QNFA_SRC} ${SNIPPET_SRC})
|
||||
${QNFA_SRC})
|
||||
|
||||
target_compile_definitions(QCodeEditor2 PUBLIC _QCODE_EDIT_BUILD_
|
||||
_QCODE_EDIT_EMBED_)
|
||||
|
|
|
@ -192,6 +192,69 @@ QDocument::QDocument(QObject *p)
|
|||
*/
|
||||
QDocument::~QDocument() { delete m_impl; }
|
||||
|
||||
QStringList QDocument::textLines(int mode) const {
|
||||
QStringList s;
|
||||
|
||||
if (!m_impl || m_impl->m_lines.isEmpty())
|
||||
return s;
|
||||
|
||||
int line = 0;
|
||||
int prevIndent = 0, curIndent = 0,
|
||||
nextIndent = m_impl->m_lines.at(0)->nextNonSpaceChar(0);
|
||||
|
||||
if (nextIndent < 0)
|
||||
nextIndent = 0;
|
||||
|
||||
foreach (QDocumentLineHandle *l, m_impl->m_lines) {
|
||||
prevIndent = curIndent;
|
||||
curIndent = nextIndent;
|
||||
nextIndent = ++line < m_impl->m_lines.count()
|
||||
? m_impl->m_lines.at(line)->nextNonSpaceChar(0)
|
||||
: 0;
|
||||
|
||||
if (nextIndent < 0)
|
||||
nextIndent = 0;
|
||||
|
||||
QString buf = l->text();
|
||||
int avgIndent = qMax(prevIndent, nextIndent);
|
||||
|
||||
if ((mode & RestoreTrailingIndent) && buf.isEmpty() && avgIndent) {
|
||||
buf = QString(avgIndent, '\t');
|
||||
} else if (mode & RemoveTrailingWS) {
|
||||
|
||||
int len = 0, idx = buf.length();
|
||||
|
||||
while (--idx >= 0) {
|
||||
if (!buf.at(idx).isSpace())
|
||||
break;
|
||||
|
||||
++len;
|
||||
}
|
||||
|
||||
++idx;
|
||||
|
||||
if (len && (idx || !(mode & PreserveIndent)))
|
||||
buf.remove(idx, len);
|
||||
}
|
||||
|
||||
s.append(buf);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
QStringList QDocument::textLines(bool removeTrailing,
|
||||
bool preserveIndent) const {
|
||||
int mode = 0;
|
||||
|
||||
if (removeTrailing)
|
||||
mode |= RemoveTrailingWS;
|
||||
|
||||
if (preserveIndent)
|
||||
mode |= PreserveIndent;
|
||||
return textLines(mode);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Clear the content of the document
|
||||
*/
|
||||
|
@ -236,55 +299,7 @@ void QDocument::redo() {
|
|||
\param mode extra processing to perform on text
|
||||
*/
|
||||
QString QDocument::text(int mode) const {
|
||||
QString s;
|
||||
|
||||
if (!m_impl || m_impl->m_lines.isEmpty())
|
||||
return s;
|
||||
|
||||
int line = 0;
|
||||
int prevIndent = 0, curIndent = 0,
|
||||
nextIndent = m_impl->m_lines.at(0)->nextNonSpaceChar(0);
|
||||
|
||||
if (nextIndent < 0)
|
||||
nextIndent = 0;
|
||||
|
||||
foreach (QDocumentLineHandle *l, m_impl->m_lines) {
|
||||
prevIndent = curIndent;
|
||||
curIndent = nextIndent;
|
||||
nextIndent = ++line < m_impl->m_lines.count()
|
||||
? m_impl->m_lines.at(line)->nextNonSpaceChar(0)
|
||||
: 0;
|
||||
|
||||
if (nextIndent < 0)
|
||||
nextIndent = 0;
|
||||
|
||||
QString buf = l->text();
|
||||
int avgIndent = qMax(prevIndent, nextIndent);
|
||||
|
||||
if ((mode & RestoreTrailingIndent) && buf.isEmpty() && avgIndent) {
|
||||
buf = QString(avgIndent, '\t');
|
||||
} else if (mode & RemoveTrailingWS) {
|
||||
|
||||
int len = 0, idx = buf.length();
|
||||
|
||||
while (--idx >= 0) {
|
||||
if (!buf.at(idx).isSpace())
|
||||
break;
|
||||
|
||||
++len;
|
||||
}
|
||||
|
||||
++idx;
|
||||
|
||||
if (len && (idx || !(mode & PreserveIndent)))
|
||||
buf.remove(idx, len);
|
||||
}
|
||||
|
||||
s += buf + m_impl->m_lineEndingString;
|
||||
}
|
||||
|
||||
// s.chop(m_impl->m_lineEndingString.count());
|
||||
return s;
|
||||
return textLines(mode).join(m_impl->m_lineEndingString);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -3156,6 +3171,10 @@ bool QDocumentCursorHandle::movePosition(int count,
|
|||
if (!m_doc)
|
||||
return false;
|
||||
|
||||
if (count == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QDocumentLine l, l1 = m_doc->line(m_begLine), l2 = m_doc->line(m_endLine);
|
||||
|
||||
int &line = m_begLine;
|
||||
|
@ -3173,8 +3192,13 @@ bool QDocumentCursorHandle::movePosition(int count,
|
|||
|
||||
switch (op) {
|
||||
case QDocumentCursor::Left: {
|
||||
if (atStart())
|
||||
return false;
|
||||
if (count > 0) {
|
||||
if (atStart())
|
||||
return false;
|
||||
} else {
|
||||
if (atEnd())
|
||||
return false;
|
||||
}
|
||||
|
||||
int remaining = offset;
|
||||
|
||||
|
@ -3204,8 +3228,13 @@ bool QDocumentCursorHandle::movePosition(int count,
|
|||
}
|
||||
|
||||
case QDocumentCursor::Right: {
|
||||
if (atEnd())
|
||||
return false;
|
||||
if (count > 0) {
|
||||
if (atEnd())
|
||||
return false;
|
||||
} else {
|
||||
if (atStart())
|
||||
return false;
|
||||
}
|
||||
|
||||
int remaining = m_doc->line(line).length() - offset;
|
||||
|
||||
|
@ -3612,6 +3641,9 @@ bool QDocumentCursorHandle::movePosition(int count,
|
|||
auto txt = m_doc->line(line).text().mid(offset);
|
||||
qsizetype index = 0;
|
||||
auto len = txt.length();
|
||||
if (txt.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
if (txt.front().isSpace()) {
|
||||
for (qsizetype i = 0; i < len; ++i) {
|
||||
if (!txt.at(i).isSpace()) {
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
explicit QDocument(QObject *p = nullptr);
|
||||
virtual ~QDocument();
|
||||
|
||||
QStringList textLines(int mode) const;
|
||||
QStringList textLines(bool removeTrailing = false,
|
||||
bool preserveIndent = true) const;
|
||||
QString text(int mode) const;
|
||||
QString text(bool removeTrailing = false, bool preserveIndent = true) const;
|
||||
void setText(const QString &s);
|
||||
|
|
|
@ -123,8 +123,8 @@ void QCodeCompletionEngine::run() {
|
|||
/*!
|
||||
\brief Forced completion trigger
|
||||
*/
|
||||
void QCodeCompletionEngine::complete() {
|
||||
complete(editor()->cursor(), QString());
|
||||
void QCodeCompletionEngine::complete(const QString &trigger) {
|
||||
complete(editor()->cursor(), trigger);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -68,15 +68,16 @@ signals:
|
|||
void completionTriggered(const QString &s);
|
||||
|
||||
public slots:
|
||||
void complete();
|
||||
void complete(const QString &trigger = {});
|
||||
// make it public
|
||||
virtual void complete(const QDocumentCursor &c, const QString &trigger);
|
||||
|
||||
void textEdited(QKeyEvent *e);
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
virtual bool eventFilter(QObject *o, QEvent *e);
|
||||
|
||||
virtual void complete(const QDocumentCursor &c, const QString &trigger);
|
||||
|
||||
private:
|
||||
void triggerWordLenComplete();
|
||||
|
||||
|
|
|
@ -1911,6 +1911,8 @@ void QEditor::paintEvent(QPaintEvent *e) {
|
|||
p.fillRect(0, m_doc->height(), viewport()->width(),
|
||||
viewport()->height() - m_doc->height(), palette().base());
|
||||
}
|
||||
|
||||
p.end();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1935,6 +1937,11 @@ void QEditor::timerEvent(QTimerEvent *e) {
|
|||
// startDrag();
|
||||
} else if (id == m_click.timerId()) {
|
||||
m_click.stop();
|
||||
} else if (id == m_inputto.timerId()) {
|
||||
m_inputto.stop();
|
||||
if (!m_blink.isActive()) {
|
||||
emit inputTimeOuted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2244,7 +2251,7 @@ void QEditor::keyPressEvent(QKeyEvent *e) {
|
|||
// remanence of matches
|
||||
if (m_definition) {
|
||||
m_definition->clearMatches(m_doc);
|
||||
viewport()->repaint(); // force repaint in case of crash
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
bool hasPH = m_placeHolders.count() && m_curPlaceHolder != -1;
|
||||
|
@ -2602,7 +2609,7 @@ void QEditor::mouseDoubleClickEvent(QMouseEvent *e) {
|
|||
|
||||
repaintCursor();
|
||||
|
||||
viewport()->repaint();
|
||||
viewport()->update();
|
||||
} else {
|
||||
// qDebug("invalid cursor");
|
||||
}
|
||||
|
@ -2847,7 +2854,7 @@ void QEditor::focusInEvent(QFocusEvent *e) {
|
|||
void QEditor::focusOutEvent(QFocusEvent *e) {
|
||||
setFlag(CursorOn, false);
|
||||
m_blink.stop();
|
||||
|
||||
m_inputto.start(3000, this);
|
||||
QAbstractScrollArea::focusOutEvent(e);
|
||||
}
|
||||
|
||||
|
@ -3395,11 +3402,17 @@ bool QEditor::processCursor(QDocumentCursor &c, QKeyEvent *e, bool &b) {
|
|||
if (flag(AutoCloseChars)) {
|
||||
// auto close: {} [] () "" ''
|
||||
if (isAutoCloseChar(text)) {
|
||||
QString content =
|
||||
text + m_cursor.selectedText() + getPairedCloseChar(text);
|
||||
c.replaceSelectedText(content);
|
||||
c.clearSelection();
|
||||
c.movePosition(-1);
|
||||
if (m_cursor.hasSelection()) {
|
||||
QString content = text + m_cursor.selectedText() +
|
||||
getPairedCloseChar(text);
|
||||
c.replaceSelectedText(content);
|
||||
c.clearSelection();
|
||||
} else {
|
||||
c.beginEditBlock();
|
||||
insertText(c, text + getPairedCloseChar(text));
|
||||
c.endEditBlock();
|
||||
c.movePosition(-1);
|
||||
}
|
||||
} else {
|
||||
if (text == QStringLiteral("\"") ||
|
||||
text == QStringLiteral("'")) {
|
||||
|
@ -3430,7 +3443,8 @@ bool QEditor::processCursor(QDocumentCursor &c, QKeyEvent *e, bool &b) {
|
|||
}
|
||||
} else {
|
||||
if (isPairedCloseChar(text)) {
|
||||
if (c.previousChar() == getPairedBeginChar(text)) {
|
||||
if (c.previousChar() == getPairedBeginChar(text) &&
|
||||
c.nextChar() == text) {
|
||||
c.movePosition(1);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -307,6 +307,8 @@ signals:
|
|||
|
||||
void zoomed();
|
||||
|
||||
void inputTimeOuted();
|
||||
|
||||
public slots:
|
||||
void checkClipboard();
|
||||
void reconnectWatcher();
|
||||
|
@ -443,7 +445,7 @@ protected:
|
|||
bool m_selection;
|
||||
QRect m_crect, m_margins;
|
||||
QPoint m_clickPoint, m_dragPoint;
|
||||
QBasicTimer m_blink, m_scroll, m_click, m_drag;
|
||||
QBasicTimer m_blink, m_scroll, m_click, m_drag, m_inputto;
|
||||
|
||||
QFont _docfont;
|
||||
qreal _scaleRate = 1.0;
|
||||
|
|
|
@ -1,357 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\file qsnippet.cpp
|
||||
\brief Implementation of the builtin snippet types and loaders
|
||||
*/
|
||||
|
||||
#include "qsnippet_p.h"
|
||||
|
||||
#include <QMap>
|
||||
|
||||
/*!
|
||||
\class QSnippet
|
||||
\brief The base class for snippets
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QSnippetPatternLoader
|
||||
\brief The base class for snippet loaders
|
||||
*/
|
||||
|
||||
QSnippetInsertionCommand::QSnippetInsertionCommand(QEditor *e)
|
||||
: QDocumentCommandBlock(e->document()), m_editor(e), m_cursor(e->cursor()) {
|
||||
}
|
||||
|
||||
QSnippetInsertionCommand::~QSnippetInsertionCommand() {
|
||||
foreach (const QEditor::PlaceHolder &ph, m_placeHolders)
|
||||
delete ph.affector;
|
||||
}
|
||||
|
||||
void QSnippetInsertionCommand::addPlaceHolder(const QEditor::PlaceHolder &ph) {
|
||||
m_placeHolders << ph;
|
||||
}
|
||||
|
||||
void QSnippetInsertionCommand::addCommand(QDocumentCommand *c) {
|
||||
c->setTargetCursor(m_cursor.handle());
|
||||
QDocumentCommandBlock::addCommand(c);
|
||||
}
|
||||
|
||||
void QSnippetInsertionCommand::removeCommand(QDocumentCommand *c) {
|
||||
c->setTargetCursor(0);
|
||||
QDocumentCommandBlock::removeCommand(c);
|
||||
}
|
||||
|
||||
void QSnippetInsertionCommand::redo() {
|
||||
m_editor->clearPlaceHolders();
|
||||
QDocumentCommandBlock::redo();
|
||||
|
||||
foreach (const QEditor::PlaceHolder &ph, m_placeHolders)
|
||||
m_editor->addPlaceHolder(ph);
|
||||
|
||||
m_editor->nextPlaceHolder();
|
||||
}
|
||||
|
||||
void QSnippetInsertionCommand::undo() {
|
||||
// TODO : backup and restore previous placeholders?
|
||||
m_editor->clearPlaceHolders();
|
||||
QDocumentCommandBlock::undo();
|
||||
m_editor->setCursor(m_cursor);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
bool QCE::Snippets::PlainText::loadSnippet(QSnippet *snip,
|
||||
const QString &pattern) {
|
||||
PlainText *target = dynamic_cast<PlainText *>(snip);
|
||||
|
||||
if (!target) {
|
||||
qWarning("snippet/loader type mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
target->m_data = pattern;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QCE::Snippets::PlainText::insert(QEditor *e) const {
|
||||
/*
|
||||
QDocumentCursor c = e->cursor();
|
||||
c.insertText(m_data);
|
||||
e->setCursor(c);
|
||||
*/
|
||||
|
||||
e->write(m_data);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
QString parsePlaceHolder(const QString &s, int &index, int max,
|
||||
QMap<int, QCE::Snippets::Simple::PlaceHolder> &p,
|
||||
int &line, int &column, int baseSize) {
|
||||
QChar c;
|
||||
QStringList segments;
|
||||
int i = index, depth = 1, last = index + 1;
|
||||
|
||||
while (i + 1 < max) {
|
||||
c = s.at(++i);
|
||||
|
||||
if (c == QLatin1Char('{')) {
|
||||
++depth;
|
||||
} else if (c == QLatin1Char('}')) {
|
||||
--depth;
|
||||
|
||||
if (!depth) {
|
||||
segments << s.mid(last, i - last);
|
||||
break;
|
||||
}
|
||||
} else if (c == QLatin1Char(':')) {
|
||||
if (depth == 1) {
|
||||
segments << s.mid(last, i - last);
|
||||
last = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (segments.isEmpty()) {
|
||||
qWarning("invalid placeholder");
|
||||
return QString();
|
||||
}
|
||||
|
||||
int id = segments.at(0).toInt();
|
||||
|
||||
QCE::Snippets::Simple::PlaceHolder &ph = p[id];
|
||||
|
||||
if (ph.length == -1 && segments.count() > 1) {
|
||||
// new placeholder
|
||||
ph.length = segments.last().size();
|
||||
ph.lineOffset = line;
|
||||
ph.columnOffset = column;
|
||||
ph.defaultValue = segments.last();
|
||||
// TODO : support recursive snippetting of default value...
|
||||
} else {
|
||||
// mirror of an existing placeholder
|
||||
QCE::Snippets::Simple::Anchor a;
|
||||
a.lineOffset = line;
|
||||
a.columnOffset = column;
|
||||
if (ph.defaultValue.isEmpty())
|
||||
ph.unresolvedMirrors << baseSize << ph.mirrors.count();
|
||||
ph.mirrors << a;
|
||||
}
|
||||
|
||||
index = i + 1;
|
||||
return ph.defaultValue;
|
||||
}
|
||||
|
||||
void performRelocation(QCE::Snippets::Simple::Anchor &a,
|
||||
const QHash<int, QList<int>> &relocationTable,
|
||||
int length) {
|
||||
QHash<int, QList<int>>::const_iterator reloc =
|
||||
relocationTable.constFind(a.lineOffset);
|
||||
|
||||
if (reloc == relocationTable.constEnd())
|
||||
return;
|
||||
|
||||
int idx = 0;
|
||||
int relocOffset = 0;
|
||||
const QList<int> &offsets = *reloc;
|
||||
|
||||
while (((idx + 1) < offsets.count()) &&
|
||||
(offsets.at(idx) <= a.columnOffset)) {
|
||||
int off = offsets.at(++idx);
|
||||
|
||||
if (offsets.at(idx - 1) < a.columnOffset || off != length)
|
||||
relocOffset += off;
|
||||
|
||||
++idx;
|
||||
}
|
||||
|
||||
a.columnOffset += relocOffset;
|
||||
}
|
||||
|
||||
bool QCE::Snippets::Simple::loadSnippet(QSnippet *snip,
|
||||
const QString &pattern) {
|
||||
Simple *target = dynamic_cast<Simple *>(snip);
|
||||
|
||||
if (!target) {
|
||||
qWarning("snippet/loader type mismatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
target->m_base.clear();
|
||||
target->m_placeHolders.clear();
|
||||
|
||||
int index = 0, line = 0, column = 0, max = pattern.length();
|
||||
|
||||
QString tmp;
|
||||
QStringList base;
|
||||
QMap<int, PlaceHolder> p;
|
||||
|
||||
while (index < max) {
|
||||
QChar c = pattern.at(index);
|
||||
|
||||
if (c == QLatin1Char('$')) {
|
||||
base << tmp;
|
||||
tmp.clear();
|
||||
|
||||
c = pattern.at(++index);
|
||||
|
||||
if (c == QLatin1Char('{')) {
|
||||
QString val = parsePlaceHolder(pattern, index, max, p, line,
|
||||
column, base.count());
|
||||
base << val;
|
||||
|
||||
if (val.length()) {
|
||||
int nl = val.count(QLatin1Char('\n'));
|
||||
|
||||
line += nl;
|
||||
|
||||
if (nl)
|
||||
column = val.length() -
|
||||
val.lastIndexOf(QLatin1Char('\n')) - 1;
|
||||
else
|
||||
column += val.length();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
if (c != QLatin1Char('$')) {
|
||||
c = pattern.at(--index);
|
||||
}
|
||||
|
||||
++column;
|
||||
}
|
||||
} else if (c == QLatin1Char('\n')) {
|
||||
column = 0;
|
||||
++line;
|
||||
} else {
|
||||
++column;
|
||||
}
|
||||
|
||||
tmp += c;
|
||||
++index;
|
||||
}
|
||||
|
||||
if (tmp.length())
|
||||
base << tmp;
|
||||
|
||||
QHash<int, QList<int>> relocationTable;
|
||||
QMap<int, PlaceHolder>::iterator it = p.begin();
|
||||
|
||||
// first : build relocation table (in case several placeholders are on same
|
||||
// line
|
||||
while (it != p.end()) {
|
||||
if (it->unresolvedMirrors.count() && it->length) {
|
||||
for (int i = 0; i + 1 < it->unresolvedMirrors.count(); ++i) {
|
||||
int idx = it->unresolvedMirrors.at(i);
|
||||
int anchor = it->unresolvedMirrors.at(++i);
|
||||
|
||||
base[idx] = it->defaultValue;
|
||||
|
||||
const Anchor &a = it->mirrors.at(anchor);
|
||||
relocationTable[a.lineOffset] << a.columnOffset << it->length;
|
||||
}
|
||||
|
||||
it->unresolvedMirrors.clear();
|
||||
}
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
it = p.begin();
|
||||
|
||||
// then : apply relocation and store the corrected placeholder data
|
||||
while (it != p.end()) {
|
||||
performRelocation(*it, relocationTable, it->length);
|
||||
|
||||
for (int i = 0; i < it->mirrors.count(); ++i)
|
||||
performRelocation(it->mirrors[i], relocationTable, it->length);
|
||||
|
||||
target->m_placeHolders << *it;
|
||||
++it;
|
||||
}
|
||||
|
||||
target->m_base = base.join(QString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QCE::Snippets::Simple::insert(QEditor *e) const {
|
||||
// TODO : move into command and backup for proper undo/redo
|
||||
e->clearPlaceHolders();
|
||||
|
||||
QDocument *d = e->document();
|
||||
QDocumentCursor c = e->cursor();
|
||||
|
||||
if (c.isNull())
|
||||
c = QDocumentCursor(d);
|
||||
|
||||
int line = qMax(c.lineNumber(), 0), column = qMax(c.columnNumber(), 0);
|
||||
|
||||
if (line != c.lineNumber() || column != c.columnNumber())
|
||||
c = QDocumentCursor(d, line, column);
|
||||
|
||||
QSnippetInsertionCommand *cmd = new QSnippetInsertionCommand(e);
|
||||
|
||||
QDocumentCommand *scmd = 0;
|
||||
|
||||
if (c.hasSelection()) {
|
||||
QDocumentSelection sel = c.selection();
|
||||
|
||||
// qDebug("((%i, %i), (%i, %i))", sel.startLine, sel.start, sel.endLine,
|
||||
// sel.end);
|
||||
scmd = new QDocumentEraseCommand(sel.startLine, sel.start, sel.endLine,
|
||||
sel.end, d);
|
||||
|
||||
cmd->addCommand(scmd);
|
||||
|
||||
line = sel.startLine;
|
||||
column = sel.start;
|
||||
}
|
||||
|
||||
// qDebug("%s", qPrintable(m_base));
|
||||
|
||||
if (scmd) {
|
||||
// trick to get insert command to init properly
|
||||
scmd->redo();
|
||||
}
|
||||
|
||||
cmd->addCommand(new QDocumentInsertCommand(line, column, m_base, d));
|
||||
|
||||
if (scmd) {
|
||||
// trick to get insert command to init properly
|
||||
scmd->undo();
|
||||
}
|
||||
|
||||
if (m_placeHolders.count()) {
|
||||
foreach (const PlaceHolder &ph, m_placeHolders) {
|
||||
QEditor::PlaceHolder eph;
|
||||
eph.length = ph.length;
|
||||
eph.cursor =
|
||||
QDocumentCursor(d, line + ph.lineOffset,
|
||||
ph.columnOffset + (ph.lineOffset ? 0 : column));
|
||||
// eph.affector = new StubAffector;
|
||||
foreach (const Anchor &a, ph.mirrors)
|
||||
eph.mirrors << QDocumentCursor(d, line + a.lineOffset,
|
||||
a.columnOffset +
|
||||
(a.lineOffset ? 0 : column));
|
||||
|
||||
cmd->addPlaceHolder(eph);
|
||||
}
|
||||
}
|
||||
|
||||
d->execute(cmd);
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QSNIPPET_H_
|
||||
#define _QSNIPPET_H_
|
||||
|
||||
#include "qce-config.h"
|
||||
|
||||
/*!
|
||||
\file qsnippet.h
|
||||
\brief Definition of the QSnippet class
|
||||
*/
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
class QEditor;
|
||||
class QSnippetManager;
|
||||
|
||||
#include "qsnippetpatternloader.h"
|
||||
|
||||
class QCE_EXPORT QSnippet {
|
||||
friend class QSnippetManager;
|
||||
|
||||
public:
|
||||
inline QSnippet(const QSnippetPatternLoader *pl) : m_patternLoader(pl) {}
|
||||
virtual ~QSnippet() {}
|
||||
|
||||
inline QString name() const { return m_name; }
|
||||
inline void setName(const QString &n) { m_name = n; }
|
||||
|
||||
inline QStringList contexts() const { return m_contexts; }
|
||||
inline void setContexts(const QStringList &l) { m_contexts = l; }
|
||||
|
||||
inline QString pattern() const { return m_pattern; }
|
||||
|
||||
inline void setPattern(const QString &p) {
|
||||
m_pattern = p;
|
||||
m_patternLoader->reloadSnippet(this, p);
|
||||
}
|
||||
|
||||
virtual void insert(QEditor *e) const = 0;
|
||||
|
||||
protected:
|
||||
QString m_name;
|
||||
QString m_pattern;
|
||||
QStringList m_contexts;
|
||||
const QSnippetPatternLoader *m_patternLoader;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,120 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QSNIPPET_P_H_
|
||||
#define _QSNIPPET_P_H_
|
||||
|
||||
/*!
|
||||
\file qsnippet_p.h
|
||||
\brief Definition of the QSnippetInsertionCommand class
|
||||
*/
|
||||
|
||||
#include "qsnippet.h"
|
||||
#include "qsnippetpatternloader.h"
|
||||
|
||||
#include "qdocument.h"
|
||||
#include "qdocumentcommand.h"
|
||||
#include "qdocumentcursor.h"
|
||||
#include "qeditor.h"
|
||||
|
||||
class QSnippetInsertionCommand : public QDocumentCommandBlock {
|
||||
public:
|
||||
QSnippetInsertionCommand(QEditor *e);
|
||||
virtual ~QSnippetInsertionCommand();
|
||||
|
||||
void addPlaceHolder(const QEditor::PlaceHolder &ph);
|
||||
|
||||
virtual void addCommand(QDocumentCommand *c);
|
||||
virtual void removeCommand(QDocumentCommand *c);
|
||||
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
QEditor *m_editor;
|
||||
QDocumentCursor m_cursor;
|
||||
QList<QEditor::PlaceHolder> m_placeHolders;
|
||||
};
|
||||
|
||||
#define Q_SNIPPET(T) \
|
||||
friend class Loader; \
|
||||
\
|
||||
public: \
|
||||
class Loader : public QSnippetPatternLoader { \
|
||||
public: \
|
||||
virtual QString type() const { return "" #T; } \
|
||||
virtual QSnippet *loadSnippet(const QString &pattern) const { \
|
||||
T *snip = new T(this); \
|
||||
snip->m_pattern = pattern; \
|
||||
bool ok = reloadSnippet(snip, pattern); \
|
||||
if (!ok) { \
|
||||
delete snip; \
|
||||
snip = 0; \
|
||||
} \
|
||||
return snip; \
|
||||
} \
|
||||
virtual bool reloadSnippet(QSnippet *snip, \
|
||||
const QString &pattern) const { \
|
||||
return T::loadSnippet(snip, pattern); \
|
||||
} \
|
||||
}; \
|
||||
inline T(const QSnippetPatternLoader *pl) : QSnippet(pl) {} \
|
||||
\
|
||||
private:
|
||||
|
||||
namespace QCE {
|
||||
namespace Snippets {
|
||||
class PlainText : public QSnippet {
|
||||
Q_SNIPPET(PlainText)
|
||||
|
||||
public:
|
||||
virtual void insert(QEditor *e) const;
|
||||
|
||||
static bool loadSnippet(QSnippet *snip, const QString &pattern);
|
||||
|
||||
QString m_data;
|
||||
};
|
||||
|
||||
class Simple : public QSnippet {
|
||||
Q_SNIPPET(Simple)
|
||||
|
||||
public:
|
||||
struct Anchor {
|
||||
Anchor() : lineOffset(0), columnOffset(0) {}
|
||||
|
||||
int lineOffset;
|
||||
int columnOffset;
|
||||
};
|
||||
|
||||
struct PlaceHolder : public Anchor {
|
||||
PlaceHolder() : length(-1) {}
|
||||
|
||||
int length;
|
||||
QString defaultValue;
|
||||
QList<Anchor> mirrors;
|
||||
QList<int> unresolvedMirrors;
|
||||
};
|
||||
|
||||
virtual void insert(QEditor *e) const;
|
||||
|
||||
static bool loadSnippet(QSnippet *snip, const QString &pattern);
|
||||
|
||||
QString m_base;
|
||||
QList<PlaceHolder> m_placeHolders;
|
||||
};
|
||||
} // namespace Snippets
|
||||
} // namespace QCE
|
||||
|
||||
#endif
|
|
@ -1,200 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\file qsnippetmanager.cpp
|
||||
\brief Implementation of the QSnippetManager class
|
||||
*/
|
||||
|
||||
#include "qsnippetmanager.h"
|
||||
|
||||
#include "qsnippet_p.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextStream>
|
||||
|
||||
/*
|
||||
class StubAffector : public QEditor::PlaceHolder::Affector
|
||||
{
|
||||
public:
|
||||
virtual void affect(const QStringList& base, int ph, const
|
||||
QKeyEvent *e, int mirror, QString& after) const
|
||||
{
|
||||
after = after.toUpper();
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QSnippetManager
|
||||
\brief A class managing code snippets
|
||||
|
||||
|
||||
*/
|
||||
|
||||
QSnippetManager::QSnippetManager(QObject *p) : QObject(p) {
|
||||
addPatternLoader(new QCE::Snippets::PlainText::Loader);
|
||||
addPatternLoader(new QCE::Snippets::Simple::Loader);
|
||||
}
|
||||
|
||||
QSnippetManager::~QSnippetManager() {
|
||||
qDeleteAll(m_snippets);
|
||||
qDeleteAll(m_patternLoaders);
|
||||
}
|
||||
|
||||
int QSnippetManager::snippetCount() const { return m_snippets.count(); }
|
||||
|
||||
QSnippet *QSnippetManager::snippet(int i) const {
|
||||
return i >= 0 && i < m_snippets.count() ? m_snippets.at(i) : 0;
|
||||
}
|
||||
|
||||
void QSnippetManager::removeSnippet(int i, bool cleanup) {
|
||||
if (i < 0 || i >= m_snippets.count())
|
||||
return;
|
||||
|
||||
QSnippet *snip = m_snippets.takeAt(i);
|
||||
|
||||
emit snippetRemovedByIndex(i);
|
||||
emit snippetRemoved(snip);
|
||||
|
||||
if (cleanup)
|
||||
delete snip;
|
||||
}
|
||||
|
||||
void QSnippetManager::removeSnippet(QSnippet *snip) {
|
||||
int idx = m_snippets.indexOf(snip);
|
||||
|
||||
if (idx == -1)
|
||||
return;
|
||||
|
||||
m_snippets.removeAt(idx);
|
||||
|
||||
emit snippetRemovedByIndex(idx);
|
||||
emit snippetRemoved(snip);
|
||||
}
|
||||
|
||||
void QSnippetManager::addSnippet(QSnippet *snip) {
|
||||
if (!snip)
|
||||
return;
|
||||
|
||||
m_snippets << snip;
|
||||
emit snippetAdded(snip);
|
||||
}
|
||||
|
||||
bool QSnippetManager::loadSnippetFromString(const QString &name,
|
||||
const QString &s,
|
||||
const QString &type) {
|
||||
QSnippetPatternLoader *pl = patternLoader(type);
|
||||
|
||||
QSnippet *snip = pl->loadSnippet(s);
|
||||
|
||||
if (snip)
|
||||
snip->setName(name);
|
||||
|
||||
addSnippet(snip);
|
||||
|
||||
return snip;
|
||||
}
|
||||
|
||||
bool QSnippetManager::loadSnippetFromFile(const QString &file,
|
||||
const QString &type) {
|
||||
QFile f(file);
|
||||
|
||||
if (!f.open(QFile::ReadOnly | QFile::Text)) {
|
||||
qWarning("Unable to load snippet from %s", qPrintable(file));
|
||||
return false;
|
||||
}
|
||||
|
||||
// qDebug("loading from : %s", qPrintable(file));
|
||||
|
||||
QString s = QString::fromLocal8Bit(f.readAll());
|
||||
|
||||
static const QRegularExpression meta(
|
||||
"# name:(\\S+) context:(\\S*)[^\n]*\n");
|
||||
|
||||
auto match = meta.match(s);
|
||||
|
||||
if (match.hasMatch()) {
|
||||
// qDebug("meta! : %i => %s", idx, qPrintable(meta.cap(0)));
|
||||
s.remove(match.capturedStart(), match.capturedLength());
|
||||
}
|
||||
|
||||
if (s.endsWith('\n'))
|
||||
s.chop(1);
|
||||
|
||||
bool ok = loadSnippetFromString(
|
||||
match.hasMatch() ? match.captured(1) : QFileInfo(file).baseName(), s,
|
||||
type);
|
||||
|
||||
if (ok) {
|
||||
QSnippet *snip = m_snippets.last();
|
||||
snip->setContexts(match.hasMatch() ? match.captured(2).split(",")
|
||||
: QStringList("all"));
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
QSnippetPatternLoader *
|
||||
QSnippetManager::patternLoader(const QString &type) const {
|
||||
foreach (QSnippetPatternLoader *pl, m_patternLoaders) {
|
||||
if (pl->type() == type)
|
||||
return pl;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QSnippetManager::saveSnippetsToDirectory(const QString &path) {
|
||||
QDir d(path);
|
||||
|
||||
foreach (QSnippet *snip, m_snippets) {
|
||||
QFile f(d.filePath(snip->name() + ".qcs"));
|
||||
|
||||
if (!f.open(QFile::WriteOnly | QFile::Text))
|
||||
continue;
|
||||
|
||||
QTextStream s(&f);
|
||||
s << "# name:" << snip->name()
|
||||
<< " context:" << snip->contexts().join(",") << Qt::endl;
|
||||
s << snip->pattern();
|
||||
}
|
||||
}
|
||||
|
||||
void QSnippetManager::loadSnippetsFromDirectory(const QString &path) {
|
||||
QDir d(path);
|
||||
|
||||
for (auto &info : d.entryInfoList({QStringLiteral("*.qcs")},
|
||||
QDir::Files | QDir::Readable)) {
|
||||
loadSnippetFromFile(info.absoluteFilePath(), QStringLiteral("Simple"));
|
||||
}
|
||||
}
|
||||
|
||||
void QSnippetManager::addPatternLoader(QSnippetPatternLoader *pl) {
|
||||
m_patternLoaders << pl;
|
||||
}
|
||||
|
||||
void QSnippetManager::removePatternLoader(QSnippetPatternLoader *pl) {
|
||||
m_patternLoaders.removeAll(pl);
|
||||
}
|
||||
|
||||
QString QSnippetManager::typeGuess(const QString &pattern) const {
|
||||
Q_UNUSED(pattern)
|
||||
|
||||
return "Simple";
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QSNIPPET_MANAGER_H_
|
||||
#define _QSNIPPET_MANAGER_H_
|
||||
|
||||
#include "qce-config.h"
|
||||
|
||||
/*!
|
||||
\file qsnippetmanager.h
|
||||
\brief Definition of the QSnippetManager class
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
class QSnippet;
|
||||
class QSnippetPatternLoader;
|
||||
|
||||
class QCE_EXPORT QSnippetManager : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QSnippetManager(QObject *p = nullptr);
|
||||
virtual ~QSnippetManager();
|
||||
|
||||
int snippetCount() const;
|
||||
QSnippet *snippet(int i) const;
|
||||
void removeSnippet(int i, bool cleanup = true);
|
||||
|
||||
bool loadSnippetFromFile(const QString &file,
|
||||
const QString &type = QString());
|
||||
bool loadSnippetFromString(const QString &name, const QString &pattern,
|
||||
const QString &type = QString());
|
||||
|
||||
void saveSnippetsToDirectory(const QString &path);
|
||||
void loadSnippetsFromDirectory(const QString &path);
|
||||
|
||||
public slots:
|
||||
void addSnippet(QSnippet *s);
|
||||
void removeSnippet(QSnippet *s);
|
||||
|
||||
void addPatternLoader(QSnippetPatternLoader *pl);
|
||||
void removePatternLoader(QSnippetPatternLoader *pl);
|
||||
|
||||
signals:
|
||||
void snippetAdded(QSnippet *s);
|
||||
void snippetRemovedByIndex(int i);
|
||||
void snippetRemoved(QSnippet *s);
|
||||
|
||||
private:
|
||||
QString typeGuess(const QString &pattern) const;
|
||||
QSnippetPatternLoader *patternLoader(const QString &type) const;
|
||||
|
||||
QList<QSnippet *> m_snippets;
|
||||
QList<QSnippetPatternLoader *> m_patternLoaders;
|
||||
};
|
||||
|
||||
#endif // !_SNIPPETS_H_
|
|
@ -1,39 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
|
||||
**
|
||||
** This file is part of the Edyuk project <http://edyuk.org>
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public License
|
||||
** version 3 as published by the Free Software Foundation and appearing in the
|
||||
** file GPL.txt included in the packaging of this file.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QSNIPPET_PATTERN_LOADER_H_
|
||||
#define _QSNIPPET_PATTERN_LOADER_H_
|
||||
|
||||
/*!
|
||||
\file qsnippetpatternloader.h
|
||||
\brief Definition of the QSnippetPatternLoader class
|
||||
*/
|
||||
|
||||
class QString;
|
||||
|
||||
class QSnippet;
|
||||
|
||||
class QSnippetPatternLoader {
|
||||
public:
|
||||
virtual ~QSnippetPatternLoader() {}
|
||||
|
||||
virtual QString type() const = 0;
|
||||
|
||||
virtual QSnippet *loadSnippet(const QString &pattern) const = 0;
|
||||
virtual bool reloadSnippet(QSnippet *snip,
|
||||
const QString &pattern) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,280 +0,0 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "qcalltip.h"
|
||||
|
||||
/*!
|
||||
\file qcalltip.cpp
|
||||
\brief Implementation of the QCallTip class
|
||||
*/
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include <QToolTip>
|
||||
|
||||
/*!
|
||||
\class QCallTip
|
||||
\brief A widget dedicated to calltips display
|
||||
*/
|
||||
|
||||
QCallTip::QCallTip(QWidget *p) : QWidget(p), m_index(0) {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
auto palette = QToolTip::palette();
|
||||
_background = palette.color(QPalette::ToolTipBase);
|
||||
_foreground = palette.color(QPalette::ToolTipText);
|
||||
_borderColor = palette.color(QPalette::Shadow);
|
||||
}
|
||||
|
||||
QCallTip::~QCallTip() {}
|
||||
|
||||
QStringList QCallTip::tips() const { return m_tips; }
|
||||
|
||||
void QCallTip::setTips(const QStringList &l) {
|
||||
m_tips = l;
|
||||
m_index = 0;
|
||||
}
|
||||
|
||||
static int arrowWidth = 14;
|
||||
|
||||
void QCallTip::paintEvent(QPaintEvent *e) {
|
||||
Q_UNUSED(e)
|
||||
|
||||
QPainter p(this);
|
||||
p.setOpacity(_opacity);
|
||||
|
||||
QFontMetrics fm = fontMetrics();
|
||||
|
||||
m_up = m_down = QRect();
|
||||
|
||||
bool bPrev = m_index, bNext = (m_index + 1) < m_tips.count();
|
||||
int offset = 3, whalf = arrowWidth / 2 - 3; //, hhalf = height() / 2;
|
||||
|
||||
QRect bg(0, 0, fm.horizontalAdvance(m_tips.at(m_index)) + 6, fm.height());
|
||||
|
||||
if (bPrev) {
|
||||
bg.setWidth(bg.width() + arrowWidth);
|
||||
}
|
||||
|
||||
if (bNext) {
|
||||
bg.setWidth(bg.width() + arrowWidth);
|
||||
}
|
||||
|
||||
p.fillRect(bg, _background);
|
||||
// p.drawRect(bg);
|
||||
|
||||
p.save();
|
||||
|
||||
p.setPen(_borderColor);
|
||||
p.drawLine(0, height() - 1, bg.width() - 1, height() - 1);
|
||||
p.drawLine(bg.width() - 1, height() - 1, bg.width() - 1, 0);
|
||||
|
||||
p.drawLine(0, height() - 1, 0, 0);
|
||||
p.drawLine(0, 0, bg.width() - 1, 0);
|
||||
|
||||
int top = height() / 3, bottom = height() - height() / 3;
|
||||
|
||||
if (bPrev) {
|
||||
int x = offset + arrowWidth / 2 - 1;
|
||||
|
||||
QPoint pts[] = {QPoint(x - whalf, bottom), QPoint(x + whalf, bottom),
|
||||
QPoint(x, top)};
|
||||
|
||||
p.drawPolygon(pts, sizeof(pts) / sizeof(QPoint), Qt::WindingFill);
|
||||
|
||||
m_up = QRect(offset, 0, offset + arrowWidth, height());
|
||||
offset += arrowWidth;
|
||||
}
|
||||
|
||||
if (bNext) {
|
||||
int x = offset + arrowWidth / 2 - 1;
|
||||
|
||||
QPoint pts[] = {QPoint(x - whalf, top), QPoint(x + whalf, top),
|
||||
QPoint(x, bottom)};
|
||||
|
||||
p.drawPolygon(pts, sizeof(pts) / sizeof(QPoint), Qt::WindingFill);
|
||||
|
||||
m_down = QRect(offset, 0, offset + arrowWidth, height());
|
||||
offset += arrowWidth;
|
||||
}
|
||||
|
||||
p.setPen(_foreground);
|
||||
p.drawText(offset, fm.ascent() + 2, m_tips.at(m_index));
|
||||
|
||||
p.restore();
|
||||
|
||||
setFixedSize(bg.size() + QSize(1, 1));
|
||||
}
|
||||
|
||||
void QCallTip::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->modifiers() &
|
||||
(Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) {
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
QString text = e->text();
|
||||
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Escape:
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
|
||||
e->accept();
|
||||
break;
|
||||
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Tab:
|
||||
// hide();
|
||||
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
|
||||
e->ignore();
|
||||
|
||||
break;
|
||||
|
||||
case Qt::Key_Up:
|
||||
|
||||
if (m_index)
|
||||
--m_index;
|
||||
|
||||
e->accept();
|
||||
update();
|
||||
break;
|
||||
|
||||
case Qt::Key_Down:
|
||||
|
||||
if ((m_index + 1) < m_tips.count())
|
||||
++m_index;
|
||||
|
||||
e->accept();
|
||||
update();
|
||||
break;
|
||||
|
||||
case Qt::Key_Backspace:
|
||||
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
|
||||
e->ignore();
|
||||
break;
|
||||
|
||||
case Qt::Key_Shift:
|
||||
case Qt::Key_Alt:
|
||||
case Qt::Key_Control:
|
||||
e->ignore();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if (text.size() && text.at(0).isPrint()) {
|
||||
|
||||
} else {
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
}
|
||||
|
||||
e->ignore();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QCallTip::focusInEvent(QFocusEvent *e) { QWidget::focusInEvent(e); }
|
||||
|
||||
void QCallTip::focusOutEvent(QFocusEvent *e) {
|
||||
QWidget::focusOutEvent(e);
|
||||
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
}
|
||||
|
||||
void QCallTip::mousePressEvent(QMouseEvent *e) {
|
||||
if (m_index && m_up.isValid() && m_up.contains(e->pos())) {
|
||||
--m_index;
|
||||
} else if (((m_index + 1) < m_tips.count()) && m_down.isValid() &&
|
||||
m_down.contains(e->pos())) {
|
||||
++m_index;
|
||||
} else {
|
||||
close();
|
||||
|
||||
if (parentWidget())
|
||||
parentWidget()->setFocus();
|
||||
}
|
||||
|
||||
e->accept();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QCallTip::mouseReleaseEvent(QMouseEvent *e) { e->accept(); }
|
||||
|
||||
qreal QCallTip::opacity() const { return _opacity; }
|
||||
|
||||
void QCallTip::setOpacity(qreal newOpacity) {
|
||||
if (qFuzzyCompare(_opacity, newOpacity))
|
||||
return;
|
||||
_opacity = newOpacity;
|
||||
emit opacityChanged();
|
||||
}
|
||||
|
||||
QColor QCallTip::borderColor() const { return _borderColor; }
|
||||
|
||||
void QCallTip::setBorderColor(const QColor &newBorderColor) {
|
||||
if (_borderColor == newBorderColor)
|
||||
return;
|
||||
_borderColor = newBorderColor;
|
||||
emit borderColorChanged();
|
||||
}
|
||||
|
||||
QColor QCallTip::foreground() const { return _foreground; }
|
||||
|
||||
void QCallTip::setForeground(const QColor &newForeground) {
|
||||
if (_foreground == newForeground)
|
||||
return;
|
||||
_foreground = newForeground;
|
||||
emit foregroundChanged();
|
||||
}
|
||||
|
||||
QColor QCallTip::background() const { return _background; }
|
||||
|
||||
void QCallTip::setBackground(const QColor &newBackground) {
|
||||
if (_background == newBackground)
|
||||
return;
|
||||
_background = newBackground;
|
||||
emit backgroundChanged();
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*==============================================================================
|
||||
** 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/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef _QCALL_TIP_H_
|
||||
#define _QCALL_TIP_H_
|
||||
|
||||
#include "qce-config.h"
|
||||
|
||||
/*!
|
||||
\file qcalltip.h
|
||||
\brief Definition of the QCallTip class
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QCE_EXPORT QCallTip : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY
|
||||
backgroundChanged FINAL)
|
||||
Q_PROPERTY(QColor foreground READ foreground WRITE setForeground NOTIFY
|
||||
foregroundChanged FINAL)
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY
|
||||
borderColorChanged FINAL)
|
||||
Q_PROPERTY(
|
||||
qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
|
||||
|
||||
public:
|
||||
QCallTip(QWidget *p = nullptr);
|
||||
virtual ~QCallTip();
|
||||
|
||||
QStringList tips() const;
|
||||
void setTips(const QStringList &l);
|
||||
|
||||
QColor background() const;
|
||||
void setBackground(const QColor &newBackground);
|
||||
|
||||
QColor foreground() const;
|
||||
void setForeground(const QColor &newForeground);
|
||||
|
||||
QColor borderColor() const;
|
||||
void setBorderColor(const QColor &newBorderColor);
|
||||
|
||||
qreal opacity() const;
|
||||
void setOpacity(qreal newOpacity);
|
||||
|
||||
signals:
|
||||
void backgroundChanged();
|
||||
void foregroundChanged();
|
||||
void borderColorChanged();
|
||||
|
||||
void opacityChanged();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *e) override;
|
||||
virtual void keyPressEvent(QKeyEvent *e) override;
|
||||
virtual void focusInEvent(QFocusEvent *e) override;
|
||||
virtual void focusOutEvent(QFocusEvent *e) override;
|
||||
virtual void mousePressEvent(QMouseEvent *e) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
QStringList m_tips;
|
||||
QRect m_up, m_down;
|
||||
|
||||
QColor _background;
|
||||
QColor _foreground;
|
||||
QColor _borderColor;
|
||||
|
||||
qreal _opacity = 1;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -157,8 +157,9 @@ void QLineMarkPanel::mouseReleaseEvent(QMouseEvent *e) {
|
|||
|
||||
for (int i = 0; i < m_rects.count(); ++i) {
|
||||
if (m_rects.at(i).contains(e->pos())) {
|
||||
auto l = editor()->document()->line(m_lines.at(i));
|
||||
emit onToggleMark(i);
|
||||
auto ln = m_lines.at(i);
|
||||
auto l = editor()->document()->line(ln);
|
||||
emit onToggleMark(ln);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(PROJECT_VERSION "2.0.0")
|
||||
set(PROJECT_VERSION "2.1.0")
|
||||
|
||||
find_package(
|
||||
QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent
|
||||
|
@ -38,6 +38,8 @@ option(WINGHEX_USE_FRAMELESS "Use borderless windows to ensure UI uniformity"
|
|||
TRUE)
|
||||
|
||||
if(WIN32)
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED AxContainer)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED AxContainer)
|
||||
add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
|
@ -163,7 +165,10 @@ set(DIALOG_SRC
|
|||
src/dialog/showtextdialog.cpp
|
||||
src/dialog/splashdialog.ui
|
||||
src/dialog/splashdialog.cpp
|
||||
src/dialog/splashdialog.h)
|
||||
src/dialog/splashdialog.h
|
||||
src/dialog/historydeldialog.h
|
||||
src/dialog/historydeldialog.cpp
|
||||
src/dialog/historydeldialog.ui)
|
||||
|
||||
set(CONTROL_SRC
|
||||
src/control/editorview.h
|
||||
|
@ -193,7 +198,9 @@ set(CONTROL_SRC
|
|||
src/control/asobjtreewidget.h
|
||||
src/control/asobjtreewidget.cpp
|
||||
src/control/qtlonglongspinbox.cpp
|
||||
src/control/qtlonglongspinbox.h)
|
||||
src/control/qtlonglongspinbox.h
|
||||
src/control/dockwidgettab.h
|
||||
src/control/dockwidgettab.cpp)
|
||||
|
||||
set(CLASS_SRC
|
||||
src/class/logger.cpp
|
||||
|
@ -259,7 +266,13 @@ set(CLASS_SRC
|
|||
src/class/wingupdater.h
|
||||
src/class/wingupdater.cpp
|
||||
src/class/richtextitemdelegate.h
|
||||
src/class/richtextitemdelegate.cpp)
|
||||
src/class/richtextitemdelegate.cpp
|
||||
src/class/showinshell.h
|
||||
src/class/showinshell.cpp
|
||||
src/class/dockcomponentsfactory.h
|
||||
src/class/dockcomponentsfactory.cpp
|
||||
src/class/diffutil.h
|
||||
src/class/diffutil.cpp)
|
||||
|
||||
set(INTERNAL_PLG_SRC
|
||||
src/class/wingangelapi.h src/class/wingangelapi.cpp
|
||||
|
@ -345,9 +358,6 @@ set(CODEEDIT_WIDGET
|
|||
src/qcodeeditwidget/qformatconfig.h
|
||||
src/qcodeeditwidget/qformatconfig.cpp
|
||||
src/qcodeeditwidget/qformatconfig.ui
|
||||
src/qcodeeditwidget/qsnippetedit.cpp
|
||||
src/qcodeeditwidget/qsnippetedit.h
|
||||
src/qcodeeditwidget/qsnippetedit.ui
|
||||
src/qcodeeditwidget/qdocumentswaptextcommand.h
|
||||
src/qcodeeditwidget/qdocumentswaptextcommand.cpp
|
||||
src/qcodeeditwidget/formatconfigmodel.h
|
||||
|
@ -493,42 +503,30 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
|
||||
if(WINGHEX_USE_FRAMELESS)
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QWKCore
|
||||
QWKWidgets
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
else()
|
||||
target_link_libraries(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
Qt${QT_VERSION_MAJOR}::CorePrivate
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
QtSingleApplication::QtSingleApplication
|
||||
QHexView
|
||||
QCodeEditor2
|
||||
QJsonModel
|
||||
angelscript
|
||||
nlohmann_json::nlohmann_json
|
||||
qtadvanceddocking-qt${QT_VERSION_MAJOR})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE QWKCore QWKWidgets)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
PRIVATE Qt${QT_VERSION_MAJOR}::AxContainer)
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
|
|
|
@ -179,4 +179,3 @@
|
|||
## 插件库
|
||||
|
||||
- [WingAsm](https://github.com/Wing-summer/WingAsm) : 一个提供汇编和反汇编的插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0** 。
|
||||
- [WingCStruct](https://github.com/Wing-summer/WingCStruct) : 一个提供分析文件结构基础支持的插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0** 。
|
||||
|
|
|
@ -180,4 +180,3 @@ Of course, there are other repositories as mirror for Chinese users (which will
|
|||
## Plugins
|
||||
|
||||
- [WingAsm](https://github.com/Wing-summer/WingAsm) : A plugin that provides assembly and disassembly features. Author: **wingsummer**. License: **APGL-v3.0**.
|
||||
- [WingCStruct](https://github.com/Wing-summer/WingCStruct) : A plugin that provides basic support for analyzing file structures. Author: **wingsummer**. License: **APGL-v3.0**.
|
||||
|
|
|
@ -58,7 +58,7 @@ find_package(
|
|||
COMPONENTS Widgets LinguistTools
|
||||
REQUIRED)
|
||||
|
||||
set(TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/lang/ShareMemoryDrv_zh_CN.ts")
|
||||
set(TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/lang/shmem_zh_CN.ts")
|
||||
|
||||
set(TRANSLATION_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
@ -77,7 +77,7 @@ if(NOT TARGET TestPlugin)
|
|||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/TranslationUtils.cmake)
|
||||
endif()
|
||||
|
||||
add_plugin_translations_resource(QM_RES ShareMemoryDrv ${QM_FILES})
|
||||
add_plugin_translations_resource(QM_RES shmem ${QM_FILES})
|
||||
|
||||
add_library(
|
||||
ShareMemoryDrv SHARED
|
||||
|
|
|
@ -14,17 +14,17 @@
|
|||
<translation>一个提供羽云十六进制编辑器2的插件打开共享内存的驱动</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sharememorydrv.cpp" line="70"/>
|
||||
<location filename="../sharememorydrv.cpp" line="66"/>
|
||||
<source>ShareMemory</source>
|
||||
<translation>共享内存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sharememorydrv.cpp" line="81"/>
|
||||
<location filename="../sharememorydrv.cpp" line="76"/>
|
||||
<source>SharedMemory</source>
|
||||
<translation>共享内存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sharememorydrv.cpp" line="81"/>
|
||||
<location filename="../sharememorydrv.cpp" line="76"/>
|
||||
<source>PleaseInputID:</source>
|
||||
<translation>请输入标识:</translation>
|
||||
</message>
|
|
@ -20,8 +20,8 @@
|
|||
#include <QDebug>
|
||||
|
||||
SharedMemory::SharedMemory(const QString &key, OpenMode mode, QObject *parent)
|
||||
: QIODevice(parent), m_key(key), m_mode(mode), m_sharedMemory(key) {
|
||||
|
||||
: WingHex::WingIODevice(parent), m_key(key), m_mode(mode),
|
||||
m_sharedMemory(key) {
|
||||
if (m_mode == WriteOnly) {
|
||||
if (!m_sharedMemory.create(1024)) {
|
||||
qWarning() << "Unable to create shared memory segment.";
|
||||
|
@ -47,16 +47,27 @@ bool SharedMemory::open(OpenMode mode) {
|
|||
return false;
|
||||
}
|
||||
|
||||
m_sharedMemory.lock(); // Lock memory for reading or writing safely
|
||||
QSharedMemory::AccessMode m;
|
||||
if (mode == ReadOnly) {
|
||||
m = QSharedMemory::AccessMode::ReadOnly;
|
||||
} else {
|
||||
m = QSharedMemory::AccessMode::ReadWrite;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (m_sharedMemory.attach(m)) {
|
||||
m_sharedMemory.lock(); // Lock memory for reading or writing safely
|
||||
return QIODevice::open(mode);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SharedMemory::keepSize() const { return true; }
|
||||
|
||||
void SharedMemory::close() {
|
||||
m_sharedMemory.unlock();
|
||||
if (m_mode == ReadOnly) {
|
||||
m_sharedMemory.detach();
|
||||
}
|
||||
m_sharedMemory.detach();
|
||||
QIODevice::close();
|
||||
}
|
||||
|
||||
qint64 SharedMemory::readData(char *data, qint64 maxSize) {
|
||||
|
@ -99,3 +110,5 @@ qint64 SharedMemory::writeData(const char *data, qint64 maxSize) {
|
|||
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
qint64 SharedMemory::size() const { return m_sharedMemory.size(); }
|
||||
|
|
|
@ -18,11 +18,12 @@
|
|||
#ifndef SHAREDMEMORY_H
|
||||
#define SHAREDMEMORY_H
|
||||
|
||||
#include "iwingdevice.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QIODevice>
|
||||
#include <QSharedMemory>
|
||||
|
||||
class SharedMemory : public QIODevice {
|
||||
class SharedMemory : public WingHex::WingIODevice {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -33,6 +34,7 @@ public:
|
|||
|
||||
public:
|
||||
bool open(OpenMode mode) override;
|
||||
virtual bool keepSize() const override;
|
||||
|
||||
void close() override;
|
||||
|
||||
|
@ -40,6 +42,8 @@ public:
|
|||
|
||||
qint64 writeData(const char *data, qint64 maxSize) override;
|
||||
|
||||
virtual qint64 size() const override;
|
||||
|
||||
private:
|
||||
QString m_key;
|
||||
OpenMode m_mode;
|
||||
|
|
|
@ -50,15 +50,11 @@ QList<WingHex::PluginPage *> SharedMemoryDriver::registeredPages() const {
|
|||
return _plgps;
|
||||
}
|
||||
|
||||
QIODevice *SharedMemoryDriver::onOpenFile(const QString &path, bool readOnly,
|
||||
const QVariantList ¶ms) {
|
||||
Q_UNUSED(params);
|
||||
return new SharedMemory(
|
||||
path, readOnly ? SharedMemory::ReadOnly : SharedMemory::ReadWrite,
|
||||
this);
|
||||
WingHex::WingIODevice *SharedMemoryDriver::onOpenFile(const QString &path) {
|
||||
return new SharedMemory(path, SharedMemory::ReadWrite, this);
|
||||
}
|
||||
|
||||
bool SharedMemoryDriver::onCloseFile(QIODevice *dev) {
|
||||
bool SharedMemoryDriver::onCloseFile(WingHex::WingIODevice *dev) {
|
||||
if (dev->isOpen()) {
|
||||
dev->close();
|
||||
}
|
||||
|
@ -74,15 +70,14 @@ QIcon SharedMemoryDriver::supportedFileIcon() const {
|
|||
return QIcon(QStringLiteral(":/images/ShareMemDrv/images/shmem.png"));
|
||||
}
|
||||
|
||||
std::optional<QPair<QString, QVariantList>>
|
||||
SharedMemoryDriver::onOpenFileBegin() {
|
||||
QString SharedMemoryDriver::onOpenFileBegin() {
|
||||
bool ok;
|
||||
auto id =
|
||||
emit inputbox.getText(nullptr, tr("SharedMemory"), tr("PleaseInputID:"),
|
||||
QLineEdit::Normal, {}, &ok);
|
||||
if (!ok) {
|
||||
return std::make_optional<QPair<QString, QVariantList>>();
|
||||
return {};
|
||||
}
|
||||
|
||||
return qMakePair(id, QVariantList());
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -46,13 +46,11 @@ public:
|
|||
|
||||
// IWingDevice interface
|
||||
public:
|
||||
virtual std::optional<QPair<QString, QVariantList>>
|
||||
onOpenFileBegin() override;
|
||||
virtual QString onOpenFileBegin() override;
|
||||
virtual QString supportedFileExtDisplayName() const override;
|
||||
virtual QIcon supportedFileIcon() const override;
|
||||
virtual QIODevice *onOpenFile(const QString &path, bool readOnly,
|
||||
const QVariantList ¶ms) override;
|
||||
virtual bool onCloseFile(QIODevice *dev) override;
|
||||
virtual WingHex::WingIODevice *onOpenFile(const QString &path) override;
|
||||
virtual bool onCloseFile(WingHex::WingIODevice *dev) override;
|
||||
|
||||
private:
|
||||
QList<WingHex::PluginPage *> _plgps;
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
<message>
|
||||
<location filename="../testform.ui" line="97"/>
|
||||
<location filename="../testform.ui" line="194"/>
|
||||
<location filename="../testform.ui" line="842"/>
|
||||
<location filename="../testform.ui" line="518"/>
|
||||
<source>Text</source>
|
||||
<translation>文本 </translation>
|
||||
</message>
|
||||
|
@ -143,8 +143,8 @@
|
|||
<location filename="../testform.ui" line="228"/>
|
||||
<location filename="../testform.ui" line="293"/>
|
||||
<location filename="../testform.ui" line="444"/>
|
||||
<location filename="../testform.ui" line="1132"/>
|
||||
<location filename="../testform.ui" line="1293"/>
|
||||
<location filename="../testform.ui" line="808"/>
|
||||
<location filename="../testform.ui" line="969"/>
|
||||
<source>Clear</source>
|
||||
<translation>清空</translation>
|
||||
</message>
|
||||
|
@ -155,7 +155,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="184"/>
|
||||
<location filename="../testform.ui" line="879"/>
|
||||
<location filename="../testform.ui" line="555"/>
|
||||
<source>Icon</source>
|
||||
<translation>图标</translation>
|
||||
</message>
|
||||
|
@ -184,206 +184,174 @@
|
|||
<source>Controller</source>
|
||||
<translation>控制器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1184"/>
|
||||
<source>Others</source>
|
||||
<translation>其他</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1245"/>
|
||||
<source>Other APIs should be Test With Script</source>
|
||||
<translation>其他 API 应该用脚本测试,不提供可视化方式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="456"/>
|
||||
<source>MutiFile</source>
|
||||
<translation>多文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="480"/>
|
||||
<source>Operation</source>
|
||||
<translation>操作</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="621"/>
|
||||
<source>Metadata</source>
|
||||
<translation>元数据</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="635"/>
|
||||
<source>begin</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="645"/>
|
||||
<source>length</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="655"/>
|
||||
<source>foreground</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="665"/>
|
||||
<source>background</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="675"/>
|
||||
<source>comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="693"/>
|
||||
<location filename="../testform.ui" line="759"/>
|
||||
<source>Apply</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="714"/>
|
||||
<source>BookMark</source>
|
||||
<translation>书签</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="731"/>
|
||||
<source>Position</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="741"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="780"/>
|
||||
<location filename="../testform.ui" line="811"/>
|
||||
<location filename="../testform.ui" line="487"/>
|
||||
<source>MessageBox</source>
|
||||
<translation>信息框</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="788"/>
|
||||
<location filename="../testform.ui" line="825"/>
|
||||
<location filename="../testform.ui" line="1002"/>
|
||||
<location filename="../testform.ui" line="464"/>
|
||||
<location filename="../testform.ui" line="501"/>
|
||||
<location filename="../testform.ui" line="678"/>
|
||||
<source>Title</source>
|
||||
<translation>标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="859"/>
|
||||
<location filename="../testform.ui" line="535"/>
|
||||
<source>Buttons</source>
|
||||
<translation>按钮组</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="869"/>
|
||||
<location filename="../testform.ui" line="545"/>
|
||||
<source>DefaultButton</source>
|
||||
<translation>默认按钮</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="980"/>
|
||||
<location filename="../testform.ui" line="656"/>
|
||||
<source>InputBox</source>
|
||||
<translation>输入框</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="995"/>
|
||||
<location filename="../testform.ui" line="671"/>
|
||||
<source>Label</source>
|
||||
<translation>标签内容</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="311"/>
|
||||
<location filename="../testform.ui" line="1031"/>
|
||||
<location filename="../testform.ui" line="1205"/>
|
||||
<location filename="../testform.ui" line="1394"/>
|
||||
<location filename="../testform.ui" line="707"/>
|
||||
<location filename="../testform.ui" line="881"/>
|
||||
<location filename="../testform.ui" line="1070"/>
|
||||
<source>Type</source>
|
||||
<translation>类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="469"/>
|
||||
<source>Handle</source>
|
||||
<translation>句柄</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1144"/>
|
||||
<location filename="../testform.ui" line="820"/>
|
||||
<source>FileDialog</source>
|
||||
<translation>文件框</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1159"/>
|
||||
<location filename="../testform.ui" line="835"/>
|
||||
<source>Filter</source>
|
||||
<translation>过滤器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1166"/>
|
||||
<location filename="../testform.ui" line="1319"/>
|
||||
<location filename="../testform.ui" line="842"/>
|
||||
<location filename="../testform.ui" line="995"/>
|
||||
<source>Caption</source>
|
||||
<translation>标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1187"/>
|
||||
<location filename="../testform.ui" line="863"/>
|
||||
<source>Options</source>
|
||||
<translation>选项组</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1305"/>
|
||||
<location filename="../testform.ui" line="981"/>
|
||||
<source>ColorDialog</source>
|
||||
<translation>颜色框</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1333"/>
|
||||
<location filename="../testform.ui" line="1009"/>
|
||||
<source>Color</source>
|
||||
<translation>颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.ui" line="1379"/>
|
||||
<location filename="../testform.ui" line="1055"/>
|
||||
<source>DataVisual</source>
|
||||
<translation>数据可视化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="350"/>
|
||||
<location filename="../testform.cpp" line="361"/>
|
||||
<location filename="../testform.cpp" line="344"/>
|
||||
<location filename="../testform.cpp" line="355"/>
|
||||
<source>UpdateTextTreeError</source>
|
||||
<translation>更新文本树失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="376"/>
|
||||
<location filename="../testform.cpp" line="370"/>
|
||||
<source>UpdateTextListByModelError</source>
|
||||
<translation>通过模型更新文本列表失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="386"/>
|
||||
<location filename="../testform.cpp" line="380"/>
|
||||
<source>UpdateTextTableByModelError</source>
|
||||
<translation>通过模型更新文本表格失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="397"/>
|
||||
<location filename="../testform.cpp" line="391"/>
|
||||
<source>UpdateTextTreeByModelError</source>
|
||||
<translation>通过模型更新文本树失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="498"/>
|
||||
<source>Choose</source>
|
||||
<translation>选择</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TestPlugin</name>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="83"/>
|
||||
<location filename="../testplugin.cpp" line="199"/>
|
||||
<source>Test</source>
|
||||
<translation>测试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="95"/>
|
||||
<location filename="../testplugin.cpp" line="104"/>
|
||||
<location filename="../testplugin.cpp" line="109"/>
|
||||
<location filename="../testplugin.cpp" line="190"/>
|
||||
<location filename="../testplugin.cpp" line="211"/>
|
||||
<location filename="../testplugin.cpp" line="220"/>
|
||||
<location filename="../testplugin.cpp" line="225"/>
|
||||
<location filename="../testplugin.cpp" line="306"/>
|
||||
<source>TestPlugin</source>
|
||||
<translation>测试插件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="113"/>
|
||||
<location filename="../testplugin.cpp" line="229"/>
|
||||
<source>Button - </source>
|
||||
<translation>按钮 - </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="117"/>
|
||||
<location filename="../testplugin.cpp" line="233"/>
|
||||
<source>Click</source>
|
||||
<translation>点击</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="193"/>
|
||||
<location filename="../testplugin.cpp" line="309"/>
|
||||
<source>A Test Plugin for WingHexExplorer2.</source>
|
||||
<translation>一个用来测试羽云十六进制编辑器2的插件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="347"/>
|
||||
<location filename="../testplugin.cpp" line="355"/>
|
||||
<location filename="../testplugin.cpp" line="364"/>
|
||||
<location filename="../testplugin.cpp" line="385"/>
|
||||
<location filename="../testplugin.cpp" line="401"/>
|
||||
<location filename="../testplugin.cpp" line="408"/>
|
||||
<location filename="../testplugin.cpp" line="415"/>
|
||||
<location filename="../testplugin.cpp" line="422"/>
|
||||
<location filename="../testplugin.cpp" line="430"/>
|
||||
<location filename="../testplugin.cpp" line="461"/>
|
||||
<location filename="../testplugin.cpp" line="469"/>
|
||||
<location filename="../testplugin.cpp" line="477"/>
|
||||
<location filename="../testplugin.cpp" line="485"/>
|
||||
<location filename="../testplugin.cpp" line="494"/>
|
||||
<source>InvalidParamsCount</source>
|
||||
<translation>无效参数个数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="378"/>
|
||||
<location filename="../testplugin.cpp" line="394"/>
|
||||
<source>InvalidParam</source>
|
||||
<translation>非法参数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testplugin.cpp" line="452"/>
|
||||
<source>AllocArrayFailed</source>
|
||||
<translation>分配数组失败</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TestPluginPage</name>
|
||||
|
@ -396,7 +364,7 @@
|
|||
<context>
|
||||
<name>TestWingEditorViewWidget</name>
|
||||
<message>
|
||||
<location filename="../testwingeditorviewwidget.cpp" line="18"/>
|
||||
<location filename="../testwingeditorviewwidget.cpp" line="28"/>
|
||||
<source>TestWingEditorView</source>
|
||||
<translation>测试插件编辑视图</translation>
|
||||
</message>
|
||||
|
|
|
@ -51,9 +51,9 @@ TestForm::TestForm(WingHex::IWingPlugin *plg, QWidget *parent)
|
|||
initMsgBoxCheckedBtnCombo();
|
||||
initMsgBoxIconCombo();
|
||||
initFileDialogOps();
|
||||
initFileHandleListWidget();
|
||||
|
||||
ui->sbposition->setRange(0, INT_MAX);
|
||||
ui->lblauthor->setPixmap(
|
||||
WingHex::HOSTRESPIMG(QStringLiteral("author"), QStringLiteral(".jpg")));
|
||||
|
||||
_click = std::bind(&TestForm::onDVClicked, this, std::placeholders::_1);
|
||||
_dblclick =
|
||||
|
@ -126,12 +126,6 @@ void TestForm::initFileDialogOps() {
|
|||
}
|
||||
}
|
||||
|
||||
void TestForm::initFileHandleListWidget() {
|
||||
auto item = new QListWidgetItem(QStringLiteral("HexEditor_Current (-1)"));
|
||||
item->setData(Qt::UserRole, int(-1));
|
||||
ui->lwHandle->addItem(item);
|
||||
}
|
||||
|
||||
QMessageBox::StandardButtons TestForm::getMsgButtons() const {
|
||||
QMessageBox::StandardButtons buttons =
|
||||
QMessageBox::StandardButton::NoButton;
|
||||
|
@ -425,122 +419,3 @@ void TestForm::on_btnStatusInvisible_clicked() {
|
|||
Q_UNUSED(emit _plg->controller.setStringVisible(false));
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnSwitch_clicked() {
|
||||
auto item = ui->lwHandle->currentItem();
|
||||
auto handle = item->data(Qt::UserRole).toInt();
|
||||
auto ret = emit _plg->controller.switchDocument(handle);
|
||||
if (!ret) {
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnNewFile_clicked() {
|
||||
auto h = emit _plg->controller.newFile();
|
||||
if (h < 0) {
|
||||
auto e = QMetaEnum::fromType<WingHex::ErrFile>();
|
||||
emit _plg->msgbox.critical(this, QStringLiteral("Error"),
|
||||
e.valueToKey(h));
|
||||
} else {
|
||||
auto item = new QListWidgetItem(QStringLiteral("NewFile (%1)").arg(h));
|
||||
item->setData(Qt::UserRole, h);
|
||||
ui->lwHandle->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnOpenFile_clicked() {
|
||||
auto filename =
|
||||
emit _plg->filedlg.getOpenFileName(this, QStringLiteral("Test"));
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto h = emit _plg->controller.openFile(filename);
|
||||
if (h < 0) {
|
||||
auto e = QMetaEnum::fromType<WingHex::ErrFile>();
|
||||
emit _plg->msgbox.critical(this, QStringLiteral("Error"),
|
||||
e.valueToKey(h));
|
||||
} else {
|
||||
auto item = new QListWidgetItem(QStringLiteral("%1 (%2)")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(h));
|
||||
item->setData(Qt::UserRole, h);
|
||||
ui->lwHandle->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnOpenRegionFile_clicked() {
|
||||
auto filename =
|
||||
emit _plg->filedlg.getOpenFileName(this, QStringLiteral("Test"));
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto h = emit _plg->controller.openWorkSpace(filename);
|
||||
if (h < 0) {
|
||||
auto e = QMetaEnum::fromType<WingHex::ErrFile>();
|
||||
emit _plg->msgbox.critical(this, QStringLiteral("Error"),
|
||||
e.valueToKey(h));
|
||||
} else {
|
||||
auto item = new QListWidgetItem(QStringLiteral("WS - %1 (%2)")
|
||||
.arg(QFileInfo(filename).fileName())
|
||||
.arg(h));
|
||||
item->setData(Qt::UserRole, h);
|
||||
ui->lwHandle->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnOpenWorkSpace_clicked() {}
|
||||
|
||||
void TestForm::on_btnOpenDriver_clicked() {
|
||||
auto drivers = emit _plg->reader.getStorageDrivers();
|
||||
bool ok;
|
||||
auto dr = emit _plg->inputbox.getItem(this, QStringLiteral("Test"),
|
||||
tr("Choose"), drivers, 0, false, &ok);
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
auto h = emit _plg->controller.openDriver(dr);
|
||||
if (h < 0) {
|
||||
auto e = QMetaEnum::fromType<WingHex::ErrFile>();
|
||||
emit _plg->msgbox.critical(this, QStringLiteral("Error"),
|
||||
e.valueToKey(h));
|
||||
} else {
|
||||
auto item =
|
||||
new QListWidgetItem(QStringLiteral("%1 (%2)").arg(dr).arg(h));
|
||||
item->setData(Qt::UserRole, h);
|
||||
ui->lwHandle->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnSaveFile_clicked() {}
|
||||
|
||||
void TestForm::on_btnSaveAsFile_clicked() {}
|
||||
|
||||
void TestForm::on_btnExportFile_clicked() {}
|
||||
|
||||
void TestForm::on_btnCloseFile_clicked() {
|
||||
auto item = ui->lwHandle->currentItem();
|
||||
auto handle = item->data(Qt::UserRole).toInt();
|
||||
auto ret = emit _plg->controller.closeFile(handle);
|
||||
|
||||
if (ret == WingHex::ErrFile::Success) {
|
||||
if (handle >= 0) {
|
||||
ui->lwHandle->removeItemWidget(item);
|
||||
delete item;
|
||||
}
|
||||
} else {
|
||||
auto e = QMetaEnum::fromType<WingHex::ErrFile>();
|
||||
emit _plg->msgbox.critical(this, QStringLiteral("Error"),
|
||||
e.valueToKey(ret));
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnApplyBookMark_clicked() {
|
||||
if (emit _plg->reader.existBookMark(ui->sbposition->value())) {
|
||||
Q_UNUSED(emit _plg->controller.modBookMark(ui->sbposition->value(),
|
||||
ui->lecomment->text()));
|
||||
} else {
|
||||
Q_UNUSED(emit _plg->controller.addBookMark(ui->sbposition->value(),
|
||||
ui->lecomment->text()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,28 +105,6 @@ private slots:
|
|||
|
||||
void on_btnStatusInvisible_clicked();
|
||||
|
||||
void on_btnSwitch_clicked();
|
||||
|
||||
void on_btnNewFile_clicked();
|
||||
|
||||
void on_btnOpenFile_clicked();
|
||||
|
||||
void on_btnOpenRegionFile_clicked();
|
||||
|
||||
void on_btnOpenWorkSpace_clicked();
|
||||
|
||||
void on_btnOpenDriver_clicked();
|
||||
|
||||
void on_btnSaveFile_clicked();
|
||||
|
||||
void on_btnSaveAsFile_clicked();
|
||||
|
||||
void on_btnExportFile_clicked();
|
||||
|
||||
void on_btnCloseFile_clicked();
|
||||
|
||||
void on_btnApplyBookMark_clicked();
|
||||
|
||||
private:
|
||||
void initLogCombo();
|
||||
|
||||
|
@ -140,8 +118,6 @@ private:
|
|||
|
||||
void initFileDialogOps();
|
||||
|
||||
void initFileHandleListWidget();
|
||||
|
||||
private:
|
||||
QMessageBox::StandardButtons getMsgButtons() const;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<property name="windowTitle">
|
||||
<string>TestForm</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
|
@ -451,330 +451,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string>MutiFile</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_24">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Handle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="lwHandle"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Operation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSwitch">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnNewFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">NewFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpenFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">OpenFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpenRegionFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">OpenRegionFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpenWorkSpace">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">OpenWorkSpace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpenDriver">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">OpenDriver</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSaveFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">SaveFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSaveAsFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">SaveAsFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnExportFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">ExportFile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCloseFile">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_10">
|
||||
<attribute name="title">
|
||||
<string>Metadata</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_8">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="beginLabel">
|
||||
<property name="text">
|
||||
<string>begin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="sbbegin"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lengthLabel">
|
||||
<property name="text">
|
||||
<string>length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="sbmlength"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="foregroundLabel">
|
||||
<property name="text">
|
||||
<string>foreground</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="wforeground" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="backgroundLabel">
|
||||
<property name="text">
|
||||
<string>background</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QWidget" name="wbackground" native="true"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="commentLabel_2">
|
||||
<property name="text">
|
||||
<string>comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lemcomment"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnApplyMeta">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>169</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_11">
|
||||
<attribute name="title">
|
||||
<string>BookMark</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="positionLabel">
|
||||
<property name="text">
|
||||
<string>Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="sbposition"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="commentLabel">
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lecomment"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnApplyBookMark">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>245</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>MessageBox</string>
|
||||
|
@ -1308,10 +984,10 @@
|
|||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_7">
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>5</number>
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
|
@ -1339,7 +1015,7 @@
|
|||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -1503,6 +1179,91 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string>Others</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblauthor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Other APIs should be Test With Script</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1516,6 +1277,22 @@
|
|||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>btnClearCtl</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>tbCtlLogger</receiver>
|
||||
<slot>clear()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>271</x>
|
||||
<y>387</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>318</x>
|
||||
<y>264</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearSend</sender>
|
||||
<signal>clicked()</signal>
|
||||
|
@ -1532,38 +1309,6 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearText</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>leToastText</receiver>
|
||||
<slot>clear()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>569</x>
|
||||
<y>271</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>468</x>
|
||||
<y>229</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearReader</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>tbReaderLogger</receiver>
|
||||
<slot>clear()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>255</x>
|
||||
<y>395</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>288</x>
|
||||
<y>307</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearInput</sender>
|
||||
<signal>clicked()</signal>
|
||||
|
@ -1597,18 +1342,34 @@
|
|||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearCtl</sender>
|
||||
<sender>btnClearReader</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>tbCtlLogger</receiver>
|
||||
<receiver>tbReaderLogger</receiver>
|
||||
<slot>clear()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>271</x>
|
||||
<y>387</y>
|
||||
<x>255</x>
|
||||
<y>395</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>318</x>
|
||||
<y>264</y>
|
||||
<x>288</x>
|
||||
<y>307</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnClearText</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>leToastText</receiver>
|
||||
<slot>clear()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>569</x>
|
||||
<y>271</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>468</x>
|
||||
<y>229</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#include "testsettingpage.h"
|
||||
#include "testwingeditorviewwidget.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
// 注意:所有提供的脚本接口函数都不是线程安全的,只是测试
|
||||
|
||||
TestPlugin::TestPlugin() : WingHex::IWingPlugin() {
|
||||
// 在构造函数中,所有的 API 都无法调用。插件的翻译文件也不会自动加载。
|
||||
// 在构造函数中,仅适合做一些为初始化准备的操作。
|
||||
|
@ -50,9 +54,121 @@ TestPlugin::TestPlugin() : WingHex::IWingPlugin() {
|
|||
info.params.append(qMakePair(MetaType::String, QStringLiteral("info")));
|
||||
_scriptInfo.insert(QStringLiteral("test_b"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_c),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Void;
|
||||
info.params.append(qMakePair(MetaType(MetaType::Int | MetaType::Array),
|
||||
QStringLiteral("c")));
|
||||
_scriptInfo.insert(QStringLiteral("test_c"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_d),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Void;
|
||||
info.params.append(qMakePair(MetaType::Hash, QStringLiteral("d")));
|
||||
_scriptInfo.insert(QStringLiteral("test_d"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_e),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Bool;
|
||||
_scriptInfo.insert(QStringLiteral("test_e"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_f),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType(MetaType::Byte | MetaType::Array);
|
||||
_scriptInfo.insert(QStringLiteral("test_f"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_g),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::String;
|
||||
_scriptInfo.insert(QStringLiteral("test_g"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn =
|
||||
std::bind(QOverload<const QVariantList &>::of(&TestPlugin::test_h),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Hash;
|
||||
_scriptInfo.insert(QStringLiteral("test_h"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn = std::bind(QOverload<const QVariantList &>::of(
|
||||
&TestPlugin::createTestShareMem),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Bool;
|
||||
info.params.append(
|
||||
qMakePair(MetaType::String, QStringLiteral("nameID")));
|
||||
_scriptInfo.insert(QStringLiteral("createTestShareMem"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn = std::bind(QOverload<const QVariantList &>::of(
|
||||
&TestPlugin::destoryTestShareMem),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Void;
|
||||
_scriptInfo.insert(QStringLiteral("destoryTestShareMem"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn = std::bind(QOverload<const QVariantList &>::of(
|
||||
&TestPlugin::printLogTestSharedMemData),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Void;
|
||||
_scriptInfo.insert(QStringLiteral("printLogTestSharedMemData"), info);
|
||||
}
|
||||
|
||||
{
|
||||
_scriptUnsafe.insert(QStringLiteral("array<color>@ colorTable()"),
|
||||
std::bind(QOverload<const QList<void *> &>::of(
|
||||
&TestPlugin::colorTable),
|
||||
this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn = std::bind(QOverload<const QVariantList &>::of(
|
||||
&TestPlugin::setPluginMetaTestEnabled),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Void;
|
||||
info.params.append(qMakePair(MetaType::Bool, QStringLiteral("b")));
|
||||
_scriptInfo.insert(QStringLiteral("setPluginMetaTestEnabled"), info);
|
||||
}
|
||||
|
||||
{
|
||||
WingHex::IWingPlugin::ScriptFnInfo info;
|
||||
info.fn = std::bind(QOverload<const QVariantList &>::of(
|
||||
&TestPlugin::pluginMetaTestEnabled),
|
||||
this, std::placeholders::_1);
|
||||
info.ret = MetaType::Bool;
|
||||
_scriptInfo.insert(QStringLiteral("pluginMetaTestEnabled"), info);
|
||||
}
|
||||
}
|
||||
|
||||
TestPlugin::~TestPlugin() {}
|
||||
TestPlugin::~TestPlugin() { destoryTestShareMem(); }
|
||||
|
||||
int TestPlugin::sdkVersion() const { return WingHex::SDKVERSION; }
|
||||
|
||||
|
@ -193,6 +309,10 @@ const QString TestPlugin::pluginComment() const {
|
|||
return tr("A Test Plugin for WingHexExplorer2.");
|
||||
}
|
||||
|
||||
QString TestPlugin::retranslate(const QString &str) {
|
||||
return QApplication::tr(str.toLatin1());
|
||||
}
|
||||
|
||||
QList<WingHex::WingDockWidgetInfo> TestPlugin::registeredDockWidgets() const {
|
||||
return _winfo;
|
||||
}
|
||||
|
@ -217,33 +337,283 @@ TestPlugin::registeredEditorViewWidgets() const {
|
|||
return _evws;
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_a(const QVariantList &) {
|
||||
QHash<QString, WingHex::IWingPlugin::UNSAFE_SCFNPTR>
|
||||
TestPlugin::registeredScriptUnsafeFns() const {
|
||||
return _scriptUnsafe;
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_a(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
test_a();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_b(const QVariantList ¶ms) {
|
||||
if (params.isEmpty()) {
|
||||
return {};
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto arg0 = params.first().toString();
|
||||
test_b(arg0);
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_c(const QVariantList ¶ms) {
|
||||
if (params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto arg0 = params.first();
|
||||
|
||||
// note: passed QVector<QVariant>
|
||||
if (arg0.canConvert<QVector<QVariant>>()) {
|
||||
QVector<int> param;
|
||||
for (auto &v : arg0.value<QVector<QVariant>>()) {
|
||||
param.append(v.toInt()); // must be int
|
||||
}
|
||||
|
||||
test_c(param);
|
||||
} else {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_d(const QVariantList ¶ms) {
|
||||
if (params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
auto arg0 = params.first();
|
||||
|
||||
// note: passed QVariantHash
|
||||
if (arg0.canConvert<QVariantHash>()) {
|
||||
test_d(arg0.value<QVariantHash>());
|
||||
} else {
|
||||
return getScriptCallError(-2, tr("InvalidParam"));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_e(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return test_e();
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_f(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return test_f();
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_g(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return test_g();
|
||||
}
|
||||
|
||||
QVariant TestPlugin::test_h(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return test_h();
|
||||
}
|
||||
|
||||
WingHex::IWingPlugin::UNSAFE_RET
|
||||
TestPlugin::colorTable(const QList<void *> ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return generateScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
|
||||
void *array;
|
||||
QVector<void *> colors;
|
||||
for (auto &c : colorTable()) {
|
||||
colors.append(new QColor(c));
|
||||
}
|
||||
|
||||
auto invoked =
|
||||
emit invokeService(QStringLiteral("WingAngelAPI"), "vector2AsArray",
|
||||
WINGAPI_RETURN_ARG(void *, array),
|
||||
WINGAPI_ARG(MetaType, MetaType::Color),
|
||||
WINGAPI_ARG(QVector<void *>, colors));
|
||||
if (invoked) {
|
||||
if (array) {
|
||||
qDeleteAll(colors);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
qDeleteAll(colors);
|
||||
return generateScriptCallError(-2, tr("AllocArrayFailed"));
|
||||
}
|
||||
|
||||
QVector<QColor> TestPlugin::colorTable() {
|
||||
return {Qt::red, Qt::green, Qt::blue};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::createTestShareMem(const QVariantList ¶ms) {
|
||||
if (params.size() != 1) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto arg0 = params.first().toString();
|
||||
return createTestShareMem(arg0);
|
||||
}
|
||||
|
||||
QVariant TestPlugin::destoryTestShareMem(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
destoryTestShareMem();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::printLogTestSharedMemData(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
printLogTestSharedMemData();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::setPluginMetaTestEnabled(const QVariantList ¶ms) {
|
||||
if (params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
auto arg0 = params.first().toBool();
|
||||
setPluginMetaTestEnabled(arg0);
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant TestPlugin::pluginMetaTestEnabled(const QVariantList ¶ms) {
|
||||
if (!params.isEmpty()) {
|
||||
return getScriptCallError(-1, tr("InvalidParamsCount"));
|
||||
}
|
||||
return pluginMetaTestEnabled();
|
||||
}
|
||||
|
||||
void TestPlugin::test_a() { emit debug(__FUNCTION__); }
|
||||
|
||||
void TestPlugin::test_b(const QString &a) {
|
||||
emit warn(__FUNCTION__ + QStringLiteral(" : ") % a);
|
||||
void TestPlugin::test_b(const QString &b) {
|
||||
emit warn(__FUNCTION__ + QStringLiteral(" : ") % b);
|
||||
}
|
||||
|
||||
void TestPlugin::test_c(const QVector<int> &c) {
|
||||
auto content = __FUNCTION__ + QStringLiteral(" : { ");
|
||||
if (!c.isEmpty()) {
|
||||
content += QString::number(c.first());
|
||||
|
||||
for (QVector<int>::size_type i = 1; i < c.size(); ++i) {
|
||||
content += (QStringLiteral(", ") + QString::number(c.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
content += QStringLiteral(" }");
|
||||
|
||||
emit warn(content);
|
||||
}
|
||||
|
||||
void TestPlugin::test_d(const QVariantHash &d) {
|
||||
auto content = __FUNCTION__ + QStringLiteral(" : { ");
|
||||
if (!d.isEmpty()) {
|
||||
QStringList hash;
|
||||
for (auto p = d.constKeyValueBegin(); p != d.constKeyValueEnd(); p++) {
|
||||
hash.append(QStringLiteral("{ ") + p->first + QStringLiteral(", ") +
|
||||
p->second.toString() + QStringLiteral(" }"));
|
||||
}
|
||||
|
||||
content += hash.join(", ");
|
||||
}
|
||||
content += QStringLiteral(" }");
|
||||
emit warn(content);
|
||||
}
|
||||
|
||||
bool TestPlugin::test_e() {
|
||||
emit warn(__FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray TestPlugin::test_f() {
|
||||
emit warn(__FUNCTION__);
|
||||
return WingHex::WINGSUMMER.toLatin1();
|
||||
}
|
||||
|
||||
QString TestPlugin::test_g() {
|
||||
emit warn(__FUNCTION__);
|
||||
return WingHex::WINGSUMMER;
|
||||
}
|
||||
|
||||
QVariantHash TestPlugin::test_h() {
|
||||
QVariantHash hash;
|
||||
auto t = WingHex::WINGSUMMER.length();
|
||||
for (int i = 0; i < t; ++i) {
|
||||
hash.insert(WingHex::WINGSUMMER.at(i), i);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
bool TestPlugin::createTestShareMem(const QString &nameID) {
|
||||
if (_tsharemem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nameID.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_tsharemem = new QSharedMemory(nameID, this);
|
||||
|
||||
if (!_tsharemem->create(20)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto buffer = _tsharemem->data();
|
||||
std::memset(buffer, 0, 20);
|
||||
const char data[] = "WingSummer";
|
||||
std::memcpy(buffer, data, sizeof(data));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TestPlugin::destoryTestShareMem() {
|
||||
if (_tsharemem) {
|
||||
_tsharemem->detach();
|
||||
_tsharemem->deleteLater();
|
||||
_tsharemem = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void TestPlugin::printLogTestSharedMemData() {
|
||||
emit warn(QByteArray(reinterpret_cast<const char *>(_tsharemem->data()), 20)
|
||||
.toHex(' '));
|
||||
}
|
||||
|
||||
void TestPlugin::setPluginMetaTestEnabled(bool b) {
|
||||
if (b != ENABLE_META) {
|
||||
ENABLE_META = b;
|
||||
for (auto &i : TestWingEditorViewWidget::instances()) {
|
||||
i->setEnableMeta(b);
|
||||
emit i->docSaved(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TestPlugin::pluginMetaTestEnabled() { return ENABLE_META; }
|
||||
|
||||
QHash<QString, WingHex::IWingPlugin::ScriptFnInfo>
|
||||
TestPlugin::registeredScriptFns() const {
|
||||
return _scriptInfo;
|
||||
}
|
||||
|
||||
WingHex::IWingPlugin::RegisteredEvents TestPlugin::registeredEvents() const {
|
||||
return RegisteredEvent::AppReady;
|
||||
RegisteredEvents evs;
|
||||
evs.setFlag(RegisteredEvent::AppReady);
|
||||
evs.setFlag(RegisteredEvent::ScriptUnSafeFnRegistering);
|
||||
return evs;
|
||||
}
|
||||
|
||||
void TestPlugin::eventReady() {
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "iwingplugin.h"
|
||||
|
||||
#include <QSharedMemory>
|
||||
|
||||
class TestPlugin final : public WingHex::IWingPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -45,6 +47,8 @@ public:
|
|||
virtual const QString pluginName() const override;
|
||||
virtual const QString pluginComment() const override;
|
||||
|
||||
virtual QString retranslate(const QString &str) override;
|
||||
|
||||
// IWingPlugin interface (可选)
|
||||
public:
|
||||
// 有关注册开头(register 开头)的函数,插件系统不保证有且只调用一次
|
||||
|
@ -61,27 +65,67 @@ public:
|
|||
registeredEditorViewWidgets() const override;
|
||||
virtual QHash<QString, ScriptFnInfo> registeredScriptFns() const override;
|
||||
|
||||
virtual QHash<QString, UNSAFE_SCFNPTR>
|
||||
registeredScriptUnsafeFns() const override;
|
||||
|
||||
virtual RegisteredEvents registeredEvents() const override;
|
||||
virtual void eventReady() override;
|
||||
|
||||
private:
|
||||
QVariant test_a(const QVariantList &);
|
||||
QVariant test_a(const QVariantList ¶ms);
|
||||
QVariant test_b(const QVariantList ¶ms);
|
||||
QVariant test_c(const QVariantList ¶ms);
|
||||
QVariant test_d(const QVariantList ¶ms);
|
||||
|
||||
QVariant test_e(const QVariantList ¶ms);
|
||||
QVariant test_f(const QVariantList ¶ms);
|
||||
QVariant test_g(const QVariantList ¶ms);
|
||||
QVariant test_h(const QVariantList ¶ms);
|
||||
|
||||
UNSAFE_RET colorTable(const QList<void *> ¶ms);
|
||||
|
||||
QVariant createTestShareMem(const QVariantList ¶ms);
|
||||
QVariant destoryTestShareMem(const QVariantList ¶ms);
|
||||
QVariant printLogTestSharedMemData(const QVariantList ¶ms);
|
||||
|
||||
QVariant setPluginMetaTestEnabled(const QVariantList ¶ms);
|
||||
QVariant pluginMetaTestEnabled(const QVariantList ¶ms);
|
||||
|
||||
private:
|
||||
void test_a();
|
||||
void test_b(const QString &a);
|
||||
void test_b(const QString &b);
|
||||
void test_c(const QVector<int> &c);
|
||||
void test_d(const QVariantHash &d);
|
||||
|
||||
bool test_e();
|
||||
QByteArray test_f();
|
||||
QString test_g();
|
||||
QVariantHash test_h();
|
||||
|
||||
QVector<QColor> colorTable();
|
||||
bool createTestShareMem(const QString &nameID);
|
||||
void destoryTestShareMem();
|
||||
void printLogTestSharedMemData();
|
||||
|
||||
void setPluginMetaTestEnabled(bool b);
|
||||
bool pluginMetaTestEnabled();
|
||||
|
||||
private:
|
||||
QDialog *_tform = nullptr;
|
||||
QMenu *_tmenu = nullptr;
|
||||
|
||||
QSharedMemory *_tsharemem = nullptr;
|
||||
|
||||
bool ENABLE_META = false;
|
||||
|
||||
QHash<QString, WingHex::IWingPlugin::ScriptFnInfo> _scriptInfo;
|
||||
QList<WingHex::WingDockWidgetInfo> _winfo;
|
||||
QList<WingHex::WingRibbonToolBoxInfo> _rtbinfo;
|
||||
QHash<WingHex::SettingPage *, bool> _setpages;
|
||||
QList<QSharedPointer<WingHex::WingEditorViewWidget::Creator>> _evws;
|
||||
QList<WingHex::PluginPage *> _plgps;
|
||||
|
||||
QHash<QString, WingHex::IWingPlugin::UNSAFE_SCFNPTR> _scriptUnsafe;
|
||||
};
|
||||
|
||||
#endif // TESTPLUGIN_H
|
||||
|
|
|
@ -2,14 +2,24 @@
|
|||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
TestWingEditorViewWidget::TestWingEditorViewWidget(QWidget *parent)
|
||||
: WingHex::WingEditorViewWidget(parent) {
|
||||
QList<TestWingEditorViewWidget *> TestWingEditorViewWidget::m_instances;
|
||||
|
||||
TestWingEditorViewWidget::TestWingEditorViewWidget(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent)
|
||||
: WingHex::WingEditorViewWidget(plg, parent) {
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto lbl = new QLabel(QStringLiteral("TestWingEditorView"), this);
|
||||
lbl->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(lbl);
|
||||
m_instances << this;
|
||||
}
|
||||
|
||||
TestWingEditorViewWidget::~TestWingEditorViewWidget() {
|
||||
m_instances.removeOne(this);
|
||||
}
|
||||
|
||||
void TestWingEditorViewWidget::setEnableMeta(bool b) { m_unSaved = b; }
|
||||
|
||||
QIcon TestWingEditorViewWidget::Creator::icon() const {
|
||||
return QIcon(QStringLiteral(":/images/TestPlugin/images/btn.png"));
|
||||
}
|
||||
|
@ -22,8 +32,33 @@ QString TestWingEditorViewWidget::Creator::id() const {
|
|||
return QStringLiteral("TestWingEditorView");
|
||||
}
|
||||
|
||||
void TestWingEditorViewWidget::toggled(bool isVisible) { Q_UNUSED(isVisible); }
|
||||
void TestWingEditorViewWidget::toggled(bool isVisible) {
|
||||
plugin()->emit warn(
|
||||
__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isVisible ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
}
|
||||
|
||||
WingHex::WingEditorViewWidget *TestWingEditorViewWidget::clone() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TestWingEditorViewWidget::loadState(const QByteArray &state) {
|
||||
plugin()->emit warn(__FUNCTION__ + QStringLiteral(": ") +
|
||||
QString::fromUtf8(state));
|
||||
}
|
||||
|
||||
bool TestWingEditorViewWidget::hasUnsavedState() { return m_unSaved; }
|
||||
|
||||
QByteArray TestWingEditorViewWidget::saveState() {
|
||||
return WingHex::WINGSUMMER.toUtf8();
|
||||
}
|
||||
|
||||
void TestWingEditorViewWidget::onWorkSpaceNotify(bool isWorkSpace) {
|
||||
plugin()->emit warn(
|
||||
__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isWorkSpace ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
}
|
||||
|
||||
QList<TestWingEditorViewWidget *> TestWingEditorViewWidget::instances() {
|
||||
return m_instances;
|
||||
}
|
||||
|
|
|
@ -19,22 +19,37 @@ public:
|
|||
virtual QString id() const override;
|
||||
|
||||
public:
|
||||
virtual WingEditorViewWidget *create(QWidget *parent) const override {
|
||||
return new TestWingEditorViewWidget(parent);
|
||||
virtual WingEditorViewWidget *create(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent) const override {
|
||||
return new TestWingEditorViewWidget(plg, parent);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
explicit TestWingEditorViewWidget(QWidget *parent = nullptr);
|
||||
explicit TestWingEditorViewWidget(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent = nullptr);
|
||||
virtual ~TestWingEditorViewWidget();
|
||||
|
||||
void setEnableMeta(bool b);
|
||||
|
||||
// WingEditorViewWidget interface
|
||||
static QList<TestWingEditorViewWidget *> instances();
|
||||
|
||||
public slots:
|
||||
virtual void toggled(bool isVisible) override;
|
||||
virtual WingHex::WingEditorViewWidget *clone() override;
|
||||
|
||||
virtual void loadState(const QByteArray &state) override;
|
||||
virtual bool hasUnsavedState() override;
|
||||
virtual QByteArray saveState() override;
|
||||
|
||||
virtual void onWorkSpaceNotify(bool isWorkSpace) override;
|
||||
|
||||
private:
|
||||
QLabel *_lbl = nullptr;
|
||||
|
||||
bool m_unSaved = false;
|
||||
static QList<TestWingEditorViewWidget *> m_instances;
|
||||
};
|
||||
|
||||
#endif // TESTWINGEDITORVIEWWIDGET_H
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 354 B |
Binary file not shown.
Before Width: | Height: | Size: 352 B |
Binary file not shown.
Before Width: | Height: | Size: 327 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue