Compare commits

...

14 Commits

Author SHA1 Message Date
Le Tan
856d2597df release v3.19.2 2025-05-15 20:23:24 +08:00
Le Tan
44a0d75996 theme: fix toolbar expansion button style 2025-05-14 15:16:55 +08:00
Le Tan
62f6b7f3c5 theme: support hot-reload via --watch-themes cmd option 2025-05-13 22:10:00 +08:00
Le Tan
6150d327da fix macos build 2025-05-13 19:07:52 +08:00
Le Tan
522ccfecc4
fix macos deployment (#2610) 2025-05-11 19:56:24 +08:00
Le
4788ae4ccf add icons for macOS store 2025-04-24 23:17:19 +08:00
Le Tan
c3191e8f88 add privacy policy 2025-04-23 20:21:16 +08:00
Le Tan
4952c88b2e fix readme 2025-04-23 19:35:35 +08:00
Le Tan
ebd4489adf update welcome doc 2025-04-23 19:14:01 +08:00
Le Tan
d9aee037ad
code sign and notarization on macOS(#2605) 2025-04-23 15:27:13 +08:00
Le Tan
87e87619fb release v3.19.1 2025-04-17 09:48:02 +08:00
Le Tan
8494a714cd
fix button popup (#2603) 2025-04-16 22:29:56 +08:00
goodl3000
3ec78f4c36 !1 fix popup windows
* fix popup windows
2025-04-16 13:33:06 +00:00
Le Tan
a27485c021 add gitee project 2025-04-15 21:04:08 +08:00
55 changed files with 401 additions and 123 deletions

View File

@ -16,7 +16,7 @@ on:
default: false
env:
VNOTE_VER: 3.19.0
VNOTE_VER: 3.19.2
CMAKE_VER: 3.24.3
jobs:
@ -64,7 +64,7 @@ jobs:
id: cache-qt
uses: actions/cache@v4
with:
path: ../Qt
path: ${{runner.workspace}}/Qt
key: ${{ runner.os }}-QtCache-6.8
- name: Install Qt

View File

@ -16,11 +16,12 @@ on:
default: false
env:
VNOTE_VER: 3.19.0
VNOTE_VER: 3.19.2
CMAKE_VER: 3.24.3
jobs:
build:
environment: Mac-code-sign
name: Build On MacOS
timeout-minutes: 120
@ -83,7 +84,7 @@ jobs:
id: cache-qt
uses: actions/cache@v4
with:
path: ../Qt
path: ${{runner.workspace}}/Qt
key: ${{ runner.os }}-QtCache-6.8
- name: Install Qt
@ -107,18 +108,101 @@ jobs:
- name: Build Project
run: |
# Keep only required SQL drivers
rm ${{env.Qt6_DIR}}/plugins/sqldrivers/libqsqlmimer.dylib
rm ${{env.Qt6_DIR}}/plugins/sqldrivers/libqsqlodbc.dylib
rm ${{env.Qt6_DIR}}/plugins/sqldrivers/libqsqlpsql.dylib
# Build the project
cmake --build . --target pack
ls -ls .
ls -ls src
mv src/VNote.dmg VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
# Fix Qt frameworks
python3 ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py ./src/VNote.app/Contents/MacOS/VNote ${{env.Qt6_DIR}}/../..
# Only delete rpaths that exist to avoid errors
for rpath in $(otool -l ./src/VNote.app/Contents/MacOS/VNote | awk '/LC_RPATH/ {getline; getline; print $2}' | grep 'vnote'); do
echo "Checking rpath: $rpath"
if otool -l ./src/VNote.app/Contents/MacOS/VNote | grep -q "$rpath"; then
echo "Deleting rpath: $rpath"
install_name_tool -delete_rpath "$rpath" ./src/VNote.app/Contents/MacOS/VNote
else
echo "Rpath not found: $rpath"
fi
done
for rpath in $(otool -l ./src/VNote.app/Contents/Frameworks/libVTextEdit.dylib | awk '/LC_RPATH/ {getline; getline; print $2}' | grep 'vnote'); do
echo "Checking rpath: $rpath"
if otool -l ./src/VNote.app/Contents/Frameworks/libVTextEdit.dylib | grep -q "$rpath"; then
echo "Deleting rpath: $rpath"
install_name_tool -delete_rpath "$rpath" ./src/VNote.app/Contents/Frameworks/libVTextEdit.dylib
else
echo "Rpath not found: $rpath"
fi
done
# Run macdeployqtfix again to ensure all dependencies are properly fixed
python3 ${{runner.workspace}}/macdeployqtfix/macdeployqtfix.py ./src/VNote.app/Contents/MacOS/VNote ${{env.Qt6_DIR}}/../..
working-directory: ${{runner.workspace}}/build
- name: Codesign Bundle
# Extract the secrets we defined earlier as environment variables
env:
MACOS_CERTIFICATE: ${{ secrets.CLI_MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.CLI_MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.CLI_MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.CLI_MACOS_CERTIFICATE }}
run: |
# Turn our base64-encoded certificate back to a regular .p12 file
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
# We need to create a new keychain, otherwise using the certificate will prompt
# with a UI dialog asking for the certificate password, which we can't
# use in a headless CI environment
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
echo "Codesigning main app bundle"
codesign --force --deep -s "$MACOS_CERTIFICATE_NAME" --entitlements ${{github.workspace}}/package/entitlements.xml --options runtime ./src/VNote.app
codesign -v -vvv ./src/VNote.app
hdiutil create -volname "VNote" -srcfolder ./src/VNote.app -ov -format UDZO VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
codesign --force --deep -s "$MACOS_CERTIFICATE_NAME" --entitlements ${{github.workspace}}/package/entitlements.xml --options runtime ./VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
codesign -v -vvv ./VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg
working-directory: ${{runner.workspace}}/build
- name: "Notarize Bundle"
# Extract the secrets we defined earlier as environment variables
env:
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.CLI_MACOS_NOTARY_USER }}
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.CLI_MACOS_TEAM_ID }}
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.CLI_MACOS_NOTARY_PWD }}
run: |
# Store the notarization credentials so that we can prevent a UI password dialog
# from blocking the CI
echo "Create keychain profile"
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
# Here we send the notarization request to the Apple's Notarization service, waiting for the result.
# This typically takes a few seconds inside a CI environment, but it might take more depending on the App
# characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
# you're curious
echo "Notarize app"
xcrun notarytool submit "${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg" --keychain-profile "notarytool-profile" --wait
# Finally, we need to "attach the staple" to our executable, which will allow our app to be
# validated by macOS even when an internet connection is not available.
echo "Attach staple"
xcrun stapler staple "${{runner.workspace}}/build/VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}.dmg"
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Archive Artifacts
- name: Archive DMG
uses: actions/upload-artifact@v4
with:
name: VNote-${{env.VNOTE_VER}}-mac-${{matrix.config.arch}}

View File

@ -16,7 +16,7 @@ on:
default: false
env:
VNOTE_VER: 3.19.0
VNOTE_VER: 3.19.2
jobs:
build:
@ -64,7 +64,7 @@ jobs:
id: cache-qt
uses: actions/cache@v4
with:
path: ../Qt
path: ${{runner.workspace}}/Qt
key: ${{runner.os}}-${{matrix.config.arch}}-QtCache-${{matrix.config.qt}}
- name: Install Qt Official Build

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
*.pro.user.*
.ccls
compile_commands.json
compile_commands.json.*
compile_flags.txt
.cache
.tasks

View File

@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.20)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.1" CACHE STRING "Minimum OS X deployment version")
project(VNote
VERSION 3.19.0
VERSION 3.19.2
DESCRIPTION "A pleasant note-taking platform"
HOMEPAGE_URL "https://app.vnote.fun"
LANGUAGES C CXX)

View File

@ -3,9 +3,11 @@
[简体中文](README_zh_CN.md)
[Project on Gitee](https://gitee.com/vnotex/vnote)
A pleasant note-taking platform.
For more information, please visit [**VNote's Home Page**](https://vnotex.github.io/vnote) or [Home Page on Gitee](https://tamlok.gitee.io/vnote).
For more information, please visit [**VNote's Home Page**](https://vnotex.github.io/vnote).
![VNote](pics/vnote.png)
@ -26,7 +28,7 @@ Continuous builds on `master` branch could be found at the [Continuous Build](ht
Latest stable builds could be found at the [latest release](https://github.com/vnotex/vnote/releases/latest). Alternative download services are available:
* [Tianyi Netdisk](https://cloud.189.cn/t/Av67NvmEJVBv)
* [Baidu Netdisk](https://pan.baidu.com/s/1Fou1flmBsQUQ8Qs9V_M6Aw) with the code `note`
* [Baidu Netdisk](https://pan.baidu.com/s/1lX69oMBw8XuJshQDN3HiHw?pwd=f8fk)
## Supports
* [GitHub Issues](https://github.com/vnotex/vnote/issues);

View File

@ -3,9 +3,11 @@
[English](README.md)
[Gitee托管项目](https://gitee.com/vnotex/vnote)
一个舒适的笔记平台!
更多信息,请访问[VNote主页](https://vnotex.github.io/vnote)或者[由Gitee托管的主页](https://tamlok.gitee.io/vnote)
更多信息,请访问[VNote主页](https://vnotex.github.io/vnote)。
![VNote](pics/vnote.png)
@ -26,7 +28,7 @@ VNote不是一个简单的Markdown编辑器。通过提供强大的笔记管理
最新的[稳定版本发布](https://github.com/vnotex/vnote/releases/latest)。其他下载选项:
* [天翼云盘](https://cloud.189.cn/t/Av67NvmEJVBv)
* [百度云盘](https://pan.baidu.com/s/1Fou1flmBsQUQ8Qs9V_M6Aw) 提取码`note`
* [百度云盘](https://pan.baidu.com/s/1lX69oMBw8XuJshQDN3HiHw?pwd=f8fk)
## 支持
* [GitHub Issues](https://github.com/vnotex/vnote/issues)

View File

@ -1,4 +1,12 @@
# Changes
## v3.19.2
* Codesign MacOS Bundle
* Fix toolbar expansion button style
* Support hot-reloading of theme via --watch-themes option
## v3.19.1
* Fix toolbar button in Qt 6.8
## v3.19.0
* Add VSCode-sytle editor shortcuts

@ -1 +1 @@
Subproject commit aaf3b097ac3ae0eed7324efae6ddce23a0130402
Subproject commit 50b1421793af3882ddc62ad4e6cf5537e1d7906f

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>

24
package/entitlements.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>

26
privacy_policy.md Normal file
View File

@ -0,0 +1,26 @@
# Privacy Policy
## Introduction
Welcome to VNote! We value your privacy and are committed to protecting your personal information. This Privacy Policy explains how we handle your information when you use our application.
## Information We Collect
VNote does not collect any personal or usage data from its users. Your interactions with the app remain private and are not stored or shared.
## How We Use Your Information
Since VNote does not collect any user data, we do not use, store, or process any personal information.
## Sharing Your Information
As VNote does not collect any user data, we do not share any personal information with third parties.
## Security
While VNote does not collect any user data, we still implement security measures to ensure the integrity and safety of the application itself.
## Your Choices
Since no data is collected, there are no choices or actions required from users regarding their personal information.
## Children's Privacy
Our services are not intended for children under the age of 13. We do not knowingly collect personal information from children under 13.
## Changes to This Privacy Policy
We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on our app. You are advised to review this Privacy Policy periodically for any changes.

View File

@ -139,7 +139,7 @@ elseif(APPLE)
OUTPUT_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_INFO_STRING "${PROJECT_DESCRIPTION}"
MACOSX_BUNDLE_GUI_IDENTIFIER "fun.vnote.app"
MACOSX_BUNDLE_GUI_IDENTIFIER "fun.vnote.vnote"
MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"

View File

@ -1,7 +1,6 @@
execute_process(COMMAND "optool" strip -t ${CMAKE_CURRENT_BINARY_DIR}/VNote.app
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}
)
execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/VNote.app -dmg
-always-overwrite -verbose=1
execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/VNote.app -always-overwrite -verbose=1
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}
)

View File

@ -2,6 +2,11 @@
#include <QFileOpenEvent>
#include <QDebug>
#include <QDir>
#include <QStyle>
#include <QFileSystemWatcher>
#include <QTimer>
#include <core/vnotex.h>
using namespace vnotex;
@ -10,6 +15,53 @@ Application::Application(int &p_argc, char **p_argv)
{
}
void Application::watchThemeFolder(const QString &p_themeFolderPath)
{
if (p_themeFolderPath.isEmpty()) {
return;
}
// Initialize watchers only when needed
if (!m_styleWatcher) {
m_styleWatcher = new QFileSystemWatcher(this);
}
if (!m_reloadTimer) {
m_reloadTimer = new QTimer(this);
m_reloadTimer->setSingleShot(true);
m_reloadTimer->setInterval(500); // 500ms debounce delay
connect(m_reloadTimer, &QTimer::timeout,
this, &Application::reloadThemeResources);
// Connect file watcher to timer
connect(m_styleWatcher, &QFileSystemWatcher::directoryChanged,
m_reloadTimer, qOverload<>(&QTimer::start));
connect(m_styleWatcher, &QFileSystemWatcher::fileChanged,
m_reloadTimer, qOverload<>(&QTimer::start));
}
// Watch the theme folder and its files
m_styleWatcher->addPath(p_themeFolderPath);
// Also watch individual files in the theme folder
QDir themeDir(p_themeFolderPath);
QStringList files = themeDir.entryList(QDir::Files);
for (const QString &file : files) {
m_styleWatcher->addPath(themeDir.filePath(file));
}
}
void Application::reloadThemeResources()
{
VNoteX::getInst().getThemeMgr().refreshCurrentTheme();
auto stylesheet = VNoteX::getInst().getThemeMgr().fetchQtStyleSheet();
if (!stylesheet.isEmpty()) {
setStyleSheet(stylesheet);
style()->unpolish(this);
style()->polish(this);
}
}
bool Application::event(QEvent *p_event)
{
// On macOS, we need this to open file from Finder.

View File

@ -1,8 +1,10 @@
#ifndef APPLICATION_H
#define APPLICATION_H
#include <QApplication>
class QFileSystemWatcher;
class QTimer;
namespace vnotex
{
class Application : public QApplication
@ -11,11 +13,21 @@ namespace vnotex
public:
Application(int &p_argc, char **p_argv);
// Set up theme folder watcher for hot-reload
void watchThemeFolder(const QString &p_themeFolderPath);
// Reload the theme resources (stylesheet, icons, etc)
void reloadThemeResources();
signals:
void openFileRequested(const QString &p_filePath);
protected:
bool event(QEvent *p_event) Q_DECL_OVERRIDE;
private:
QFileSystemWatcher *m_styleWatcher = nullptr;
QTimer *m_reloadTimer = nullptr;
};
}

View File

@ -25,6 +25,9 @@ CommandLineOptions::ParseResult CommandLineOptions::parse(const QStringList &p_a
const QCommandLineOption logStderrOpt("log-stderr", MainWindow::tr("Log to stderr."));
parser.addOption(logStderrOpt);
const QCommandLineOption watchThemesOpt("watch-themes", MainWindow::tr("Watch theme folder for changes."));
parser.addOption(watchThemesOpt);
// WebEngine options.
// No need to handle them. Just add them to the parser to avoid parse error.
{
@ -70,5 +73,9 @@ CommandLineOptions::ParseResult CommandLineOptions::parse(const QStringList &p_a
m_logToStderr = true;
}
if (parser.isSet(watchThemesOpt)) {
m_watchThemes = true;
}
return ParseResult::Ok;
}

View File

@ -27,6 +27,9 @@ public:
bool m_verbose = false;
bool m_logToStderr = false;
// Whether to watch theme folder for changes
bool m_watchThemes = false;
};
#endif // COMMANDLINEOPTIONS_H

View File

@ -24,6 +24,11 @@ Theme::Theme(const QString &p_themeFolderPath,
{
}
QString vnotex::Theme::getThemeFolder() const
{
return m_themeFolderPath;
}
bool Theme::isValidThemeFolder(const QString &p_folder)
{
QDir dir(p_folder);

View File

@ -47,6 +47,8 @@ namespace vnotex
QString name() const;
QString getThemeFolder() const;
static bool isValidThemeFolder(const QString &p_folder);
static Theme *fromFolder(const QString &p_folder);

View File

@ -24,8 +24,6 @@ ThemeMgr::ThemeMgr(const QString &p_currentThemeName, QObject *p_parent)
loadAvailableThemes();
loadCurrentTheme(p_currentThemeName);
IconUtils::setDefaultIconForeground(paletteColor("base#icon#fg"), paletteColor("base#icon#disabled#fg"));
}
QString ThemeMgr::getIconFile(const QString &p_icon) const
@ -91,6 +89,7 @@ const Theme &ThemeMgr::getCurrentTheme() const
void ThemeMgr::loadCurrentTheme(const QString &p_themeName)
{
m_currentTheme.reset();
auto themeFolder = findThemeFolder(p_themeName);
if (themeFolder.isNull()) {
qWarning() << "failed to locate theme" << p_themeName;
@ -104,6 +103,8 @@ void ThemeMgr::loadCurrentTheme(const QString &p_themeName)
qWarning() << "fall back to default theme" << defaultTheme;
m_currentTheme.reset(loadTheme(findThemeFolder(defaultTheme)));
}
IconUtils::setDefaultIconForeground(paletteColor("base#icon#fg"), paletteColor("base#icon#disabled#fg"));
}
Theme *ThemeMgr::loadTheme(const QString &p_themeFolder)
@ -211,6 +212,14 @@ QPixmap ThemeMgr::getThemePreview(const QString &p_name) const
void ThemeMgr::refresh()
{
loadAvailableThemes();
refreshCurrentTheme();
}
void vnotex::ThemeMgr::refreshCurrentTheme()
{
if (m_currentTheme) {
loadCurrentTheme(m_currentTheme->name());
}
}
void ThemeMgr::addWebStylesSearchPath(const QString &p_path)

View File

@ -60,10 +60,11 @@ namespace vnotex
const ThemeInfo *findTheme(const QString &p_name) const;
// Refresh the themes list.
// Won't affect current theme since we do not support changing theme real time for now.
// Refresh the themes list and reload current theme.
void refresh();
void refreshCurrentTheme();
// Return all web stylesheets available, including those from themes and web styles search paths.
// <DisplayName, FilePath>.
QVector<QPair<QString, QString>> getWebStyles() const;

View File

@ -16,26 +16,28 @@
<string>public.plain-text</string>
<string>net.daringfireball.markdown</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>CFBundleName</key>
<string>VNote</string>
<key>CFBundleExecutable</key>
<string>vnote</string>
<string>VNote</string>
<key>CFBundleShortVersionString</key>
<string>3.19</string>
<key>CFBundleVersion</key>
<string>3.19.0</string>
<string>3.19.2</string>
<key>NSHumanReadableCopyright</key>
<string>Distributed under LGPL-3.0 license. Copyright (c) 2024 app.vnote.fun</string>
<string>Distributed under LGPL-3.0 license. Copyright (c) 2025 app.vnote.fun</string>
<key>CFBundleIconFile</key>
<string>vnote.icns</string>
<key>CFBundleIdentifier</key>
<string>fun.vnote.app</string>
<string>fun.vnote.vnote</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NOTE</key>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -3,7 +3,7 @@
"metadata" : {
"//comment": "When releasing new version, please go through the following configs to check if override is needed.",
"//Comment": "markdown_editor#override_viewer_resource",
"version" : "3.19.0"
"version" : "3.19.2"
},
"core" : {
"theme" : "pure",

View File

@ -1,7 +1,7 @@
# Welcome to VNote
A pleasant note-taking platform.
For more information, please visit [**VNote's Home Page**](https://vnotex.github.io/vnote) or [Home Page on Gitee](https://tamlok.gitee.io/vnote).
For more information, please visit [**VNote's Home Page**](https://vnotex.github.io/vnote).
## FAQs
* Hover the mouse over buttons to get detailed information.

View File

@ -1,7 +1,7 @@
# 欢迎使用 VNote
一个舒适的笔记平台。
更多信息,请访问[VNote主页](https://vnotex.github.io/vnote)或者[由Gitee托管的主页](https://tamlok.gitee.io/vnote)
更多信息,请访问[VNote主页](https://vnotex.github.io/vnote)。
## 常见问题
* 将鼠标悬停在按钮上可以获取详细信息。

View File

@ -349,6 +349,7 @@
<file>themes/moonlight/checkbox_unchecked.svg</file>
<file>themes/moonlight/checkbox_unchecked_disabled.svg</file>
<file>themes/moonlight/close.svg</file>
<file>themes/moonlight/expand_toolbar.svg</file>
<file>themes/moonlight/close_grey.svg</file>
<file>themes/moonlight/cover.png</file>
<file>themes/moonlight/down.svg</file>
@ -381,6 +382,7 @@
<file>themes/pure/checkbox_unchecked.svg</file>
<file>themes/pure/checkbox_unchecked_disabled.svg</file>
<file>themes/pure/close.svg</file>
<file>themes/pure/expand_toolbar.svg</file>
<file>themes/pure/close_grey.svg</file>
<file>themes/pure/cover.png</file>
<file>themes/pure/down.svg</file>
@ -413,6 +415,7 @@
<file>themes/solarized-dark/checkbox_unchecked.svg</file>
<file>themes/solarized-dark/checkbox_unchecked_disabled.svg</file>
<file>themes/solarized-dark/close.svg</file>
<file>themes/solarized-dark/expand_toolbar.svg</file>
<file>themes/solarized-dark/close_grey.svg</file>
<file>themes/solarized-dark/cover.png</file>
<file>themes/solarized-dark/down.svg</file>
@ -445,6 +448,7 @@
<file>themes/solarized-light/checkbox_unchecked.svg</file>
<file>themes/solarized-light/checkbox_unchecked_disabled.svg</file>
<file>themes/solarized-light/close.svg</file>
<file>themes/solarized-light/expand_toolbar.svg</file>
<file>themes/solarized-light/close_grey.svg</file>
<file>themes/solarized-light/cover.png</file>
<file>themes/solarized-light/down.svg</file>
@ -804,6 +808,7 @@
<file>themes/vscode-dark/checkbox_unchecked.svg</file>
<file>themes/vscode-dark/checkbox_unchecked_disabled.svg</file>
<file>themes/vscode-dark/close.svg</file>
<file>themes/vscode-dark/expand_toolbar.svg</file>
<file>themes/vscode-dark/close_grey.svg</file>
<file>themes/vscode-dark/cover.png</file>
<file>themes/vscode-dark/down.svg</file>
@ -837,6 +842,7 @@
<file>themes/vue-light/checkbox_unchecked.svg</file>
<file>themes/vue-light/checkbox_unchecked_disabled.svg</file>
<file>themes/vue-light/close.svg</file>
<file>themes/vue-light/expand_toolbar.svg</file>
<file>themes/vue-light/close_grey.svg</file>
<file>themes/vue-light/cover.png</file>
<file>themes/vue-light/down.svg</file>
@ -869,6 +875,7 @@
<file>themes/vue-dark/checkbox_unchecked.svg</file>
<file>themes/vue-dark/checkbox_unchecked_disabled.svg</file>
<file>themes/vue-dark/close.svg</file>
<file>themes/vue-dark/expand_toolbar.svg</file>
<file>themes/vue-dark/close_grey.svg</file>
<file>themes/vue-dark/cover.png</file>
<file>themes/vue-dark/down.svg</file>
@ -905,6 +912,7 @@
<file>themes/vx-idea/checkbox_unchecked.svg</file>
<file>themes/vx-idea/checkbox_unchecked_disabled.svg</file>
<file>themes/vx-idea/close.svg</file>
<file>themes/vx-idea/expand_toolbar.svg</file>
<file>themes/vx-idea/close_grey.svg</file>
<file>themes/vx-idea/cover.png</file>
<file>themes/vx-idea/down.svg</file>

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#9EA5B4"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#9EA5B4"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -147,13 +147,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#222222"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#222222"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -166,13 +166,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#9EA5B4"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#9EA5B4"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -143,13 +143,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#9EA5B4"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#9EA5B4"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -143,13 +143,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#9EA5B4"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#9EA5B4"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -143,13 +143,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#4d5765"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#4d5765"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -148,13 +148,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#222222"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#222222"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -166,13 +166,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747190112225" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2510" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M798.165333 524.501333a42.666667 42.666667 0 0 0-60.330666 0L512 750.336l-225.834667-225.834667a42.666667 42.666667 0 0 0-60.330666 60.330667l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330667z" p-id="2511" fill="#222222"></path><path d="M798.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 0L512 451.669333 286.165333 225.834667a42.666667 42.666667 0 0 0-60.330666 60.330666l256 256a42.666667 42.666667 0 0 0 60.330666 0l256-256a42.666667 42.666667 0 0 0 0-60.330666z" p-id="2512" fill="#222222"></path></svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -167,13 +167,16 @@ QToolBar::separator {
}
QToolBarExtension#qt_toolbar_ext_button {
background-color: @widgets#qtoolbar#extension#bg;
margin: 30px;
qproperty-icon: url(expand_toolbar.svg);
background-color: @widgets#qtoolbutton#bg;
}
QToolBarExtension#qt_toolbar_ext_button:hover {
background-color: @widgets#qtoolbar#extension#hover#bg;
margin: 30px;
background-color: @widgets#qtoolbutton#hover#bg;
}
QToolBarExtension#qt_toolbar_ext_button:pressed {
background-color: @widgets#qtoolbutton#pressed#bg;
}
/* QToolButton */

View File

@ -161,6 +161,11 @@ int main(int argc, char *argv[])
auto style = VNoteX::getInst().getThemeMgr().fetchQtStyleSheet();
if (!style.isEmpty()) {
app.setStyleSheet(style);
// Set up hot-reload for the theme folder if enabled via command line
if (cmdOptions.m_watchThemes) {
const auto themeFolderPath = VNoteX::getInst().getThemeMgr().getCurrentTheme().getThemeFolder();
app.watchThemeFolder(themeFolderPath);
}
}
}

View File

@ -8,6 +8,7 @@
#include <QFileDialog>
#include <QInputDialog>
#include <QTimer>
#include <QWidgetAction>
#include "propertydefs.h"
@ -28,8 +29,7 @@
using namespace vnotex;
AttachmentPopup::AttachmentPopup(QToolButton *p_btn, QWidget *p_parent)
: QMenu(p_parent),
m_button(p_btn)
: ButtonPopup(p_btn, p_parent)
{
setupUI();
@ -46,7 +46,8 @@ AttachmentPopup::AttachmentPopup(QToolButton *p_btn, QWidget *p_parent)
void AttachmentPopup::setupUI()
{
auto mainLayout = new QVBoxLayout(this);
QWidget *widget = new QWidget{};
auto mainLayout = new QVBoxLayout(widget);
const auto &themeMgr = VNoteX::getInst().getThemeMgr();
@ -66,7 +67,7 @@ void AttachmentPopup::setupUI()
const auto destFolderPath = getDestFolderPath();
auto &sessionConfig = ConfigMgr::getInst().getSessionConfig();
auto files = QFileDialog::getOpenFileNames(this,
auto files = QFileDialog::getOpenFileNames(nullptr,
tr("Select Files As Attachments"),
sessionConfig.getExternalMediaDefaultPath());
if (files.isEmpty()) {
@ -202,7 +203,9 @@ void AttachmentPopup::setupUI()
});
mainLayout->addWidget(m_viewer);
setMinimumSize(320, 384);
widget->setMinimumSize(320, 384);
addWidget(widget);
}
QToolButton *AttachmentPopup::createButton()

View File

@ -1,16 +1,14 @@
#ifndef ATTACHMENTPOPUP_H
#define ATTACHMENTPOPUP_H
#include <QMenu>
class QToolButton;
#include "buttonpopup.h"
namespace vnotex
{
class FileSystemViewer;
class Buffer;
class AttachmentPopup : public QMenu
class AttachmentPopup : public ButtonPopup
{
Q_OBJECT
public:
@ -43,9 +41,6 @@ namespace vnotex
FileSystemViewer *m_viewer = nullptr;
bool m_needUpdateAttachmentFolder = true;
// Button for this menu.
QToolButton *m_button = nullptr;
};
}

View File

@ -1,6 +1,6 @@
#include "buttonpopup.h"
#include <QVBoxLayout>
#include <QWidgetAction>
#include <utils/widgetutils.h>
@ -10,8 +10,6 @@ ButtonPopup::ButtonPopup(QToolButton *p_btn, QWidget *p_parent)
: QMenu(p_parent),
m_button(p_btn)
{
setupUI();
#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
// Qt::Popup on macOS does not work well with input method.
setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint);
@ -19,16 +17,10 @@ ButtonPopup::ButtonPopup(QToolButton *p_btn, QWidget *p_parent)
#endif
}
void ButtonPopup::setupUI()
void ButtonPopup::addWidget(QWidget *p_widget)
{
auto mainLayout = new QVBoxLayout(this);
WidgetUtils::setContentsMargins(mainLayout);
}
void ButtonPopup::setCentralWidget(QWidget *p_widget)
{
Q_ASSERT(p_widget);
auto mainLayout = layout();
Q_ASSERT(mainLayout->count() == 0);
mainLayout->addWidget(p_widget);
auto act = new QWidgetAction(this);
// @act will own @p_widget.
act->setDefaultWidget(p_widget);
addAction(act);
}

View File

@ -15,10 +15,7 @@ namespace vnotex
ButtonPopup(QToolButton *p_btn, QWidget *p_parent = nullptr);
protected:
void setCentralWidget(QWidget *p_widget);
private:
void setupUI();
void addWidget(QWidget *p_widget);
// Button for this menu.
QToolButton *m_button = nullptr;

View File

@ -1,6 +1,5 @@
#include "outlinepopup.h"
#include <QVBoxLayout>
#include <QToolButton>
#include <core/global.h>
@ -10,8 +9,7 @@
using namespace vnotex;
OutlinePopup::OutlinePopup(QToolButton *p_btn, QWidget *p_parent)
: QMenu(p_parent),
m_button(p_btn)
: ButtonPopup(p_btn, p_parent)
{
setupUI();
@ -23,13 +21,9 @@ OutlinePopup::OutlinePopup(QToolButton *p_btn, QWidget *p_parent)
void OutlinePopup::setupUI()
{
auto mainLayout = new QVBoxLayout(this);
WidgetUtils::setContentsMargins(mainLayout);
m_viewer = new OutlineViewer(tr("Outline"), this);
mainLayout->addWidget(m_viewer);
setMinimumSize(320, 384);
m_viewer->setMinimumSize(320, 384);
addWidget(m_viewer);
}
void OutlinePopup::setOutlineProvider(const QSharedPointer<OutlineProvider> &p_provider)
@ -39,7 +33,7 @@ void OutlinePopup::setOutlineProvider(const QSharedPointer<OutlineProvider> &p_p
void OutlinePopup::showEvent(QShowEvent* p_event)
{
QMenu::showEvent(p_event);
ButtonPopup::showEvent(p_event);
// Move it to be right-aligned.
if (m_button->isVisible()) {

View File

@ -1,7 +1,8 @@
#ifndef OUTLINEPOPUP_H
#define OUTLINEPOPUP_H
#include <QMenu>
#include "buttonpopup.h"
#include <QSharedPointer>
class QToolButton;
@ -11,7 +12,7 @@ namespace vnotex
class OutlineProvider;
class OutlineViewer;
class OutlinePopup : public QMenu
class OutlinePopup : public ButtonPopup
{
Q_OBJECT
public:
@ -27,9 +28,6 @@ namespace vnotex
// Managed by QObject.
OutlineViewer *m_viewer = nullptr;
// Button with this menu.
QToolButton *m_button = nullptr;
};
}

View File

@ -1,8 +1,5 @@
#include "tagpopup.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <utils/widgetutils.h>
#include <buffer/buffer.h>
@ -30,9 +27,8 @@ TagPopup::TagPopup(QToolButton *p_btn, QWidget *p_parent)
void TagPopup::setupUI()
{
m_tagViewer = new TagViewer(true, this);
setCentralWidget(m_tagViewer);
setMinimumSize(256, 320);
m_tagViewer->setMinimumSize(256, 320);
addWidget(m_tagViewer);
}
void TagPopup::setBuffer(Buffer *p_buffer)

View File

@ -70,11 +70,6 @@ void WordCountPopup::updateCount(const ViewWindow::WordCountInfo &p_info)
void WordCountPopup::setupUI()
{
QWidget *mainWidget = new QWidget(this);
setCentralWidget(mainWidget);
auto mainLayout = new QVBoxLayout(mainWidget);
m_panel = new WordCountPanel(mainWidget);
mainLayout->addWidget(m_panel);
m_panel = new WordCountPanel(this);
addWidget(m_panel);
}