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();
|
||||||
|
|
162
PictureDialog.ui
162
PictureDialog.ui
|
@ -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,100 +60,119 @@
|
||||||
<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">
|
<property name="leftMargin">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>4</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labJSON">
|
<layout class="QHBoxLayout" name="jsonLayout">
|
||||||
<property name="sizePolicy">
|
<property name="leftMargin">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<number>4</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="topMargin">
|
||||||
<string><span style=" font-weight:600;">Title: </span>%6<br/>
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labJSON">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><span style=" font-weight:600;">Title: </span>%6<br/>
|
||||||
<span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/>
|
<span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/>
|
||||||
<span style=" font-weight:600;">Players: </span>%4 (Crew %5)<br/>
|
<span style=" font-weight:600;">Players: </span>%4 (Crew %5)<br/>
|
||||||
<span style=" font-weight:600;">Created: </span>%8</string>
|
<span style=" font-weight:600;">Created: </span>%8</string>
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="vlButtons">
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<spacer name="vsButtons">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="wordWrap">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="openExternalLinks">
|
||||||
<size>
|
<bool>true</bool>
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
<layout class="QVBoxLayout" name="vlButtons">
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdExport">
|
<spacer name="vsButtons">
|
||||||
<property name="focusPolicy">
|
<property name="orientation">
|
||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="sizeType">
|
||||||
<string>Export picture</string>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="sizeHint" stdset="0">
|
||||||
<string>&Export</string>
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
</spacer>
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdClose">
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<property name="focusPolicy">
|
<item>
|
||||||
<enum>Qt::NoFocus</enum>
|
<widget class="QPushButton" name="cmdExport">
|
||||||
</property>
|
<property name="focusPolicy">
|
||||||
<property name="toolTip">
|
<enum>Qt::NoFocus</enum>
|
||||||
<string>Close</string>
|
</property>
|
||||||
</property>
|
<property name="toolTip">
|
||||||
<property name="text">
|
<string>Export picture</string>
|
||||||
<string>&Close</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="autoDefault">
|
<string>&Export</string>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="autoDefault">
|
||||||
</widget>
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdClose">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -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