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 "PictureCopy.h"
|
||||||
#include "UiModLabel.h"
|
#include "UiModLabel.h"
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
#include <QtWinExtras/QtWin>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -37,6 +43,7 @@
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QToolBar>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
@ -88,6 +95,41 @@ PictureDialog::~PictureDialog()
|
||||||
delete ui;
|
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 PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
bool returnValue = false;
|
bool returnValue = false;
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
|
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||||
|
void addPreviousNextButtons();
|
||||||
bool isIndexed();
|
bool isIndexed();
|
||||||
int getIndex();
|
int getIndex();
|
||||||
~PictureDialog();
|
~PictureDialog();
|
||||||
|
@ -60,6 +61,8 @@ private slots:
|
||||||
void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
|
void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
|
||||||
void on_labPicture_customContextMenuRequested(const QPoint &pos);
|
void on_labPicture_customContextMenuRequested(const QPoint &pos);
|
||||||
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
|
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
|
||||||
|
void nextPictureRequestedSlot();
|
||||||
|
void previousPictureRequestedSlot();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void nextPictureRequested();
|
void nextPictureRequested();
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
<string>%1 - Snapmatic Picture Viewer</string>
|
<string>%1 - Snapmatic Picture Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlPictureLayout">
|
<layout class="QVBoxLayout" name="vlPictureLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -57,11 +60,28 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hlJson">
|
<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">
|
<property name="leftMargin">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
|
@ -157,6 +177,8 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -110,6 +110,9 @@ void SnapmaticWidget::on_cmdView_clicked()
|
||||||
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
||||||
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
||||||
|
|
||||||
|
// add previous next buttons
|
||||||
|
picDialog->addPreviousNextButtons();
|
||||||
|
|
||||||
// show picture dialog
|
// show picture dialog
|
||||||
picDialog->show();
|
picDialog->show();
|
||||||
picDialog->setMinimumSize(picDialog->size());
|
picDialog->setMinimumSize(picDialog->size());
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
QT += core gui network
|
QT += core gui network
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): win32: QT += winextras
|
||||||
|
|
||||||
DEPLOYMENT.display_name = gta5sync
|
DEPLOYMENT.display_name = gta5sync
|
||||||
TARGET = gta5sync
|
TARGET = gta5sync
|
||||||
|
|
Loading…
Reference in a new issue