fix compilation error (#1600)

This commit is contained in:
Le Tan 2020-12-16 06:29:28 -08:00 committed by GitHub
parent f3b3fb4acd
commit 4496c441fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 45 additions and 30 deletions

@ -1 +1 @@
Subproject commit 86cf8e0e6d840b923dc30046d12ab3c6e634f6b9
Subproject commit 1cb2cde9c95d6e93d089a98f8522547f76eb4661

View File

@ -83,9 +83,10 @@ void ClipboardData::fromJson(const QJsonObject &p_jobj)
return;
}
for (const auto &item : p_jobj[c_data].toArray()) {
const auto itemArr = p_jobj[c_data].toArray();
for (size_t i = 0; i < itemArr.size(); ++i) {
auto dataItem = createClipboardDataItem(m_action);
dataItem->fromJson(item.toObject());
dataItem->fromJson(itemArr[i].toObject());
m_data.push_back(dataItem);
}
}

View File

@ -10,14 +10,14 @@ namespace vnotex
{
typedef quint64 ID;
static QPair<bool, ID> stringToID(const QString &p_str)
inline QPair<bool, ID> stringToID(const QString &p_str)
{
bool ok;
ID id = p_str.toULongLong(&ok);
return qMakePair(ok, id);
}
static QString IDToString(ID p_id)
inline QString IDToString(ID p_id)
{
return QString::number(p_id);
}
@ -42,7 +42,8 @@ namespace vnotex
enum { CONTENTS_MARGIN = 2 };
static QString QJsonObjectToString(const QJsonObject &p_obj) {
inline QString QJsonObjectToString(const QJsonObject &p_obj)
{
QString str = "{";
auto keys = p_obj.keys();
@ -54,7 +55,7 @@ namespace vnotex
return str;
}
static QDebug operator<<(QDebug p_debug, const QJsonObject &p_obj)
inline QDebug operator<<(QDebug p_debug, const QJsonObject &p_obj)
{
QDebugStateSaver saver(p_debug);
p_debug << QJsonObjectToString(p_obj);

View File

@ -16,12 +16,12 @@ Node::Node(Type p_type,
const QDateTime &p_createdTimeUtc,
Notebook *p_notebook,
Node *p_parent)
: m_type(p_type),
: m_notebook(p_notebook),
m_type(p_type),
m_id(p_id),
m_name(p_name),
m_createdTimeUtc(p_createdTimeUtc),
m_loaded(true),
m_notebook(p_notebook),
m_parent(p_parent)
{
if (m_notebook) {
@ -34,9 +34,9 @@ Node::Node(Type p_type,
const QString &p_name,
Notebook *p_notebook,
Node *p_parent)
: m_type(p_type),
: m_notebook(p_notebook),
m_type(p_type),
m_name(p_name),
m_notebook(p_notebook),
m_parent(p_parent)
{
if (m_notebook) {

View File

@ -174,4 +174,8 @@ void NodeContentMediaUtils::fixMarkdownLinks(const QString &p_srcFolderPath,
const QString &p_destFolderPath)
{
// TODO.
Q_UNUSED(p_srcFolderPath);
Q_UNUSED(p_backend);
Q_UNUSED(p_destFilePath);
Q_UNUSED(p_destFolderPath);
}

View File

@ -71,8 +71,8 @@ void VXNotebookConfigMgr::NodeFileConfig::fromJson(const QJsonObject &p_jobj)
{
auto arr = p_jobj[NodeConfig::c_tags].toArray();
for (const auto &tag : arr) {
m_tags << tag.toString();
for (size_t i = 0; i < arr.size(); ++i) {
m_tags << arr[i].toString();
}
}
}

View File

@ -20,14 +20,14 @@ namespace vnotex
m_styles.clear();
auto stylesArray = p_obj[QStringLiteral("styles")].toArray();
for (const auto &ele : stylesArray) {
m_styles << ele.toString();
for (size_t i = 0; i < stylesArray.size(); ++i) {
m_styles << stylesArray[i].toString();
}
m_scripts.clear();
auto scriptsArray = p_obj[QStringLiteral("scripts")].toArray();
for (const auto &ele : scriptsArray) {
m_scripts << ele.toString();
for (size_t i = 0; i < scriptsArray.size(); ++i) {
m_scripts << scriptsArray[i].toString();
}
}

View File

@ -203,7 +203,7 @@ void ImageInsertDialog::browseFile()
QString filePath = QFileDialog::getOpenFileName(this,
tr("Select Image To Insert"),
bpath,
tr("Images (*.png *.xpm *.jpg *.bmp *.gif *.svg);;All (*.*)"));
tr("Images (*.png *.xpm *.jpg *.bmp *.gif *.svg *.webp);;All (*.*)"));
if (filePath.isEmpty()) {
return;
}

View File

@ -65,8 +65,8 @@ void LegacyNotebookUtils::removeFolderConfigFile(const QString &p_folderPath)
void LegacyNotebookUtils::forEachFolder(const QJsonObject &p_config, std::function<void(const QString &p_name)> p_func)
{
auto folderArray = p_config.value(QStringLiteral("sub_directories")).toArray();
for (const auto &folder : folderArray) {
const auto name = folder.toObject().value(QStringLiteral("name")).toString();
for (size_t i = 0; i < folderArray.size(); ++i) {
const auto name = folderArray[i].toObject().value(QStringLiteral("name")).toString();
p_func(name);
}
}
@ -74,8 +74,8 @@ void LegacyNotebookUtils::forEachFolder(const QJsonObject &p_config, std::functi
void LegacyNotebookUtils::forEachFile(const QJsonObject &p_config, std::function<void(const LegacyNotebookUtils::FileInfo &p_info)> p_func)
{
auto fileArray = p_config.value(QStringLiteral("files")).toArray();
for (const auto &file : fileArray) {
const auto obj = file.toObject();
for (size_t i = 0; i < fileArray.size(); ++i) {
const auto obj = fileArray[i].toObject();
FileInfo info;
info.m_name = obj.value(QStringLiteral("name")).toString();
{
@ -89,8 +89,8 @@ void LegacyNotebookUtils::forEachFile(const QJsonObject &p_config, std::function
info.m_attachmentFolder = obj.value(QStringLiteral("attachment_folder")).toString();
{
auto arr = obj.value(QStringLiteral("tags")).toArray();
for (const auto &tag : arr) {
info.m_tags << tag.toString();
for (size_t i = 0; i < arr.size(); ++i) {
info.m_tags << arr[i].toString();
}
}
p_func(info);

View File

@ -60,7 +60,7 @@ MarkdownViewer::MarkdownViewer(MarkdownViewerAdapter *p_adapter,
});
connect(m_adapter, &MarkdownViewerAdapter::crossCopyReady,
this, [this](quint64 p_id, quint64 p_timeStamp, const QString &p_html) {
this, [](quint64 p_id, quint64 p_timeStamp, const QString &p_html) {
Q_UNUSED(p_id);
Q_UNUSED(p_timeStamp);
std::unique_ptr<QMimeData> mimeData(new QMimeData());

View File

@ -236,7 +236,7 @@ void PreviewHelper::handleGraphPreviewData(const MarkdownViewerAdapter::PreviewD
if (p_data.m_timeStamp != m_codeBlockTimeStamp) {
return;
}
if (p_data.m_id >= m_codeBlocksData.size() || p_data.m_data.isEmpty()) {
if (p_data.m_id >= static_cast<quint64>(m_codeBlocksData.size()) || p_data.m_data.isEmpty()) {
updateEditorInplacePreviewCodeBlock();
return;
}
@ -384,7 +384,7 @@ void PreviewHelper::handleMathPreviewData(const MarkdownViewerAdapter::PreviewDa
if (p_data.m_timeStamp != m_mathBlockTimeStamp) {
return;
}
if (p_data.m_id >= m_mathBlocksData.size() || p_data.m_data.isEmpty()) {
if (p_data.m_id >= static_cast<quint64>(m_mathBlocksData.size()) || p_data.m_data.isEmpty()) {
updateEditorInplacePreviewMathBlock();
return;
}

View File

@ -123,7 +123,6 @@ bool NavigationModeMgr::eventFilter(QObject *p_obj, QEvent *p_event)
bool NavigationModeMgr::handleKeyPress(QKeyEvent *p_event)
{
int key = p_event->key();
auto modifiers = p_event->modifiers();
if (WidgetUtils::isMetaKey(key)) {
return false;

View File

@ -82,8 +82,8 @@ void TitleBar::setupActionButtons(TitleBar::Actions p_actionFlags)
if (p_actionFlags & Action::Settings) {
auto btn = newActionButton("settings.svg", tr("Settings"), this);
connect(btn, &QToolButton::triggered,
this, [this]() {
this, []() {
// TODO.
});
m_actionButtons.push_back(btn);
}

View File

@ -928,18 +928,28 @@ bool ViewWindow::findAndReplaceWidgetVisible() const
void ViewWindow::handleFindTextChanged(const QString &p_text, FindOptions p_options)
{
Q_UNUSED(p_text);
Q_UNUSED(p_options);
}
void ViewWindow::handleFindNext(const QString &p_text, FindOptions p_options)
{
Q_UNUSED(p_text);
Q_UNUSED(p_options);
}
void ViewWindow::handleReplace(const QString &p_text, FindOptions p_options, const QString &p_replaceText)
{
Q_UNUSED(p_text);
Q_UNUSED(p_options);
Q_UNUSED(p_replaceText);
}
void ViewWindow::handleReplaceAll(const QString &p_text, FindOptions p_options, const QString &p_replaceText)
{
Q_UNUSED(p_text);
Q_UNUSED(p_options);
Q_UNUSED(p_replaceText);
}
void ViewWindow::handleFindAndReplaceWidgetClosed()