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