at previous and next buttons in the title bar
This commit is contained in:
parent
eafa1af45c
commit
c6d84a7541
5 changed files with 141 additions and 70 deletions
|
@ -27,6 +27,12 @@
|
|||
#include "PictureCopy.h"
|
||||
#include "UiModLabel.h"
|
||||
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtWinExtras/QtWin>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QJsonDocument>
|
||||
#include <QApplication>
|
||||
|
@ -37,6 +43,7 @@
|
|||
#include <QJsonArray>
|
||||
#include <QKeyEvent>
|
||||
#include <QMimeData>
|
||||
#include <QToolBar>
|
||||
#include <QBuffer>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
|
@ -88,6 +95,41 @@ PictureDialog::~PictureDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void PictureDialog::addPreviousNextButtons()
|
||||
{
|
||||
// Windows Vista additions
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050000
|
||||
if (QtWin::isCompositionEnabled())
|
||||
{
|
||||
QPalette palette;
|
||||
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
|
||||
layout()->setMenuBar(uiToolbar);
|
||||
QAction *backAction = uiToolbar->addAction("<-", this, SLOT(previousPictureRequestedSlot()));
|
||||
QAction *nextAction = uiToolbar->addAction("->", this, SLOT(nextPictureRequestedSlot()));
|
||||
backAction->setToolTip("");
|
||||
nextAction->setToolTip("");
|
||||
|
||||
QtWin::extendFrameIntoClientArea(this, 0, uiToolbar->height(), 0, 0);
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
setAttribute(Qt::WA_NoSystemBackground, false);
|
||||
setStyleSheet("PictureDialog { background: transparent; }");
|
||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void PictureDialog::nextPictureRequestedSlot()
|
||||
{
|
||||
emit nextPictureRequested();
|
||||
}
|
||||
|
||||
void PictureDialog::previousPictureRequestedSlot()
|
||||
{
|
||||
emit previousPictureRequested();
|
||||
}
|
||||
|
||||
bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
bool returnValue = false;
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
||||
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
|
||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||
void addPreviousNextButtons();
|
||||
bool isIndexed();
|
||||
int getIndex();
|
||||
~PictureDialog();
|
||||
|
@ -60,6 +61,8 @@ private slots:
|
|||
void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
|
||||
void on_labPicture_customContextMenuRequested(const QPoint &pos);
|
||||
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
|
||||
void nextPictureRequestedSlot();
|
||||
void previousPictureRequestedSlot();
|
||||
|
||||
signals:
|
||||
void nextPictureRequested();
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
<string>%1 - Snapmatic Picture Viewer</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vlPictureLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -57,11 +60,28 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hlJson">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="jsonLayout">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
|
@ -157,6 +177,8 @@
|
|||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -110,6 +110,9 @@ void SnapmaticWidget::on_cmdView_clicked()
|
|||
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
||||
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
||||
|
||||
// add previous next buttons
|
||||
picDialog->addPreviousNextButtons();
|
||||
|
||||
// show picture dialog
|
||||
picDialog->show();
|
||||
picDialog->setMinimumSize(picDialog->size());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
QT += core gui network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): win32: QT += winextras
|
||||
|
||||
DEPLOYMENT.display_name = gta5sync
|
||||
TARGET = gta5sync
|
||||
|
|
Loading…
Reference in a new issue