mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
more fixes
This commit is contained in:
parent
9a3c69870c
commit
21893fdff8
@ -1 +1 @@
|
||||
Subproject commit 5c52cfe2b211b021773d9e3c9559e5358a312381
|
||||
Subproject commit e6591f8bda53ecbdbac8d7aae4be80aa6f198017
|
@ -246,6 +246,7 @@ QJsonObject SessionConfig::saveStateAndGeometry() const
|
||||
writeStringList(obj, QStringLiteral("visible_docks_before_expand"), m_mainWindowStateGeometry.m_visibleDocksBeforeExpand);
|
||||
writeByteArray(obj, QStringLiteral("tag_explorer_state"), m_mainWindowStateGeometry.m_tagExplorerState);
|
||||
writeByteArray(obj, QStringLiteral("notebook_explorer_state"), m_mainWindowStateGeometry.m_notebookExplorerState);
|
||||
writeByteArray(obj, QStringLiteral("location_list_state"), m_mainWindowStateGeometry.m_locationListState);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -378,6 +379,7 @@ void SessionConfig::loadStateAndGeometry(const QJsonObject &p_session)
|
||||
m_mainWindowStateGeometry.m_visibleDocksBeforeExpand = readStringList(obj, QStringLiteral("visible_docks_before_expand"));
|
||||
m_mainWindowStateGeometry.m_tagExplorerState = readByteArray(obj, QStringLiteral("tag_explorer_state"));
|
||||
m_mainWindowStateGeometry.m_notebookExplorerState = readByteArray(obj, QStringLiteral("notebook_explorer_state"));
|
||||
m_mainWindowStateGeometry.m_locationListState = readByteArray(obj, QStringLiteral("location_list_state"));
|
||||
}
|
||||
|
||||
QByteArray SessionConfig::getViewAreaSessionAndClear()
|
||||
|
@ -38,7 +38,8 @@ namespace vnotex
|
||||
&& m_mainGeometry == p_other.m_mainGeometry
|
||||
&& m_visibleDocksBeforeExpand == p_other.m_visibleDocksBeforeExpand
|
||||
&& m_tagExplorerState == p_other.m_tagExplorerState
|
||||
&& m_notebookExplorerState == p_other.m_notebookExplorerState;
|
||||
&& m_notebookExplorerState == p_other.m_notebookExplorerState
|
||||
&& m_locationListState == p_other.m_locationListState;
|
||||
}
|
||||
|
||||
QByteArray m_mainState;
|
||||
@ -50,6 +51,8 @@ namespace vnotex
|
||||
QByteArray m_tagExplorerState;
|
||||
|
||||
QByteArray m_notebookExplorerState;
|
||||
|
||||
QByteArray m_locationListState;
|
||||
};
|
||||
|
||||
enum OpenGL
|
||||
|
@ -489,7 +489,7 @@
|
||||
"//comment" : "Whether close the file before opening it with external program",
|
||||
"node_explorer_close_before_open_with_enabled" : true,
|
||||
"//comment" : "0 - combined/1 - separate_single/2 - separate_double",
|
||||
"node_explorer_explore_mode" : 1,
|
||||
"node_explorer_explore_mode" : 0,
|
||||
"search_panel_advanced_settings_visible" : true,
|
||||
"//comment" : "Docks to ignore when expanding content area of main window",
|
||||
"main_window_keep_docks_expanding_content_area": ["OutlineDock.vnotex"],
|
||||
|
@ -622,7 +622,7 @@ bool MarkdownEditor::processUrlFromMimeData(const QMimeData *p_source)
|
||||
if (QFileInfo::exists(text)) {
|
||||
url = QUrl::fromLocalFile(text);
|
||||
} else {
|
||||
url = QUrl::fromUserInput(text);
|
||||
url.setUrl(text);
|
||||
if (url.scheme() != QStringLiteral("https") && url.scheme() != QStringLiteral("http")) {
|
||||
url.clear();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void LocationList::setupUI()
|
||||
m_tree = new TreeWidget(TreeWidget::Flag::EnhancedStyle, this);
|
||||
// When updated, pay attention to the Columns enum.
|
||||
m_tree->setHeaderLabels(QStringList() << tr("Path") << tr("Line") << tr("Text"));
|
||||
TreeWidget::showHorizontalScrollbar(m_tree);
|
||||
m_tree->header()->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_tree->header()->setStretchLastSection(true);
|
||||
connect(m_tree, &QTreeWidget::itemActivated,
|
||||
this, [this](QTreeWidgetItem *p_item, int p_col) {
|
||||
@ -194,3 +194,13 @@ void LocationList::updateItemsCountLabel()
|
||||
m_titleBar->setInfoLabel(tr("%n Item(s)", "", cnt));
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray LocationList::saveState() const
|
||||
{
|
||||
return m_tree->header()->saveState();
|
||||
}
|
||||
|
||||
void LocationList::restoreState(const QByteArray &p_data)
|
||||
{
|
||||
m_tree->header()->restoreState(p_data);
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ namespace vnotex
|
||||
// Start a new session of the location list to set a callback for activation handling.
|
||||
void startSession(const LocationCallback &p_callback);
|
||||
|
||||
QByteArray saveState() const;
|
||||
void restoreState(const QByteArray &p_data);
|
||||
|
||||
private:
|
||||
enum Columns
|
||||
{
|
||||
|
@ -432,6 +432,7 @@ void MainWindow::saveStateAndGeometry()
|
||||
sg.m_visibleDocksBeforeExpand = m_visibleDocksBeforeExpand;
|
||||
sg.m_tagExplorerState = m_tagExplorer->saveState();
|
||||
sg.m_notebookExplorerState = m_notebookExplorer->saveState();
|
||||
sg.m_locationListState = m_locationList->saveState();
|
||||
|
||||
auto& sessionConfig = ConfigMgr::getInst().getSessionConfig();
|
||||
sessionConfig.setMainWindowStateGeometry(sg);
|
||||
@ -466,6 +467,10 @@ void MainWindow::loadStateAndGeometry(bool p_stateOnly)
|
||||
if (!sg.m_notebookExplorerState.isEmpty()) {
|
||||
m_notebookExplorer->restoreState(sg.m_notebookExplorerState);
|
||||
}
|
||||
|
||||
if (!sg.m_locationListState.isEmpty()) {
|
||||
m_locationList->restoreState(sg.m_locationListState);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::resetStateAndGeometry()
|
||||
|
@ -2312,20 +2312,7 @@ void NotebookNodeExplorer::loadMasterItemChildren(QTreeWidgetItem *p_item) const
|
||||
QString NotebookNodeExplorer::generateToolTip(const Node *p_node)
|
||||
{
|
||||
Q_ASSERT(p_node->isLoaded());
|
||||
QString tip = p_node->exists() ? p_node->getName() : (tr("[Invalid] %1").arg(p_node->getName()));
|
||||
tip += QLatin1String("\n\n");
|
||||
|
||||
if (!p_node->getTags().isEmpty()) {
|
||||
const auto &tags = p_node->getTags();
|
||||
QString tagString = tags.first();
|
||||
for (int i = 1; i < tags.size(); ++i) {
|
||||
tagString += QLatin1String("; ") + tags[i];
|
||||
}
|
||||
tip += tr("Tags: %1\n").arg(tagString);
|
||||
}
|
||||
|
||||
tip += tr("Created Time: %1\n").arg(Utils::dateTimeString(p_node->getCreatedTimeUtc().toLocalTime()));
|
||||
tip += tr("Modified Time: %1").arg(Utils::dateTimeString(p_node->getModifiedTimeUtc().toLocalTime()));
|
||||
const QString tip = p_node->exists() ? p_node->getName() : (tr("[Invalid] %1").arg(p_node->getName()));
|
||||
return tip;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user