mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
use "image" as the default image title
Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
parent
a3926631e2
commit
59611872d4
@ -6,7 +6,7 @@
|
||||
VInsertImageDialog::VInsertImageDialog(const QString &title, const QString &defaultImageTitle,
|
||||
const QString &defaultPath, QWidget *parent)
|
||||
: QDialog(parent), title(title), defaultImageTitle(defaultImageTitle), defaultPath(defaultPath),
|
||||
image(NULL), browseable(true)
|
||||
image(NULL)
|
||||
{
|
||||
setupUI();
|
||||
|
||||
@ -126,12 +126,14 @@ void VInsertImageDialog::setImage(const QImage &image)
|
||||
enableOkButton();
|
||||
}
|
||||
|
||||
void VInsertImageDialog::setBrowseable(bool browseable)
|
||||
void VInsertImageDialog::setBrowseable(bool browseable, bool visible)
|
||||
{
|
||||
this->browseable = browseable;
|
||||
pathLabel->setVisible(browseable);
|
||||
pathEdit->setVisible(browseable);
|
||||
browseBtn->setVisible(browseable);
|
||||
pathEdit->setReadOnly(!browseable);
|
||||
browseBtn->setEnabled(browseable);
|
||||
|
||||
pathLabel->setVisible(visible);
|
||||
pathEdit->setVisible(visible);
|
||||
browseBtn->setVisible(visible);
|
||||
}
|
||||
|
||||
void VInsertImageDialog::imageDownloaded(const QByteArray &data)
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
void setImage(const QImage &image);
|
||||
QImage getImage() const;
|
||||
void setBrowseable(bool browseable);
|
||||
void setBrowseable(bool browseable, bool visible = false);
|
||||
|
||||
public slots:
|
||||
void imageDownloaded(const QByteArray &data);
|
||||
@ -48,7 +48,6 @@ private:
|
||||
QString defaultImageTitle;
|
||||
QString defaultPath;
|
||||
QImage *image;
|
||||
bool browseable;
|
||||
};
|
||||
|
||||
#endif // VINSERTIMAGEDIALOG_H
|
||||
|
@ -515,7 +515,7 @@ void VMainWindow::importNoteFromFile()
|
||||
{
|
||||
static QString lastPath = QDir::homePath();
|
||||
QStringList files = QFileDialog::getOpenFileNames(this,
|
||||
tr("Select files(HTML or Markdown) to be imported as notes"),
|
||||
tr("Select Files(HTML or Markdown) To Import"),
|
||||
lastPath);
|
||||
if (files.isEmpty()) {
|
||||
return;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "vfile.h"
|
||||
#include "vmdedit.h"
|
||||
|
||||
const QString VMdEditOperations::c_defaultImageTitle = "image";
|
||||
|
||||
VMdEditOperations::VMdEditOperations(VEdit *p_editor, VFile *p_file)
|
||||
: VEditOperations(p_editor, p_file)
|
||||
{
|
||||
@ -35,8 +37,8 @@ bool VMdEditOperations::insertImageFromMimeData(const QMimeData *source)
|
||||
if (image.isNull()) {
|
||||
return false;
|
||||
}
|
||||
VInsertImageDialog dialog(tr("Insert image from clipboard"), tr("image_title"),
|
||||
"", (QWidget *)m_editor);
|
||||
VInsertImageDialog dialog(tr("Insert Image From Clipboard"),
|
||||
c_defaultImageTitle, "", (QWidget *)m_editor);
|
||||
dialog.setBrowseable(false);
|
||||
dialog.setImage(image);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
@ -110,15 +112,16 @@ bool VMdEditOperations::insertImageFromURL(const QUrl &imageUrl)
|
||||
qWarning() << "error: image is null";
|
||||
return false;
|
||||
}
|
||||
title = "Insert image from file";
|
||||
title = "Insert Image From File";
|
||||
} else {
|
||||
imagePath = imageUrl.toString();
|
||||
title = "Insert image from network";
|
||||
title = "Insert Image From Network";
|
||||
}
|
||||
|
||||
|
||||
VInsertImageDialog dialog(title, QObject::tr("image_title"), imagePath, (QWidget *)m_editor);
|
||||
dialog.setBrowseable(false);
|
||||
VInsertImageDialog dialog(title, c_defaultImageTitle,
|
||||
imagePath, (QWidget *)m_editor);
|
||||
dialog.setBrowseable(false, true);
|
||||
if (isLocal) {
|
||||
dialog.setImage(image);
|
||||
} else {
|
||||
@ -161,8 +164,8 @@ bool VMdEditOperations::insertURLFromMimeData(const QMimeData *source)
|
||||
|
||||
bool VMdEditOperations::insertImage()
|
||||
{
|
||||
VInsertImageDialog dialog(tr("Insert Image From File"), tr("image_title"),
|
||||
"", (QWidget *)m_editor);
|
||||
VInsertImageDialog dialog(tr("Insert Image From File"),
|
||||
c_defaultImageTitle, "", (QWidget *)m_editor);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QString title = dialog.getImageTitleInput();
|
||||
QString imagePath = dialog.getPathInput();
|
||||
|
@ -46,6 +46,8 @@ private:
|
||||
bool suffixNumAllowed(const QList<QString> &p_seq);
|
||||
|
||||
QTimer *m_pendingTimer;
|
||||
|
||||
static const QString c_defaultImageTitle;
|
||||
};
|
||||
|
||||
#endif // VMDEDITOPERATIONS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user