Use Ctrl+C and Ctrl+V to handle both the console copy-and-paste and the URL copy-and-paste
parent
e2854c0698
commit
3019e497e9
|
@ -1121,16 +1121,6 @@ void CelestiaAppWindow::createMenus()
|
||||||
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(slotCopyImage()));
|
connect(copyImageAction, SIGNAL(triggered()), this, SLOT(slotCopyImage()));
|
||||||
fileMenu->addAction(copyImageAction);
|
fileMenu->addAction(copyImageAction);
|
||||||
|
|
||||||
QAction* copyURLAction = new QAction(QIcon(":/icons/clip_copy.png"), _("Copy &URL"), this);
|
|
||||||
copyURLAction->setShortcut(QKeySequence::Copy);
|
|
||||||
connect(copyURLAction, SIGNAL(triggered()), this, SLOT(slotCopyURL()));
|
|
||||||
fileMenu->addAction(copyURLAction);
|
|
||||||
|
|
||||||
QAction* pasteURLAction = new QAction(QIcon(":/icons/clip_paste.png"), _("&Paste URL"), this);
|
|
||||||
//pasteURLAction->setShortcut(QKeySequence::Paste); // conflicts with cycle render path command
|
|
||||||
connect(pasteURLAction, SIGNAL(triggered()), this, SLOT(slotPasteURL()));
|
|
||||||
fileMenu->addAction(pasteURLAction);
|
|
||||||
|
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
QAction* openScriptAction = new QAction(QIcon(":/icons/script2.png"), _("&Open Script..."), this);
|
QAction* openScriptAction = new QAction(QIcon(":/icons/script2.png"), _("&Open Script..."), this);
|
||||||
|
@ -1172,14 +1162,14 @@ void CelestiaAppWindow::createMenus()
|
||||||
connect(gotoObjAct, SIGNAL(triggered()), this, SLOT(gotoObject()));
|
connect(gotoObjAct, SIGNAL(triggered()), this, SLOT(gotoObject()));
|
||||||
navMenu->addAction(gotoObjAct);
|
navMenu->addAction(gotoObjAct);
|
||||||
|
|
||||||
QAction *copyAction = new QAction(QIcon(":/icons/clip_copy.png"), _("Copy search console text"), this);
|
QAction *copyAction = new QAction(QIcon(":/icons/clip_copy.png"), _("Copy URL / console text"), this);
|
||||||
// copyAction->setShortcut(QString("F5")); // conflict with setTargetSpeed
|
copyAction->setShortcut(QString("Ctrl+C"));
|
||||||
connect(copyAction, &QAction::triggered, this, &CelestiaAppWindow::copyText);
|
connect(copyAction, &QAction::triggered, this, &CelestiaAppWindow::copyTextOrURL);
|
||||||
navMenu->addAction(copyAction);
|
navMenu->addAction(copyAction);
|
||||||
|
|
||||||
QAction *pasteAction = new QAction(QIcon(":/icons/clip_paste.png"), _("Paste into search console"), this);
|
QAction *pasteAction = new QAction(QIcon(":/icons/clip_paste.png"), _("Paste URL / console text"), this);
|
||||||
// pasteAction->setShortcut(QString("F6")); // conflict with setTargetSpeed
|
pasteAction->setShortcut(QString("Ctrl+V"));
|
||||||
connect(pasteAction, &QAction::triggered, this, &CelestiaAppWindow::pasteText);
|
connect(pasteAction, &QAction::triggered, this, &CelestiaAppWindow::pasteTextOrURL);
|
||||||
navMenu->addAction(pasteAction);
|
navMenu->addAction(pasteAction);
|
||||||
|
|
||||||
/****** Time menu ******/
|
/****** Time menu ******/
|
||||||
|
@ -1523,6 +1513,13 @@ QMenu* CelestiaAppWindow::buildScriptsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CelestiaAppWindow::copyText()
|
||||||
|
{
|
||||||
|
QString text(m_appCore->getTypedText().c_str());
|
||||||
|
if (!text.isEmpty())
|
||||||
|
QGuiApplication::clipboard()->setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void CelestiaAppWindow::pasteText()
|
void CelestiaAppWindow::pasteText()
|
||||||
{
|
{
|
||||||
QString text = QGuiApplication::clipboard()->text();
|
QString text = QGuiApplication::clipboard()->text();
|
||||||
|
@ -1530,9 +1527,18 @@ void CelestiaAppWindow::pasteText()
|
||||||
m_appCore->setTypedText(text.toUtf8().data());
|
m_appCore->setTypedText(text.toUtf8().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CelestiaAppWindow::copyText()
|
void CelestiaAppWindow::copyTextOrURL()
|
||||||
{
|
{
|
||||||
QString text(m_appCore->getTypedText().c_str());
|
if (m_appCore->getTextEnterMode()) // True when the search console is opened
|
||||||
if (!text.isEmpty())
|
copyText();
|
||||||
QGuiApplication::clipboard()->setText(text);
|
else
|
||||||
|
slotCopyURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CelestiaAppWindow::pasteTextOrURL()
|
||||||
|
{
|
||||||
|
if (m_appCore->getTextEnterMode()) // True when the search console is opened
|
||||||
|
pasteText();
|
||||||
|
else
|
||||||
|
slotPasteURL();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,9 @@ class CelestiaAppWindow : public QMainWindow, public CelestiaCore::ContextMenuHa
|
||||||
void copyText();
|
void copyText();
|
||||||
void pasteText();
|
void pasteText();
|
||||||
|
|
||||||
|
void copyTextOrURL();
|
||||||
|
void pasteTextOrURL();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void progressUpdate(const QString& s, int align, const QColor& c);
|
void progressUpdate(const QString& s, int align, const QColor& c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue