mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-30 07:07:42 +00:00
Fix button height, make separate button "Copy URL"
This commit is contained in:
@@ -24,7 +24,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setWindowTitle(tr("Screenshots history"));
|
||||
setFixedSize(this->size());
|
||||
setFixedSize(800, this->height());
|
||||
m_notification = new NotificationWidget();
|
||||
|
||||
m_pVBox = new QVBoxLayout(this);
|
||||
@@ -55,7 +55,7 @@ void HistoryWidget::loadHistory() {
|
||||
if(historyFiles.isEmpty()) {
|
||||
QPushButton *buttonEmpty = new QPushButton;
|
||||
buttonEmpty->setText(tr("Screenshots history is empty"));
|
||||
buttonEmpty->setMinimumSize(1, HISTORYWIDGET_MAX_PREVIEW_HEIGHT);
|
||||
buttonEmpty->setMinimumSize(1, HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
connect(buttonEmpty, &QPushButton::clicked, this, [=](){
|
||||
this->close();
|
||||
});
|
||||
@@ -70,20 +70,33 @@ void HistoryWidget::loadHistory() {
|
||||
// load pixmap
|
||||
QPixmap pixmap;
|
||||
pixmap.load( fullFileName, "png" );
|
||||
pixmap = pixmap.scaledToWidth(HISTORYWIDGET_MAX_PREVIEW_HEIGHT);
|
||||
|
||||
if (pixmap.height() / HISTORYPIXMAP_MAX_PREVIEW_HEIGHT >= pixmap.width() / HISTORYPIXMAP_MAX_PREVIEW_WIDTH) {
|
||||
pixmap = pixmap.scaledToHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
} else {
|
||||
pixmap = pixmap.scaledToWidth(HISTORYPIXMAP_MAX_PREVIEW_WIDTH);
|
||||
}
|
||||
|
||||
// get file info
|
||||
QFileInfo *pFileInfo = new QFileInfo(fullFileName);
|
||||
QString lastModified = pFileInfo->lastModified().toString(" yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
// screenshot preview
|
||||
QLabel *pScreenshot = new QLabel();
|
||||
pScreenshot->setStyleSheet("padding: 5px;");
|
||||
pScreenshot->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
pScreenshot->setPixmap(pixmap);
|
||||
|
||||
// screenshot datetime
|
||||
QLabel *pScreenshotText = new QLabel();
|
||||
pScreenshotText->setStyleSheet("padding: 5px;");
|
||||
pScreenshotText->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
pScreenshotText->setText(lastModified);
|
||||
|
||||
// copy url
|
||||
QPushButton *buttonCopyUrl = new QPushButton;
|
||||
buttonCopyUrl->setStyleSheet("text-align:left");
|
||||
QIcon buttonIcon(fullFileName);
|
||||
buttonCopyUrl->setIcon(buttonIcon);
|
||||
buttonCopyUrl->setStyleSheet("padding: 5px;");
|
||||
buttonCopyUrl->setIconSize(pixmap.rect().size());
|
||||
buttonCopyUrl->setText(lastModified);
|
||||
buttonCopyUrl->setText(tr("Copy URL"));
|
||||
buttonCopyUrl->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
connect(buttonCopyUrl, &QPushButton::clicked, this, [=](){
|
||||
QApplication::clipboard()->setText(url);
|
||||
m_notification->showMessage(tr("URL copied to clipboard."));
|
||||
@@ -93,6 +106,7 @@ void HistoryWidget::loadHistory() {
|
||||
// open in browser
|
||||
QPushButton *buttonOpen = new QPushButton;
|
||||
buttonOpen->setText(tr("Open in browser"));
|
||||
buttonOpen->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
connect(buttonOpen, &QPushButton::clicked, this, [=](){
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
this->close();
|
||||
@@ -100,15 +114,15 @@ void HistoryWidget::loadHistory() {
|
||||
|
||||
// layout
|
||||
QHBoxLayout *phbl = new QHBoxLayout();
|
||||
phbl->addWidget(pScreenshot);
|
||||
phbl->addWidget(pScreenshotText);
|
||||
phbl->addWidget(buttonCopyUrl);
|
||||
phbl->addWidget(buttonOpen);
|
||||
|
||||
int nHeight = pixmap.rect().size().height() >= HISTORYWIDGET_MAX_PREVIEW_HEIGHT
|
||||
? HISTORYWIDGET_MAX_PREVIEW_HEIGHT
|
||||
: pixmap.rect().size().height();
|
||||
buttonOpen->setMinimumSize(1, nHeight + 5 * 2 + 2); // padding 5px*2 + border
|
||||
phbl->setStretchFactor(buttonCopyUrl, 7);
|
||||
phbl->setStretchFactor(buttonOpen, 3);
|
||||
phbl->setStretchFactor(pScreenshot, 3);
|
||||
phbl->setStretchFactor(pScreenshotText, 2);
|
||||
phbl->setStretchFactor(buttonCopyUrl, 2);
|
||||
phbl->setStretchFactor(buttonOpen, 2);
|
||||
|
||||
// add to scroll
|
||||
m_pVBox->addLayout(phbl);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef HISTORYWIDGET_H
|
||||
#define HISTORYWIDGET_H
|
||||
|
||||
#define HISTORYWIDGET_MAX_PREVIEW_HEIGHT 120
|
||||
#define HISTORYPIXMAP_MAX_PREVIEW_WIDTH 160
|
||||
#define HISTORYPIXMAP_MAX_PREVIEW_HEIGHT 90
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -450,12 +450,17 @@ Press Space to open the side panel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Copia l'URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">L'URL s'ha copiat al porta-retalls.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Drücke die Leertaste um das Seitenmenü zu öffnen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL kopieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL kopiert.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Presiona Espacio para abrir el panel lateral.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Copiar URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL copiada al portapapeles.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Appuyer sur Espace pour ouvrir le panneau latéral.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Copier l'URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL copiée dans le Presse-papier.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -400,6 +400,10 @@ Press Space to open the side panel.</source>
|
||||
<source>Screenshots history is empty</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL másolása</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ImgS3Uploader</name>
|
||||
|
||||
@@ -453,12 +453,17 @@ Enter を押すと画面をキャプチャー。
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL をコピー</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL をクリップボードにコピーしました。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -449,12 +449,17 @@ Press Space to open the side panel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL-ის კოპირება</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL დაკოპირდა გაცვლის ბუფერში.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Druk op spatie om het zijpaneel te openen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL kopiëren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL gekopieerd naar klembord.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -452,12 +452,17 @@ Spacja, aby pokazać panel boczny.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Kopiuj URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL skopiowany do schowka.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Pressione espaço abrir o painel lateral.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Copiar URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL copiada para o clipboard.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -465,12 +465,17 @@ Press Space to open the side panel.</source>
|
||||
<translation>История скриншотов пуста</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation>Скопировать URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation>URL скопирован в буфер обмена.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation>Открыть в браузере</translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Stlačte medzerník pre otvorenie postranného panelu.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Kopírovať URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL skopírovaná do schránky.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Press Space to open the side panel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">Запамти интернет адресу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">Интернет адреса је сачувана у привременој меморији.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -453,12 +453,17 @@ Yan paneli açmak için Boşluk tuşuna basın.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">URL Kopyala</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">URL panoya kopyalandı.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -465,12 +465,17 @@ Press Space to open the side panel.</source>
|
||||
<translation>Історія скріншотів пуста</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation>Скопіювати URL</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation>URL скопійовано до буферу обміну.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation>Відкрити у браузері</translation>
|
||||
</message>
|
||||
|
||||
@@ -454,12 +454,17 @@ Press Space to open the side panel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">复制链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">复制链接到剪贴板。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@@ -449,12 +449,17 @@ Press Space to open the side panel.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="89"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="98"/>
|
||||
<source>Copy URL</source>
|
||||
<translation type="unfinished">複製連結</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="102"/>
|
||||
<source>URL copied to clipboard.</source>
|
||||
<translation type="unfinished">連結已複製到剪貼簿</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="95"/>
|
||||
<location filename="../src/widgets/historywidget.cpp" line="108"/>
|
||||
<source>Open in browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user