added default profile, added contentMode for selection/open
This commit is contained in:
parent
0e8b86abc5
commit
a81e2e142e
13 changed files with 218 additions and 67 deletions
|
@ -34,12 +34,18 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
contentMode = 0;
|
||||||
|
settings = new QSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
|
||||||
setupTreeWidget();
|
setupTreeWidget();
|
||||||
setupLanguageBox();
|
setupLanguageBox();
|
||||||
|
setupRadioButtons();
|
||||||
|
setupDefaultProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog()
|
OptionsDialog::~OptionsDialog()
|
||||||
{
|
{
|
||||||
|
delete settings;
|
||||||
foreach(QTreeWidgetItem *playerItem, playerItems)
|
foreach(QTreeWidgetItem *playerItem, playerItems)
|
||||||
{
|
{
|
||||||
delete playerItem;
|
delete playerItem;
|
||||||
|
@ -71,10 +77,9 @@ void OptionsDialog::setupTreeWidget()
|
||||||
|
|
||||||
void OptionsDialog::setupLanguageBox()
|
void OptionsDialog::setupLanguageBox()
|
||||||
{
|
{
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
settings->beginGroup("Interface");
|
||||||
settings.beginGroup("Interface");
|
currentLanguage = settings->value("Language","System").toString();
|
||||||
currentLanguage = settings.value("Language","System").toString();
|
settings->endGroup();
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
QString cbSysStr = tr("%1 (%2 if available) [sys]", "System like PC System = %1, System Language like Deutsch = %2").arg(tr("System",
|
QString cbSysStr = tr("%1 (%2 if available) [sys]", "System like PC System = %1, System Language like Deutsch = %2").arg(tr("System",
|
||||||
"System like PC System"), QLocale::system().nativeLanguageName());
|
"System like PC System"), QLocale::system().nativeLanguageName());
|
||||||
|
@ -117,6 +122,30 @@ void OptionsDialog::setupLanguageBox()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::setupRadioButtons()
|
||||||
|
{
|
||||||
|
bool contentModeOk;
|
||||||
|
settings->beginGroup("Profile");
|
||||||
|
contentMode = settings->value("ContentMode", 0).toInt(&contentModeOk);
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
if (contentModeOk)
|
||||||
|
{
|
||||||
|
if (contentMode == 0)
|
||||||
|
{
|
||||||
|
ui->rbOpenWithSC->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (contentMode == 1)
|
||||||
|
{
|
||||||
|
ui->rbOpenWithDC->setChecked(true);
|
||||||
|
}
|
||||||
|
else if (contentMode == 2)
|
||||||
|
{
|
||||||
|
ui->rbSelectWithSC->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::on_cmdOK_clicked()
|
void OptionsDialog::on_cmdOK_clicked()
|
||||||
{
|
{
|
||||||
applySettings();
|
applySettings();
|
||||||
|
@ -125,13 +154,54 @@ void OptionsDialog::on_cmdOK_clicked()
|
||||||
|
|
||||||
void OptionsDialog::applySettings()
|
void OptionsDialog::applySettings()
|
||||||
{
|
{
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
settings->beginGroup("Interface");
|
||||||
settings.beginGroup("Interface");
|
settings->setValue("Language", ui->cbLanguage->currentData());
|
||||||
settings.setValue("Language", ui->cbLanguage->currentData());
|
settings->endGroup();
|
||||||
settings.endGroup();
|
|
||||||
|
settings->beginGroup("Profile");
|
||||||
|
int newContentMode = 0;
|
||||||
|
if (ui->rbOpenWithSC->isChecked())
|
||||||
|
{
|
||||||
|
newContentMode = 0;
|
||||||
|
}
|
||||||
|
else if (ui->rbOpenWithDC->isChecked())
|
||||||
|
{
|
||||||
|
newContentMode = 1;
|
||||||
|
}
|
||||||
|
else if (ui->rbSelectWithSC->isChecked())
|
||||||
|
{
|
||||||
|
newContentMode = 2;
|
||||||
|
}
|
||||||
|
settings->setValue("ContentMode", newContentMode);
|
||||||
|
settings->setValue("Default", ui->cbProfiles->currentData());
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
emit settingsApplied(newContentMode, ui->cbLanguage->currentData().toString());
|
||||||
|
|
||||||
if (ui->cbLanguage->currentData().toString() != currentLanguage)
|
if (ui->cbLanguage->currentData().toString() != currentLanguage)
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, tr("%1", "%1").arg(GTA5SYNC_APPSTR), tr("The language change will take effect after you restart %1.").arg(GTA5SYNC_APPSTR));
|
QMessageBox::information(this, tr("%1", "%1").arg(GTA5SYNC_APPSTR), tr("The language change will take effect after you restart %1.").arg(GTA5SYNC_APPSTR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::setupDefaultProfile()
|
||||||
|
{
|
||||||
|
settings->beginGroup("Profile");
|
||||||
|
defaultProfile = settings->value("Default", "").toString();
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
QString cbNoneStr = tr("No Profile", "No Profile, as default");
|
||||||
|
ui->cbProfiles->addItem(cbNoneStr, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::commitProfiles(QStringList profiles)
|
||||||
|
{
|
||||||
|
foreach(const QString &profile, profiles)
|
||||||
|
{
|
||||||
|
ui->cbProfiles->addItem(tr("Profile: %1").arg(profile), profile);
|
||||||
|
if (defaultProfile == profile)
|
||||||
|
{
|
||||||
|
ui->cbProfiles->setCurrentText(tr("Profile: %1").arg(profile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QSettings>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
|
|
||||||
|
@ -34,18 +35,27 @@ class OptionsDialog : public QDialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||||
|
void commitProfiles(QStringList profiles);
|
||||||
~OptionsDialog();
|
~OptionsDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdOK_clicked();
|
void on_cmdOK_clicked();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void settingsApplied(int contentMode, QString language);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
Ui::OptionsDialog *ui;
|
Ui::OptionsDialog *ui;
|
||||||
QList<QTreeWidgetItem*> playerItems;
|
QList<QTreeWidgetItem*> playerItems;
|
||||||
QString currentLanguage;
|
QString currentLanguage;
|
||||||
|
QString defaultProfile;
|
||||||
|
QSettings *settings;
|
||||||
|
int contentMode;
|
||||||
void setupTreeWidget();
|
void setupTreeWidget();
|
||||||
void setupLanguageBox();
|
void setupLanguageBox();
|
||||||
|
void setupRadioButtons();
|
||||||
|
void setupDefaultProfile();
|
||||||
void applySettings();
|
void applySettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,18 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbDefaultProfile">
|
||||||
|
<property name="title">
|
||||||
|
<string>Default Profile</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vlDefaultProfile">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cbProfiles"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsProfile">
|
<spacer name="vsProfile">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -117,9 +117,10 @@ void ProfileInterface::savegameLoaded_f(SavegameData *savegame, QString savegame
|
||||||
{
|
{
|
||||||
SavegameWidget *sgdWidget = new SavegameWidget();
|
SavegameWidget *sgdWidget = new SavegameWidget();
|
||||||
sgdWidget->setSavegameData(savegame, savegamePath);
|
sgdWidget->setSavegameData(savegame, savegamePath);
|
||||||
|
sgdWidget->setContentMode(contentMode);
|
||||||
widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName();
|
widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName();
|
||||||
savegames.append(savegame);
|
savegames.append(savegame);
|
||||||
if (selectedWidgts != 0) { sgdWidget->setSelectionMode(true); }
|
if (selectedWidgts != 0 || contentMode == 2) { sgdWidget->setSelectionMode(true); }
|
||||||
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted()));
|
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted()));
|
||||||
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
||||||
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
||||||
|
@ -137,9 +138,10 @@ void ProfileInterface::pictureLoaded_f(SnapmaticPicture *picture, QString pictur
|
||||||
{
|
{
|
||||||
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, threadDB);
|
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, threadDB);
|
||||||
picWidget->setSnapmaticPicture(picture, picturePath);
|
picWidget->setSnapmaticPicture(picture, picturePath);
|
||||||
|
picWidget->setContentMode(contentMode);
|
||||||
widgets[picWidget] = "PIC" + picture->getPictureSortStr();
|
widgets[picWidget] = "PIC" + picture->getPictureSortStr();
|
||||||
pictures.append(picture);
|
pictures.append(picture);
|
||||||
if (selectedWidgts != 0) { picWidget->setSelectionMode(true); }
|
if (selectedWidgts != 0 || contentMode == 2) { picWidget->setSelectionMode(true); }
|
||||||
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted()));
|
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted()));
|
||||||
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
||||||
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
||||||
|
@ -560,9 +562,12 @@ void ProfileInterface::profileWidgetDeselected()
|
||||||
{
|
{
|
||||||
int scrollBarValue = ui->saProfile->verticalScrollBar()->value();
|
int scrollBarValue = ui->saProfile->verticalScrollBar()->value();
|
||||||
foreach(ProfileWidget *widget, widgets.keys())
|
foreach(ProfileWidget *widget, widgets.keys())
|
||||||
|
{
|
||||||
|
if (contentMode != 2)
|
||||||
{
|
{
|
||||||
widget->setSelectionMode(false);
|
widget->setSelectionMode(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ui->saProfile->verticalScrollBar()->setValue(scrollBarValue);
|
ui->saProfile->verticalScrollBar()->setValue(scrollBarValue);
|
||||||
}
|
}
|
||||||
selectedWidgts--;
|
selectedWidgts--;
|
||||||
|
@ -780,3 +785,29 @@ void ProfileInterface::importFiles()
|
||||||
{
|
{
|
||||||
on_cmdImport_clicked();
|
on_cmdImport_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileInterface::settingsApplied(int _contentMode, QString language)
|
||||||
|
{
|
||||||
|
Q_UNUSED(language)
|
||||||
|
contentMode = _contentMode;
|
||||||
|
|
||||||
|
if (contentMode == 2)
|
||||||
|
{
|
||||||
|
foreach(ProfileWidget *widget, widgets.keys())
|
||||||
|
{
|
||||||
|
widget->setSelectionMode(true);
|
||||||
|
widget->setContentMode(contentMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach(ProfileWidget *widget, widgets.keys())
|
||||||
|
{
|
||||||
|
if (selectedWidgts == 0)
|
||||||
|
{
|
||||||
|
widget->setSelectionMode(false);
|
||||||
|
}
|
||||||
|
widget->setContentMode(contentMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ class ProfileInterface : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||||
void setProfileFolder(QString folder, QString profile);
|
void setProfileFolder(QString folder, QString profile);
|
||||||
|
void settingsApplied(int contentMode, QString language);
|
||||||
void setupProfileInterface();
|
void setupProfileInterface();
|
||||||
~ProfileInterface();
|
~ProfileInterface();
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ private:
|
||||||
QString profileName;
|
QString profileName;
|
||||||
QString loadingStr;
|
QString loadingStr;
|
||||||
int selectedWidgts;
|
int selectedWidgts;
|
||||||
|
int contentMode;
|
||||||
|
|
||||||
bool importFile(QString selectedFile, bool warn);
|
bool importFile(QString selectedFile, bool warn);
|
||||||
bool importSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool warn = true);
|
bool importSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool warn = true);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
ProfileWidget::ProfileWidget(QWidget *parent) : QWidget(parent)
|
ProfileWidget::ProfileWidget(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
contentMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileWidget::~ProfileWidget()
|
ProfileWidget::~ProfileWidget()
|
||||||
|
@ -49,3 +49,13 @@ QString ProfileWidget::getWidgetType()
|
||||||
qDebug() << "ProfileWidget::getWidgetType got used without overwrite";
|
qDebug() << "ProfileWidget::getWidgetType got used without overwrite";
|
||||||
return "ProfileWidget";
|
return "ProfileWidget";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProfileWidget::getContentMode()
|
||||||
|
{
|
||||||
|
return contentMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileWidget::setContentMode(int _contentMode)
|
||||||
|
{
|
||||||
|
contentMode = _contentMode;
|
||||||
|
}
|
||||||
|
|
|
@ -27,11 +27,16 @@ class ProfileWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit ProfileWidget(QWidget *parent = 0);
|
explicit ProfileWidget(QWidget *parent = 0);
|
||||||
virtual void setSelectionMode(bool selectionMode);
|
virtual void setSelectionMode(bool selectionMode);
|
||||||
|
virtual void setContentMode(int contentMode);
|
||||||
virtual void setSelected(bool isSelected);
|
virtual void setSelected(bool isSelected);
|
||||||
virtual bool isSelected();
|
virtual bool isSelected();
|
||||||
virtual QString getWidgetType();
|
virtual QString getWidgetType();
|
||||||
|
virtual int getContentMode();
|
||||||
~ProfileWidget();
|
~ProfileWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int contentMode;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -53,7 +53,6 @@ SavegameWidget::SavegameWidget(QWidget *parent) :
|
||||||
highlightBackColor = palette.highlight().color();
|
highlightBackColor = palette.highlight().color();
|
||||||
highlightTextColor = palette.highlightedText().color();
|
highlightTextColor = palette.highlightedText().color();
|
||||||
|
|
||||||
clkIssued = 0;
|
|
||||||
sgdPath = "";
|
sgdPath = "";
|
||||||
sgdStr = "";
|
sgdStr = "";
|
||||||
sgdata = 0;
|
sgdata = 0;
|
||||||
|
@ -131,8 +130,7 @@ void SavegameWidget::on_cmdView_clicked()
|
||||||
|
|
||||||
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
ProfileWidget::mouseReleaseEvent(ev);
|
ProfileWidget::mousePressEvent(ev);
|
||||||
clkIssued = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
|
@ -142,14 +140,12 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
clkIssued = false;
|
|
||||||
//QTimer::singleShot(QApplication::doubleClickInterval(), this, SLOT(changeCheckedState()));
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
on_cmdView_clicked();
|
on_cmdView_clicked();
|
||||||
}
|
}
|
||||||
|
@ -158,20 +154,11 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
|
|
||||||
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
QWidget::mouseDoubleClickEvent(ev);
|
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||||
|
|
||||||
// if (ev->button() == Qt::LeftButton)
|
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||||
// {
|
|
||||||
// clkIssued = true;
|
|
||||||
// on_cmdView_clicked();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void SavegameWidget::changeCheckedState()
|
|
||||||
{
|
{
|
||||||
if (!clkIssued)
|
on_cmdView_clicked();
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ private slots:
|
||||||
void on_cmdCopy_clicked();
|
void on_cmdCopy_clicked();
|
||||||
void on_cmdDelete_clicked();
|
void on_cmdDelete_clicked();
|
||||||
void on_cbSelected_stateChanged(int arg1);
|
void on_cbSelected_stateChanged(int arg1);
|
||||||
void changeCheckedState();
|
|
||||||
void savegameSelected();
|
void savegameSelected();
|
||||||
void selectAllWidgets();
|
void selectAllWidgets();
|
||||||
void deselectAllWidgets();
|
void deselectAllWidgets();
|
||||||
|
@ -69,7 +68,6 @@ private:
|
||||||
QColor highlightTextColor;
|
QColor highlightTextColor;
|
||||||
QString sgdPath;
|
QString sgdPath;
|
||||||
QString sgdStr;
|
QString sgdStr;
|
||||||
bool clkIssued;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void savegameDeleted();
|
void savegameDeleted();
|
||||||
|
|
|
@ -45,7 +45,6 @@ SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, DatabaseThread *thr
|
||||||
highlightBackColor = palette.highlight().color();
|
highlightBackColor = palette.highlight().color();
|
||||||
highlightTextColor = palette.highlightedText().color();
|
highlightTextColor = palette.highlightedText().color();
|
||||||
|
|
||||||
clkIssued = 0;
|
|
||||||
picPath = "";
|
picPath = "";
|
||||||
picStr = "";
|
picStr = "";
|
||||||
smpic = 0;
|
smpic = 0;
|
||||||
|
@ -156,14 +155,12 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
clkIssued = false;
|
|
||||||
//QTimer::singleShot(QApplication::doubleClickInterval(), this, SLOT(changeCheckedState()));
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
on_cmdView_clicked();
|
on_cmdView_clicked();
|
||||||
}
|
}
|
||||||
|
@ -172,20 +169,11 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
|
|
||||||
void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
QWidget::mouseDoubleClickEvent(ev);
|
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||||
|
|
||||||
// if (ev->button() == Qt::LeftButton)
|
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||||
// {
|
|
||||||
// clkIssued = true;
|
|
||||||
// on_cmdView_clicked();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void SnapmaticWidget::changeCheckedState()
|
|
||||||
{
|
{
|
||||||
if (!clkIssued)
|
on_cmdView_clicked();
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,9 +211,7 @@ void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected()));
|
contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected()));
|
||||||
contextMenu.addAction(QIcon::fromTheme("edit-select-all"), tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
contextMenu.addAction(QIcon::fromTheme("edit-select-all"), tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||||
}
|
}
|
||||||
//ui->SnapmaticFrame->setStyleSheet(QString("QFrame#SnapmaticFrame{background-color: rgb(%1, %2, %3)}QLabel#labPicStr{color: rgb(%4, %5, %6)}").arg(QString::number(highlightBackColor.red()), QString::number(highlightBackColor.green()), QString::number(highlightBackColor.blue()), QString::number(highlightTextColor.red()), QString::number(highlightTextColor.green()), QString::number(highlightTextColor.blue())));
|
|
||||||
contextMenu.exec(ev->globalPos());
|
contextMenu.exec(ev->globalPos());
|
||||||
//ui->SnapmaticFrame->setStyleSheet("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::dialogNextPictureRequested()
|
void SnapmaticWidget::dialogNextPictureRequested()
|
||||||
|
|
|
@ -54,7 +54,6 @@ private slots:
|
||||||
void on_cmdExport_clicked();
|
void on_cmdExport_clicked();
|
||||||
void on_cmdDelete_clicked();
|
void on_cmdDelete_clicked();
|
||||||
void on_cbSelected_stateChanged(int arg1);
|
void on_cbSelected_stateChanged(int arg1);
|
||||||
void changeCheckedState();
|
|
||||||
void pictureSelected();
|
void pictureSelected();
|
||||||
void selectAllWidgets();
|
void selectAllWidgets();
|
||||||
void deselectAllWidgets();
|
void deselectAllWidgets();
|
||||||
|
@ -78,7 +77,6 @@ private:
|
||||||
QString picPath;
|
QString picPath;
|
||||||
QString picTitl;
|
QString picTitl;
|
||||||
QString picStr;
|
QString picStr;
|
||||||
bool clkIssued;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pictureDeleted();
|
void pictureDeleted();
|
||||||
|
|
|
@ -48,6 +48,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
ui(new Ui::UserInterface)
|
ui(new Ui::UserInterface)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
contentMode = 0;
|
||||||
profileOpen = 0;
|
profileOpen = 0;
|
||||||
profileUI = 0;
|
profileUI = 0;
|
||||||
ui->menuProfile->setEnabled(false);
|
ui->menuProfile->setEnabled(false);
|
||||||
|
@ -78,9 +79,16 @@ void UserInterface::setupDirEnv()
|
||||||
}
|
}
|
||||||
|
|
||||||
// profiles init
|
// profiles init
|
||||||
QSettings SyncSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
SyncSettings.beginGroup("Profile");
|
settings.beginGroup("Profile");
|
||||||
QString defaultProfile = SyncSettings.value("Default", "").toString();
|
QString defaultProfile = settings.value("Default", "").toString();
|
||||||
|
|
||||||
|
bool contentModeOk;
|
||||||
|
contentMode = settings.value("ContentMode", 0).toInt(&contentModeOk);
|
||||||
|
if (contentMode != 0 || contentMode != 1 || contentMode != 2)
|
||||||
|
{
|
||||||
|
contentMode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (folderExists)
|
if (folderExists)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +96,8 @@ void UserInterface::setupDirEnv()
|
||||||
GTAV_ProfilesFolder = GTAV_Folder + QDir::separator() + "Profiles";
|
GTAV_ProfilesFolder = GTAV_Folder + QDir::separator() + "Profiles";
|
||||||
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
||||||
|
|
||||||
QStringList GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||||
setupProfileUi(GTAV_Profiles);
|
setupProfileUi();
|
||||||
|
|
||||||
if (GTAV_Profiles.length() == 1)
|
if (GTAV_Profiles.length() == 1)
|
||||||
{
|
{
|
||||||
|
@ -102,11 +110,13 @@ void UserInterface::setupDirEnv()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setupProfileUi(QStringList());
|
GTAV_Profiles = QStringList();
|
||||||
|
setupProfileUi();
|
||||||
}
|
}
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::setupProfileUi(QStringList GTAV_Profiles)
|
void UserInterface::setupProfileUi()
|
||||||
{
|
{
|
||||||
if (GTAV_Profiles.length() == 0)
|
if (GTAV_Profiles.length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +177,8 @@ void UserInterface::openProfile(QString profileName)
|
||||||
profileUI = new ProfileInterface(profileDB, crewDB, threadDB);
|
profileUI = new ProfileInterface(profileDB, crewDB, threadDB);
|
||||||
ui->swProfile->addWidget(profileUI);
|
ui->swProfile->addWidget(profileUI);
|
||||||
ui->swProfile->setCurrentWidget(profileUI);
|
ui->swProfile->setCurrentWidget(profileUI);
|
||||||
profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);
|
profileUI->setProfileFolder(GTAV_ProfilesFolder + QDir::separator() + profileName, profileName);
|
||||||
|
profileUI->settingsApplied(contentMode, language);
|
||||||
profileUI->setupProfileInterface();
|
profileUI->setupProfileInterface();
|
||||||
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
|
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
|
||||||
QObject::connect(profileUI, SIGNAL(profileLoaded()), this, SLOT(profileLoaded()));
|
QObject::connect(profileUI, SIGNAL(profileLoaded()), this, SLOT(profileLoaded()));
|
||||||
|
@ -231,40 +242,57 @@ void UserInterface::profileLoaded()
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionSelect_all_triggered()
|
void UserInterface::on_actionSelect_all_triggered()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
{
|
{
|
||||||
profileUI->selectAllWidgets();
|
profileUI->selectAllWidgets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionDeselect_all_triggered()
|
void UserInterface::on_actionDeselect_all_triggered()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
{
|
{
|
||||||
profileUI->deselectAllWidgets();
|
profileUI->deselectAllWidgets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionExport_selected_triggered()
|
void UserInterface::on_actionExport_selected_triggered()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
{
|
{
|
||||||
profileUI->exportSelected();
|
profileUI->exportSelected();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionDelete_selected_triggered()
|
void UserInterface::on_actionDelete_selected_triggered()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
{
|
{
|
||||||
profileUI->deleteSelected();
|
profileUI->deleteSelected();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionOptions_triggered()
|
void UserInterface::on_actionOptions_triggered()
|
||||||
{
|
{
|
||||||
OptionsDialog *optionsDialog = new OptionsDialog(profileDB, this);
|
OptionsDialog *optionsDialog = new OptionsDialog(profileDB, this);
|
||||||
optionsDialog->setWindowFlags(optionsDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
optionsDialog->setWindowFlags(optionsDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
optionsDialog->commitProfiles(GTAV_Profiles);
|
||||||
|
QObject::connect(optionsDialog, SIGNAL(settingsApplied(int,QString)), this, SLOT(settingsApplied(int,QString)));
|
||||||
|
|
||||||
optionsDialog->setModal(true);
|
optionsDialog->setModal(true);
|
||||||
optionsDialog->show();
|
optionsDialog->show();
|
||||||
optionsDialog->exec();
|
optionsDialog->exec();
|
||||||
optionsDialog->deleteLater();
|
|
||||||
delete optionsDialog;
|
delete optionsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::on_action_Import_triggered()
|
void UserInterface::on_action_Import_triggered()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
{
|
{
|
||||||
profileUI->importFiles();
|
profileUI->importFiles();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserInterface::on_actionOpen_File_triggered()
|
void UserInterface::on_actionOpen_File_triggered()
|
||||||
{
|
{
|
||||||
|
@ -401,3 +429,13 @@ void UserInterface::openSavegameFile(SavegameData *savegame)
|
||||||
sgdDialog->exec();
|
sgdDialog->exec();
|
||||||
delete sgdDialog;
|
delete sgdDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterface::settingsApplied(int _contentMode, QString _language)
|
||||||
|
{
|
||||||
|
language = _language;
|
||||||
|
contentMode = _contentMode;
|
||||||
|
if (profileOpen)
|
||||||
|
{
|
||||||
|
profileUI->settingsApplied(contentMode, language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ private slots:
|
||||||
void on_actionOptions_triggered();
|
void on_actionOptions_triggered();
|
||||||
void on_action_Import_triggered();
|
void on_action_Import_triggered();
|
||||||
void on_actionOpen_File_triggered();
|
void on_actionOpen_File_triggered();
|
||||||
|
void settingsApplied(int contentMode, QString language);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
|
@ -66,10 +67,13 @@ private:
|
||||||
ProfileInterface *profileUI;
|
ProfileInterface *profileUI;
|
||||||
QList<QPushButton*> profileBtns;
|
QList<QPushButton*> profileBtns;
|
||||||
bool profileOpen;
|
bool profileOpen;
|
||||||
|
int contentMode;
|
||||||
|
QString language;
|
||||||
QString defaultWindowTitle;
|
QString defaultWindowTitle;
|
||||||
QString GTAV_Folder;
|
QString GTAV_Folder;
|
||||||
QString GTAV_ProfilesFolder;
|
QString GTAV_ProfilesFolder;
|
||||||
void setupProfileUi(QStringList GTAV_Profiles);
|
QStringList GTAV_Profiles;
|
||||||
|
void setupProfileUi();
|
||||||
void openProfile(QString profileName);
|
void openProfile(QString profileName);
|
||||||
void openSelectProfile();
|
void openSelectProfile();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue