mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-31 15:32:45 +00:00
Reimplemented constentselector view class
This commit is contained in:
parent
17950210fa
commit
f9591ddda6
@ -11,6 +11,9 @@ set(LAUNCHER
|
|||||||
settings/launchersettings.cpp
|
settings/launchersettings.cpp
|
||||||
|
|
||||||
utils/checkablemessagebox.cpp
|
utils/checkablemessagebox.cpp
|
||||||
|
utils/profilescombobox.cpp
|
||||||
|
utils/textinputdialog.cpp
|
||||||
|
utils/lineedit.cpp
|
||||||
|
|
||||||
${CMAKE_SOURCE_DIR}/files/launcher/launcher.rc
|
${CMAKE_SOURCE_DIR}/files/launcher/launcher.rc
|
||||||
)
|
)
|
||||||
@ -31,6 +34,9 @@ set(LAUNCHER_HEADER
|
|||||||
settings/settingsbase.hpp
|
settings/settingsbase.hpp
|
||||||
|
|
||||||
utils/checkablemessagebox.hpp
|
utils/checkablemessagebox.hpp
|
||||||
|
utils/profilescombobox.hpp
|
||||||
|
utils/textinputdialog.hpp
|
||||||
|
utils/lineedit.hpp
|
||||||
)
|
)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
LIST(APPEND LAUNCHER_HEADER unshieldthread.hpp)
|
LIST(APPEND LAUNCHER_HEADER unshieldthread.hpp)
|
||||||
@ -45,7 +51,11 @@ set(LAUNCHER_HEADER_MOC
|
|||||||
playpage.hpp
|
playpage.hpp
|
||||||
textslotmsgbox.hpp
|
textslotmsgbox.hpp
|
||||||
|
|
||||||
|
utils/textinputdialog.hpp
|
||||||
utils/checkablemessagebox.hpp
|
utils/checkablemessagebox.hpp
|
||||||
|
utils/profilescombobox.hpp
|
||||||
|
utils/lineedit.hpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
@ -58,6 +68,7 @@ set(LAUNCHER_UI
|
|||||||
${CMAKE_SOURCE_DIR}/files/ui/graphicspage.ui
|
${CMAKE_SOURCE_DIR}/files/ui/graphicspage.ui
|
||||||
${CMAKE_SOURCE_DIR}/files/ui/mainwindow.ui
|
${CMAKE_SOURCE_DIR}/files/ui/mainwindow.ui
|
||||||
${CMAKE_SOURCE_DIR}/files/ui/playpage.ui
|
${CMAKE_SOURCE_DIR}/files/ui/playpage.ui
|
||||||
|
${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER})
|
source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER})
|
||||||
|
@ -5,14 +5,16 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
|
||||||
#include <components/contentselector/model/esmfile.hpp>
|
#include <components/contentselector/model/esmfile.hpp>
|
||||||
|
|
||||||
#include <components/contentselector/view/lineedit.hpp>
|
|
||||||
#include <components/contentselector/model/naturalsort.hpp>
|
#include <components/contentselector/model/naturalsort.hpp>
|
||||||
#include <components/contentselector/view/profilescombobox.hpp>
|
|
||||||
|
#include "utils/textinputdialog.hpp"
|
||||||
|
#include "utils/profilescombobox.hpp"
|
||||||
|
|
||||||
#include "settings/gamesettings.hpp"
|
#include "settings/gamesettings.hpp"
|
||||||
#include "settings/launchersettings.hpp"
|
#include "settings/launchersettings.hpp"
|
||||||
@ -25,45 +27,30 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
|||||||
, mLauncherSettings(launcherSettings)
|
, mLauncherSettings(launcherSettings)
|
||||||
, QWidget(parent)
|
, QWidget(parent)
|
||||||
{
|
{
|
||||||
|
ui.setupUi (this);
|
||||||
|
|
||||||
setObjectName ("DataFilesPage");
|
setObjectName ("DataFilesPage");
|
||||||
|
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
||||||
|
|
||||||
unsigned char flags;
|
buildView();
|
||||||
|
|
||||||
flags = ContentSelectorView::Flag_Content | ContentSelectorView::Flag_Profile;
|
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector::configure(this, flags);
|
|
||||||
mSelector = &ContentSelectorView::ContentSelector::instance();
|
|
||||||
|
|
||||||
setupDataFiles();
|
setupDataFiles();
|
||||||
|
|
||||||
|
|
||||||
connect (mSelector, SIGNAL (signalProfileRenamed (QString, QString)),
|
|
||||||
this, SLOT (slotProfileRenamed (QString, QString)));
|
|
||||||
|
|
||||||
connect (mSelector, SIGNAL (signalProfileChangedByUser (QString, QString)),
|
|
||||||
this, SLOT (slotProfileChangedByUser (QString, QString)));
|
|
||||||
|
|
||||||
connect (mSelector, SIGNAL (signalProfileDeleted (QString)),
|
|
||||||
this, SLOT (slotProfileDeleted (QString)));
|
|
||||||
|
|
||||||
connect (mSelector, SIGNAL (signalAddNewProfile (QString)),
|
|
||||||
this, SLOT (slotAddNewProfile (QString)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::loadSettings()
|
void DataFilesPage::loadSettings()
|
||||||
{
|
{
|
||||||
QString profileName = mSelector->getProfileText();
|
QString profileName = ui.profilesComboBox->currentText();
|
||||||
|
|
||||||
QStringList files = mLauncherSettings.values(QString("Profiles/") + profileName + QString("/game"), Qt::MatchExactly);
|
QStringList files = mLauncherSettings.values(QString("Profiles/") + profileName + QString("/game"), Qt::MatchExactly);
|
||||||
QStringList addons = mLauncherSettings.values(QString("Profiles/") + profileName + QString("/addon"), Qt::MatchExactly);
|
QStringList addons = mLauncherSettings.values(QString("Profiles/") + profileName + QString("/addon"), Qt::MatchExactly);
|
||||||
|
|
||||||
mSelector->clearCheckStates();
|
mSelector->clearCheckStates();
|
||||||
|
|
||||||
if (files.size() > 0)
|
QString gameFile ("");
|
||||||
mSelector->setGameFile(files.at(0));
|
|
||||||
else
|
|
||||||
mSelector->setGameFile();
|
|
||||||
|
|
||||||
|
if (files.size()>0)
|
||||||
|
gameFile = files.at (0);
|
||||||
|
|
||||||
|
mSelector->setGameFile(gameFile);
|
||||||
mSelector->setCheckStates(addons);
|
mSelector->setCheckStates(addons);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +59,7 @@ void DataFilesPage::saveSettings(const QString &profile)
|
|||||||
QString profileName = profile;
|
QString profileName = profile;
|
||||||
|
|
||||||
if (profileName.isEmpty())
|
if (profileName.isEmpty())
|
||||||
profileName = mSelector->getProfileText();
|
profileName = ui.profilesComboBox->currentText();
|
||||||
|
|
||||||
//retrieve the files selected for the profile
|
//retrieve the files selected for the profile
|
||||||
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
|
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
|
||||||
@ -83,7 +70,7 @@ void DataFilesPage::saveSettings(const QString &profile)
|
|||||||
mGameSettings.remove(QString("addon"));
|
mGameSettings.remove(QString("addon"));
|
||||||
|
|
||||||
//set the value of the current profile (not necessarily the profile being saved!)
|
//set the value of the current profile (not necessarily the profile being saved!)
|
||||||
mLauncherSettings.setValue(QString("Profiles/currentprofile"), mSelector->getProfileText());
|
mLauncherSettings.setValue(QString("Profiles/currentprofile"), ui.profilesComboBox->currentText());
|
||||||
|
|
||||||
foreach(const ContentSelectorModel::EsmFile *item, items) {
|
foreach(const ContentSelectorModel::EsmFile *item, items) {
|
||||||
|
|
||||||
@ -98,39 +85,64 @@ void DataFilesPage::saveSettings(const QString &profile)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataFilesPage::buildView()
|
||||||
|
{
|
||||||
|
ui.verticalLayout->insertWidget (0, mSelector->uiWidget());
|
||||||
|
|
||||||
|
//tool buttons
|
||||||
|
ui.newProfileButton->setToolTip ("Create a new profile");
|
||||||
|
ui.deleteProfileButton->setToolTip ("Delete an existing profile");
|
||||||
|
|
||||||
|
//combo box
|
||||||
|
ui.profilesComboBox->addItem ("Default");
|
||||||
|
ui.profilesComboBox->setPlaceholderText (QString("Select a profile..."));
|
||||||
|
|
||||||
|
// Add the actions to the toolbuttons
|
||||||
|
ui.newProfileButton->setDefaultAction (ui.newProfileAction);
|
||||||
|
ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction);
|
||||||
|
|
||||||
|
//establish connections
|
||||||
|
connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)),
|
||||||
|
this, SLOT (slotProfileChanged(int)));
|
||||||
|
|
||||||
|
connect (ui.profilesComboBox, SIGNAL (profileRenamed(QString, QString)),
|
||||||
|
this, SLOT (slotProfileRenamed(QString, QString)));
|
||||||
|
|
||||||
|
connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString, QString)),
|
||||||
|
this, SLOT (slotProfileChangedByUser(QString, QString)));
|
||||||
|
}
|
||||||
|
|
||||||
void DataFilesPage::removeProfile(const QString &profile)
|
void DataFilesPage::removeProfile(const QString &profile)
|
||||||
{
|
{
|
||||||
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/game"));
|
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/game"));
|
||||||
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/addon"));
|
mLauncherSettings.remove(QString("Profiles/") + profile + QString("/addon"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::changeProfiles(const QString &previous, const QString ¤t, bool savePrevious)
|
void DataFilesPage::setProfile(int index, bool savePrevious)
|
||||||
{
|
{
|
||||||
//abort if no change (typically a duplicate signal)
|
if (index >= -1 && index < ui.profilesComboBox->count())
|
||||||
if (previous == current)
|
{
|
||||||
return;
|
QString previous = ui.profilesComboBox->itemText(ui.profilesComboBox->currentIndex());
|
||||||
|
QString current = ui.profilesComboBox->itemText(index);
|
||||||
|
|
||||||
int index = -1;
|
setProfile (previous, current, savePrevious);
|
||||||
|
}
|
||||||
if (!previous.isEmpty())
|
|
||||||
index = mSelector->getProfileIndex(previous);
|
|
||||||
|
|
||||||
// Store the previous profile if it exists
|
|
||||||
if ( (index != -1) && savePrevious)
|
|
||||||
saveSettings(previous);
|
|
||||||
|
|
||||||
loadSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::slotAddNewProfile(const QString &profile)
|
void DataFilesPage::setProfile (const QString &previous, const QString ¤t, bool savePrevious)
|
||||||
{
|
{
|
||||||
saveSettings();
|
//abort if no change (poss. duplicate signal)
|
||||||
mSelector->clearCheckStates();
|
if (previous == current)
|
||||||
mSelector->addProfile(profile, true);
|
return;
|
||||||
mSelector->setGameFile();
|
|
||||||
saveSettings();
|
|
||||||
|
|
||||||
emit signalProfileChanged(mSelector->getProfileIndex(profile));
|
if (!previous.isEmpty() && savePrevious)
|
||||||
|
saveSettings (previous);
|
||||||
|
|
||||||
|
ui.profilesComboBox->setCurrentIndex (ui.profilesComboBox->findText (current));
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
|
checkForDefaultProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::slotProfileDeleted (const QString &item)
|
void DataFilesPage::slotProfileDeleted (const QString &item)
|
||||||
@ -140,8 +152,8 @@ void DataFilesPage::slotProfileDeleted (const QString &item)
|
|||||||
|
|
||||||
void DataFilesPage::slotProfileChangedByUser(const QString &previous, const QString ¤t)
|
void DataFilesPage::slotProfileChangedByUser(const QString &previous, const QString ¤t)
|
||||||
{
|
{
|
||||||
changeProfiles(previous, current);
|
setProfile(previous, current, true);
|
||||||
emit signalProfileChanged(mSelector->getProfileIndex(current));
|
emit signalProfileChanged (ui.profilesComboBox->findText(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::slotProfileRenamed(const QString &previous, const QString ¤t)
|
void DataFilesPage::slotProfileRenamed(const QString &previous, const QString ¤t)
|
||||||
@ -160,7 +172,7 @@ void DataFilesPage::slotProfileRenamed(const QString &previous, const QString &c
|
|||||||
|
|
||||||
void DataFilesPage::slotProfileChanged(int index)
|
void DataFilesPage::slotProfileChanged(int index)
|
||||||
{
|
{
|
||||||
mSelector->setProfile(index);
|
setProfile (index, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::setupDataFiles()
|
void DataFilesPage::setupDataFiles()
|
||||||
@ -178,21 +190,92 @@ void DataFilesPage::setupDataFiles()
|
|||||||
QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/"));
|
QStringList profiles = mLauncherSettings.subKeys(QString("Profiles/"));
|
||||||
QString profile = mLauncherSettings.value(QString("Profiles/currentprofile"));
|
QString profile = mLauncherSettings.value(QString("Profiles/currentprofile"));
|
||||||
|
|
||||||
|
|
||||||
foreach (const QString &item, profiles)
|
foreach (const QString &item, profiles)
|
||||||
mSelector->addProfile (item);
|
addProfile (item, false);
|
||||||
|
|
||||||
mSelector->addProfile (profile, true);
|
addProfile (profile, true);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *DataFilesPage::profilesModel() const
|
void DataFilesPage::on_newProfileAction_triggered()
|
||||||
{
|
{
|
||||||
return mSelector->profilesModel();
|
TextInputDialog newDialog (tr("New Profile"), tr("Profile name:"), this);
|
||||||
|
|
||||||
|
if (newDialog.exec() != QDialog::Accepted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString profile = newDialog.getText();
|
||||||
|
|
||||||
|
if (profile.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
saveSettings();
|
||||||
|
|
||||||
|
mSelector->clearCheckStates();
|
||||||
|
|
||||||
|
addProfile(profile, true);
|
||||||
|
|
||||||
|
mSelector->setGameFile();
|
||||||
|
|
||||||
|
saveSettings();
|
||||||
|
|
||||||
|
emit signalProfileChanged (ui.profilesComboBox->findText(profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataFilesPage::profilesIndex() const
|
void DataFilesPage::addProfile (const QString &profile, bool setAsCurrent)
|
||||||
{
|
{
|
||||||
return mSelector->getProfileIndex(mSelector->getProfileText());
|
if (profile.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ui.profilesComboBox->findText (profile) != -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ui.profilesComboBox->addItem (profile);
|
||||||
|
|
||||||
|
if (setAsCurrent)
|
||||||
|
setProfile (ui.profilesComboBox->findText (profile), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataFilesPage::on_deleteProfileAction_triggered()
|
||||||
|
{
|
||||||
|
QString profile = ui.profilesComboBox->currentText();
|
||||||
|
|
||||||
|
if (profile.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!showDeleteMessageBox (profile))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Remove the profile from the combobox
|
||||||
|
ui.profilesComboBox->removeItem (ui.profilesComboBox->findText (profile));
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
|
checkForDefaultProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataFilesPage::checkForDefaultProfile()
|
||||||
|
{
|
||||||
|
//don't allow deleting "Default" profile
|
||||||
|
bool success = (ui.profilesComboBox->currentText() != "Default");
|
||||||
|
|
||||||
|
ui.deleteProfileAction->setEnabled (success);
|
||||||
|
ui.profilesComboBox->setEditEnabled (success);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataFilesPage::showDeleteMessageBox (const QString &text)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox(this);
|
||||||
|
msgBox.setWindowTitle(tr("Delete Profile"));
|
||||||
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||||
|
msgBox.setText(tr("Are you sure you want to delete <b>%0</b>?").arg(text));
|
||||||
|
|
||||||
|
QAbstractButton *deleteButton =
|
||||||
|
msgBox.addButton(tr("Delete"), QMessageBox::ActionRole);
|
||||||
|
|
||||||
|
msgBox.exec();
|
||||||
|
|
||||||
|
return (msgBox.clickedButton() == deleteButton);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef DATAFILESPAGE_H
|
#ifndef DATAFILESPAGE_H
|
||||||
#define DATAFILESPAGE_H
|
#define DATAFILESPAGE_H
|
||||||
|
|
||||||
|
#include "ui_datafilespage.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ class QMenu;
|
|||||||
class TextInputDialog;
|
class TextInputDialog;
|
||||||
class GameSettings;
|
class GameSettings;
|
||||||
class LauncherSettings;
|
class LauncherSettings;
|
||||||
|
class ProfilesComboBox;
|
||||||
|
|
||||||
namespace Files { struct ConfigurationManager; }
|
namespace Files { struct ConfigurationManager; }
|
||||||
namespace ContentSelectorView { class ContentSelector; }
|
namespace ContentSelectorView { class ContentSelector; }
|
||||||
@ -22,32 +23,37 @@ class DataFilesPage : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector *mSelector;
|
ContentSelectorView::ContentSelector *mSelector;
|
||||||
|
Ui::DataFilesPage ui;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gameSettings, LauncherSettings &launcherSettings, QWidget *parent = 0);
|
explicit DataFilesPage (Files::ConfigurationManager &cfg, GameSettings &gameSettings,
|
||||||
|
LauncherSettings &launcherSettings, QWidget *parent = 0);
|
||||||
|
|
||||||
QAbstractItemModel* profilesModel() const;
|
QAbstractItemModel* profilesModel() const
|
||||||
int profilesIndex() const;
|
{ return ui.profilesComboBox->model(); }
|
||||||
|
|
||||||
void writeConfig(QString profile = QString());
|
int profilesIndex() const
|
||||||
|
{ return ui.profilesComboBox->currentIndex(); }
|
||||||
|
|
||||||
|
//void writeConfig(QString profile = QString());
|
||||||
void saveSettings(const QString &profile = "");
|
void saveSettings(const QString &profile = "");
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalProfileChanged(int index);
|
void signalProfileChanged (int index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//void showContextMenu(const QPoint &point);
|
void slotProfileChanged (int index);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void slotAddNewProfile(const QString &profile);
|
|
||||||
void slotProfileChangedByUser(const QString &previous, const QString ¤t);
|
void slotProfileChangedByUser(const QString &previous, const QString ¤t);
|
||||||
void slotProfileChanged(int);
|
|
||||||
void slotProfileRenamed(const QString &previous, const QString ¤t);
|
void slotProfileRenamed(const QString &previous, const QString ¤t);
|
||||||
void slotProfileDeleted(const QString &item);
|
void slotProfileDeleted(const QString &item);
|
||||||
|
|
||||||
|
void on_newProfileAction_triggered();
|
||||||
|
void on_deleteProfileAction_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QMenu *mContextMenu;
|
QMenu *mContextMenu;
|
||||||
@ -59,11 +65,16 @@ private:
|
|||||||
|
|
||||||
void setPluginsCheckstates(Qt::CheckState state);
|
void setPluginsCheckstates(Qt::CheckState state);
|
||||||
|
|
||||||
|
void buildView();
|
||||||
void setupDataFiles();
|
void setupDataFiles();
|
||||||
void setupConfig();
|
void setupConfig();
|
||||||
void readConfig();
|
void readConfig();
|
||||||
|
void setProfile (int index, bool savePrevious);
|
||||||
|
void setProfile (const QString &previous, const QString ¤t, bool savePrevious);
|
||||||
void removeProfile (const QString &profile);
|
void removeProfile (const QString &profile);
|
||||||
void changeProfiles(const QString &previous, const QString ¤t, bool savePrevious = true);
|
bool showDeleteMessageBox (const QString &text);
|
||||||
|
void addProfile (const QString &profile, bool setAsCurrent);
|
||||||
|
void checkForDefaultProfile();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -485,7 +485,7 @@ bool MainDialog::setupGameSettings()
|
|||||||
foreach (const QString path, mGameSettings.getDataDirs()) {
|
foreach (const QString path, mGameSettings.getDataDirs()) {
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << "*.esp" << "*.esm";
|
filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon";
|
||||||
|
|
||||||
if (!dir.entryList(filters).isEmpty())
|
if (!dir.entryList(filters).isEmpty())
|
||||||
dataDirs.append(path);
|
dataDirs.append(path);
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#include <QToolButton>
|
#include "lineedit.hpp"
|
||||||
#include <QStyle>
|
|
||||||
|
|
||||||
#include "comboboxlineedit.hpp"
|
LineEdit::LineEdit(QWidget *parent)
|
||||||
|
|
||||||
ContentSelectorView::ComboBoxLineEdit::ComboBoxLineEdit(QWidget *parent)
|
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
|
{
|
||||||
|
setupClearButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LineEdit::setupClearButton()
|
||||||
{
|
{
|
||||||
mClearButton = new QToolButton(this);
|
mClearButton = new QToolButton(this);
|
||||||
QPixmap pixmap(":images/clear.png");
|
QPixmap pixmap(":images/clear.png");
|
||||||
@ -15,13 +17,9 @@ ContentSelectorView::ComboBoxLineEdit::ComboBoxLineEdit(QWidget *parent)
|
|||||||
mClearButton->hide();
|
mClearButton->hide();
|
||||||
connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateClearButton(const QString&)));
|
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateClearButton(const QString&)));
|
||||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
|
||||||
|
|
||||||
setObjectName(QString("ComboBoxLineEdit"));
|
|
||||||
setStyleSheet(QString("ComboBoxLineEdit { background-color: transparent; padding-right: %1px; } ").arg(mClearButton->sizeHint().width() + frameWidth + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ComboBoxLineEdit::resizeEvent(QResizeEvent *)
|
void LineEdit::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
QSize sz = mClearButton->sizeHint();
|
QSize sz = mClearButton->sizeHint();
|
||||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
@ -29,7 +27,7 @@ void ContentSelectorView::ComboBoxLineEdit::resizeEvent(QResizeEvent *)
|
|||||||
(rect().bottom() + 1 - sz.height())/2);
|
(rect().bottom() + 1 - sz.height())/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ComboBoxLineEdit::updateClearButton(const QString& text)
|
void LineEdit::updateClearButton(const QString& text)
|
||||||
{
|
{
|
||||||
mClearButton->setVisible(!text.isEmpty());
|
mClearButton->setVisible(!text.isEmpty());
|
||||||
}
|
}
|
@ -11,29 +11,32 @@
|
|||||||
#define LINEEDIT_H
|
#define LINEEDIT_H
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QStylePainter>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
|
|
||||||
namespace ContentSelectorView
|
class LineEdit : public QLineEdit
|
||||||
{
|
{
|
||||||
class LineEdit : public QLineEdit
|
Q_OBJECT
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
QString mPlaceholderText;
|
QString mPlaceholderText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineEdit(QWidget *parent = 0);
|
LineEdit(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateClearButton(const QString &text);
|
void updateClearButton(const QString &text);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QToolButton *mClearButton;
|
||||||
|
|
||||||
|
void setupClearButton();
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
QToolButton *mClearButton;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif // LIENEDIT_H
|
#endif // LIENEDIT_H
|
||||||
|
|
@ -5,23 +5,17 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include "profilescombobox.hpp"
|
#include "profilescombobox.hpp"
|
||||||
#include "comboboxlineedit.hpp"
|
|
||||||
|
|
||||||
ContentSelectorView::ProfilesComboBox::ProfilesComboBox(QWidget *parent) :
|
ProfilesComboBox::ProfilesComboBox(QWidget *parent) :
|
||||||
QComboBox(parent)
|
ContentSelectorView::ComboBox(parent)
|
||||||
{
|
{
|
||||||
mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
|
||||||
setEditEnabled(true);
|
|
||||||
setValidator(mValidator);
|
|
||||||
setCompleter(0);
|
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(int)), this,
|
connect(this, SIGNAL(activated(int)), this,
|
||||||
SLOT(slotIndexChangedByUser(int)));
|
SLOT(slotIndexChangedByUser(int)));
|
||||||
|
|
||||||
setInsertPolicy(QComboBox::NoInsert);
|
setInsertPolicy(QComboBox::NoInsert);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::setEditEnabled(bool editable)
|
void ProfilesComboBox::setEditEnabled(bool editable)
|
||||||
{
|
{
|
||||||
if (isEditable() == editable)
|
if (isEditable() == editable)
|
||||||
return;
|
return;
|
||||||
@ -37,6 +31,7 @@ void ContentSelectorView::ProfilesComboBox::setEditEnabled(bool editable)
|
|||||||
setValidator(mValidator);
|
setValidator(mValidator);
|
||||||
|
|
||||||
ComboBoxLineEdit *edit = new ComboBoxLineEdit(this);
|
ComboBoxLineEdit *edit = new ComboBoxLineEdit(this);
|
||||||
|
|
||||||
setLineEdit(edit);
|
setLineEdit(edit);
|
||||||
setCompleter(0);
|
setCompleter(0);
|
||||||
|
|
||||||
@ -50,7 +45,7 @@ void ContentSelectorView::ProfilesComboBox::setEditEnabled(bool editable)
|
|||||||
SIGNAL (signalProfileTextChanged (QString)));
|
SIGNAL (signalProfileTextChanged (QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::slotTextChanged(const QString &text)
|
void ProfilesComboBox::slotTextChanged(const QString &text)
|
||||||
{
|
{
|
||||||
QPalette *palette = new QPalette();
|
QPalette *palette = new QPalette();
|
||||||
palette->setColor(QPalette::Text,Qt::red);
|
palette->setColor(QPalette::Text,Qt::red);
|
||||||
@ -64,7 +59,7 @@ void ContentSelectorView::ProfilesComboBox::slotTextChanged(const QString &text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::slotEditingFinished()
|
void ProfilesComboBox::slotEditingFinished()
|
||||||
{
|
{
|
||||||
QString current = currentText();
|
QString current = currentText();
|
||||||
QString previous = itemText(currentIndex());
|
QString previous = itemText(currentIndex());
|
||||||
@ -85,7 +80,7 @@ void ContentSelectorView::ProfilesComboBox::slotEditingFinished()
|
|||||||
emit(profileRenamed(previous, current));
|
emit(profileRenamed(previous, current));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::slotIndexChangedByUser(int index)
|
void ProfilesComboBox::slotIndexChangedByUser(int index)
|
||||||
{
|
{
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
@ -94,23 +89,11 @@ void ContentSelectorView::ProfilesComboBox::slotIndexChangedByUser(int index)
|
|||||||
mOldProfile = currentText();
|
mOldProfile = currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::paintEvent(QPaintEvent *)
|
ProfilesComboBox::ComboBoxLineEdit::ComboBoxLineEdit (QWidget *parent)
|
||||||
|
: LineEdit (parent)
|
||||||
{
|
{
|
||||||
QStylePainter painter(this);
|
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
painter.setPen(palette().color(QPalette::Text));
|
|
||||||
|
|
||||||
// draw the combobox frame, focusrect and selected etc.
|
setObjectName(QString("ComboBoxLineEdit"));
|
||||||
QStyleOptionComboBox opt;
|
setStyleSheet(QString("ComboBoxLineEdit { background-color: transparent; padding-right: %1px; } ").arg(mClearButton->sizeHint().width() + frameWidth + 1));
|
||||||
initStyleOption(&opt);
|
|
||||||
painter.drawComplexControl(QStyle::CC_ComboBox, opt);
|
|
||||||
|
|
||||||
// draw the icon and text
|
|
||||||
if (!opt.editable && currentIndex() == -1) // <<< we adjust the text displayed when nothing is selected
|
|
||||||
opt.currentText = mPlaceholderText;
|
|
||||||
painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ProfilesComboBox::setPlaceholderText(const QString &text)
|
|
||||||
{
|
|
||||||
mPlaceholderText = text;
|
|
||||||
}
|
}
|
40
apps/launcher/utils/profilescombobox.hpp
Normal file
40
apps/launcher/utils/profilescombobox.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef PROFILESCOMBOBOX_HPP
|
||||||
|
#define PROFILESCOMBOBOX_HPP
|
||||||
|
|
||||||
|
#include "components/contentselector/view/combobox.hpp"
|
||||||
|
#include "lineedit.hpp"
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
|
class ProfilesComboBox : public ContentSelectorView::ComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
class ComboBoxLineEdit : public LineEdit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ComboBoxLineEdit (QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit ProfilesComboBox(QWidget *parent = 0);
|
||||||
|
void setEditEnabled(bool editable);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void signalProfileTextChanged(const QString &item);
|
||||||
|
void signalProfileChanged(const QString &previous, const QString ¤t);
|
||||||
|
void signalProfileChanged(int index);
|
||||||
|
void profileRenamed(const QString &oldName, const QString &newName);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void slotEditingFinished();
|
||||||
|
void slotIndexChangedByUser(int index);
|
||||||
|
void slotTextChanged(const QString &text);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString mOldProfile;
|
||||||
|
};
|
||||||
|
#endif // PROFILESCOMBOBOX_HPP
|
@ -7,8 +7,6 @@
|
|||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
#include <components/contentselector/view/lineedit.hpp>
|
|
||||||
|
|
||||||
TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWidget *parent) :
|
TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
@ -20,7 +18,7 @@ TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWid
|
|||||||
|
|
||||||
// Line edit
|
// Line edit
|
||||||
QValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
QValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
||||||
mLineEdit = new ContentSelectorView::LineEdit(this);
|
mLineEdit = new DialogLineEdit(this);
|
||||||
mLineEdit->setValidator(validator);
|
mLineEdit->setValidator(validator);
|
||||||
mLineEdit->setCompleter(0);
|
mLineEdit->setCompleter(0);
|
||||||
|
|
||||||
@ -74,3 +72,16 @@ void TextInputDialog::slotUpdateOkButton(QString text)
|
|||||||
mLineEdit->setPalette(*palette);
|
mLineEdit->setPalette(*palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextInputDialog::DialogLineEdit::DialogLineEdit (QWidget *parent) :
|
||||||
|
LineEdit (parent)
|
||||||
|
{
|
||||||
|
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
|
|
||||||
|
setObjectName(QString("LineEdit"));
|
||||||
|
setStyleSheet(QString("LineEdit { padding-right: %1px; } ").arg(mClearButton->sizeHint().width() + frameWidth + 1));
|
||||||
|
QSize msz = minimumSizeHint();
|
||||||
|
setMinimumSize(qMax(msz.width(), mClearButton->sizeHint().height() + frameWidth * 2 + 2),
|
||||||
|
qMax(msz.height(), mClearButton->sizeHint().height() + frameWidth * 2 + 2));
|
||||||
|
|
||||||
|
}
|
@ -3,23 +3,30 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "lineedit.hpp"
|
||||||
|
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
|
|
||||||
namespace ContentSelectorView {
|
class LineEdit;
|
||||||
class LineEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TextInputDialog : public QDialog
|
class TextInputDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
ContentSelectorView::LineEdit *mLineEdit;
|
class DialogLineEdit : public LineEdit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit DialogLineEdit (QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
DialogLineEdit *mLineEdit;
|
||||||
QDialogButtonBox *mButtonBox;
|
QDialogButtonBox *mButtonBox;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit TextInputDialog(const QString& title, const QString &text, QWidget *parent = 0);
|
explicit TextInputDialog(const QString& title, const QString &text, QWidget *parent = 0);
|
||||||
|
~TextInputDialog () {}
|
||||||
|
|
||||||
QString getText() const;
|
QString getText() const;
|
||||||
|
|
||||||
int exec();
|
int exec();
|
@ -44,6 +44,7 @@ opencs_units_noqt (model/tools
|
|||||||
|
|
||||||
opencs_units (view/doc
|
opencs_units (view/doc
|
||||||
viewmanager view operations operation subview startup filedialog newgame
|
viewmanager view operations operation subview startup filedialog newgame
|
||||||
|
filewidget adjusterwidget
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -122,11 +123,13 @@ opencs_units (view/filter
|
|||||||
set (OPENCS_US
|
set (OPENCS_US
|
||||||
)
|
)
|
||||||
|
|
||||||
set (OPENCS_RES ../../files/opencs/resources.qrc
|
set (OPENCS_RES ${CMAKE_SOURCE_DIR}/files/opencs/resources.qrc
|
||||||
../../files/launcher/launcher.qrc
|
${CMAKE_SOURCE_DIR}/files/launcher/launcher.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
set (OPENCS_UI ../../files/ui/datafilespage.ui
|
set (OPENCS_UI
|
||||||
|
${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
|
||||||
|
${CMAKE_SOURCE_DIR}/files/ui/filedialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
||||||
|
@ -109,15 +109,13 @@ void CS::Editor::createGame()
|
|||||||
void CS::Editor::createAddon()
|
void CS::Editor::createAddon()
|
||||||
{
|
{
|
||||||
mStartup.hide();
|
mStartup.hide();
|
||||||
|
mFileDialog.showDialog (CSVDoc::FileDialog::DialogType_New);
|
||||||
mFileDialog.newFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CS::Editor::loadDocument()
|
void CS::Editor::loadDocument()
|
||||||
{
|
{
|
||||||
mStartup.hide();
|
mStartup.hide();
|
||||||
|
mFileDialog.showDialog (CSVDoc::FileDialog::DialogType_Open);
|
||||||
mFileDialog.openFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CS::Editor::openFiles()
|
void CS::Editor::openFiles()
|
||||||
|
@ -12,81 +12,120 @@
|
|||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
||||||
#include <components/contentselector/model/esmfile.hpp>
|
#include "components/contentselector/model/esmfile.hpp"
|
||||||
#include <components/contentselector/view/lineedit.hpp>
|
|
||||||
#include "components/contentselector/view/contentselector.hpp"
|
#include "components/contentselector/view/contentselector.hpp"
|
||||||
|
#include "filewidget.hpp"
|
||||||
|
#include "adjusterwidget.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent), mSelector (0)
|
||||||
mOpenFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_LoadAddon),
|
|
||||||
mNewFileFlags (ContentSelectorView::Flag_Content | ContentSelectorView::Flag_NewAddon)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
ui.setupUi (this);
|
||||||
resize(400, 400);
|
resize(400, 400);
|
||||||
|
|
||||||
|
setObjectName ("FileDialog");
|
||||||
|
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::addFiles(const QString &path)
|
void CSVDoc::FileDialog::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
ContentSelectorView::ContentSelector::addFiles(path);
|
mSelector->addFiles(path);
|
||||||
}
|
|
||||||
|
|
||||||
QString CSVDoc::FileDialog::filename()
|
|
||||||
{
|
|
||||||
return ContentSelectorView::ContentSelector::instance().projectFilename();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CSVDoc::FileDialog::selectedFilePaths()
|
QStringList CSVDoc::FileDialog::selectedFilePaths()
|
||||||
{
|
{
|
||||||
QStringList filePaths;
|
QStringList filePaths;
|
||||||
|
|
||||||
foreach (ContentSelectorModel::EsmFile *file, ContentSelectorView::ContentSelector::
|
foreach (ContentSelectorModel::EsmFile *file, mSelector->selectedFiles() )
|
||||||
instance().selectedFiles() )
|
|
||||||
{
|
|
||||||
filePaths.append(file->path());
|
filePaths.append(file->path());
|
||||||
}
|
|
||||||
return filePaths;
|
return filePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::showDialog()
|
void CSVDoc::FileDialog::showDialog(DialogType dialogType)
|
||||||
{
|
{
|
||||||
|
mDialogType = dialogType;
|
||||||
|
|
||||||
|
switch (mDialogType)
|
||||||
|
{
|
||||||
|
case DialogType_New:
|
||||||
|
buildNewFileView();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DialogType_Open:
|
||||||
|
buildOpenFileView();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::openFile()
|
void CSVDoc::FileDialog::buildNewFileView()
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Open"));
|
setWindowTitle(tr("Create a new addon"));
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector::configure(this, mOpenFileFlags);
|
QPushButton* createButton = ui.projectButtonBox->button (QDialogButtonBox::Ok);
|
||||||
|
createButton->setText ("Create");
|
||||||
|
createButton->setEnabled (false);
|
||||||
|
|
||||||
connect (&ContentSelectorView::ContentSelector::instance(),
|
mFileWidget = new FileWidget (this);
|
||||||
SIGNAL (accepted()), this, SIGNAL (openFiles()));
|
|
||||||
|
|
||||||
connect (&ContentSelectorView::ContentSelector::instance(),
|
mFileWidget->setType (true);
|
||||||
SIGNAL (rejected()), this, SLOT (slotRejected()));
|
mFileWidget->extensionLabelIsVisible(true);
|
||||||
|
|
||||||
showDialog();
|
ui.projectGroupBoxLayout->insertWidget (0, mFileWidget);
|
||||||
|
|
||||||
|
connect (mFileWidget, SIGNAL (nameChanged(const QString &, bool)),
|
||||||
|
this, SLOT (slotUpdateCreateButton(const QString &, bool)));
|
||||||
|
|
||||||
|
connect (mSelector, SIGNAL (signalCurrentGamefileIndexChanged (int)),
|
||||||
|
this, SLOT (slotUpdateCreateButton (int)));
|
||||||
|
|
||||||
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (createNewFile()));
|
||||||
|
|
||||||
|
connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::newFile()
|
void CSVDoc::FileDialog::buildOpenFileView()
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("New"));
|
setWindowTitle(tr("Open"));
|
||||||
|
ui.projectGroupBox->setTitle (QString(""));
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector::configure(this, mNewFileFlags);
|
connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (openFiles()));
|
||||||
|
connect (ui.projectButtonBox, SIGNAL (rejected()), this , SIGNAL (rejected()));
|
||||||
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
||||||
SIGNAL (accepted()), this, SIGNAL (createNewFile()));
|
|
||||||
|
|
||||||
connect (&ContentSelectorView::ContentSelector::instance(),
|
|
||||||
SIGNAL (rejected()), this, SLOT (slotRejected()));
|
|
||||||
|
|
||||||
showDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::FileDialog::slotRejected()
|
void CSVDoc::FileDialog::slotRejected()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::FileDialog::slotUpdateCreateButton (int)
|
||||||
|
{
|
||||||
|
slotUpdateCreateButton (mFileWidget->getName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVDoc::FileDialog::slotUpdateCreateButton(const QString &name, bool)
|
||||||
|
{
|
||||||
|
if (!(mDialogType == DialogType_New))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool success = (!name.isEmpty() && mSelector->selectedFiles().size() > 0);
|
||||||
|
|
||||||
|
ui.projectButtonBox->button (QDialogButtonBox::Ok)->setEnabled (success);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSVDoc::FileDialog::filename() const
|
||||||
|
{
|
||||||
|
if (mDialogType == DialogType_New)
|
||||||
|
return mFileWidget->getName();
|
||||||
|
|
||||||
|
return QString ("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -3,49 +3,54 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include "../../../../components/contentselector/view/contentselector.hpp"
|
|
||||||
|
|
||||||
class QDialogButtonBox;
|
#include "ui_filedialog.h"
|
||||||
class QSortFilterProxyModel;
|
|
||||||
class QAbstractItemModel;
|
|
||||||
class QPushButton;
|
|
||||||
class QStringList;
|
|
||||||
class QString;
|
|
||||||
class QMenu;
|
|
||||||
class QLabel;
|
|
||||||
|
|
||||||
class DataFilesModel;
|
class DataFilesModel;
|
||||||
class PluginsProxyModel;
|
class PluginsProxyModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace ContentSelectorView
|
namespace ContentSelectorView
|
||||||
{
|
{
|
||||||
class LineEdit;
|
class ContentSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSVDoc
|
namespace CSVDoc
|
||||||
{
|
{
|
||||||
|
class FileWidget;
|
||||||
|
|
||||||
class FileDialog : public QDialog
|
class FileDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
unsigned char mOpenFileFlags;
|
public:
|
||||||
unsigned char mNewFileFlags;
|
|
||||||
|
enum DialogType
|
||||||
|
{
|
||||||
|
DialogType_New,
|
||||||
|
DialogType_Open
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ContentSelectorView::ContentSelector *mSelector;
|
||||||
|
Ui::FileDialog ui;
|
||||||
|
DialogType mDialogType;
|
||||||
|
FileWidget *mFileWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FileDialog(QWidget *parent = 0);
|
|
||||||
|
|
||||||
void openFile();
|
explicit FileDialog(QWidget *parent = 0);
|
||||||
void newFile();
|
void showDialog (DialogType dialogType);
|
||||||
|
|
||||||
void addFiles (const QString &path);
|
void addFiles (const QString &path);
|
||||||
|
|
||||||
QString filename();
|
QString filename() const;
|
||||||
QStringList selectedFilePaths();
|
QStringList selectedFilePaths();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void showDialog();
|
void buildNewFileView();
|
||||||
|
void buildOpenFileView();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
@ -58,6 +63,9 @@ namespace CSVDoc
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
void slotUpdateCreateButton (int);
|
||||||
|
void slotUpdateCreateButton (const QString &, bool);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // FILEDIALOG_HPP
|
#endif // FILEDIALOG_HPP
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "components/contentselector/view/filewidget.hpp"
|
#include "filewidget.hpp"
|
||||||
#include "components/contentselector/view/adjusterwidget.hpp"
|
#include "adjusterwidget.hpp"
|
||||||
|
|
||||||
CSVDoc::NewGameDialogue::NewGameDialogue()
|
CSVDoc::NewGameDialogue::NewGameDialogue()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ add_component_dir (loadinglistener
|
|||||||
loadinglistener
|
loadinglistener
|
||||||
)
|
)
|
||||||
|
|
||||||
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/datafilespage.ui
|
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
|
||||||
)
|
)
|
||||||
find_package(Qt4 COMPONENTS QtCore QtGui)
|
find_package(Qt4 COMPONENTS QtCore QtGui)
|
||||||
|
|
||||||
@ -82,11 +82,7 @@ if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY)
|
|||||||
add_component_qt_dir (contentselector
|
add_component_qt_dir (contentselector
|
||||||
model/modelitem model/esmfile
|
model/modelitem model/esmfile
|
||||||
model/naturalsort model/contentmodel
|
model/naturalsort model/contentmodel
|
||||||
view/profilescombobox view/comboboxlineedit
|
view/combobox view/contentselector
|
||||||
view/lineedit view/contentselector
|
|
||||||
view/filewidget view/adjusterwidget
|
|
||||||
view/textinputdialog
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
include(${QT_USE_FILE})
|
include(${QT_USE_FILE})
|
||||||
|
@ -399,6 +399,10 @@ void ContentSelectorModel::ContentModel::addFile(EsmFile *file)
|
|||||||
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
||||||
mFiles.append(file);
|
mFiles.append(file);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
|
QModelIndex idx = index (mFiles.size() - 2, 0, QModelIndex());
|
||||||
|
|
||||||
|
emit dataChanged (idx, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
@ -466,6 +470,7 @@ void ContentSelectorModel::ContentModel::sortFiles()
|
|||||||
//iterate each file, obtaining a reference to it's gamefiles list
|
//iterate each file, obtaining a reference to it's gamefiles list
|
||||||
for (int i = 0; i < fileCount; i++)
|
for (int i = 0; i < fileCount; i++)
|
||||||
{
|
{
|
||||||
|
QModelIndex idx1 = index (i, 0, QModelIndex());
|
||||||
const QStringList &gamefiles = mFiles.at(i)->gameFiles();
|
const QStringList &gamefiles = mFiles.at(i)->gameFiles();
|
||||||
//iterate each file after the current file, verifying that none of it's
|
//iterate each file after the current file, verifying that none of it's
|
||||||
//dependencies appear.
|
//dependencies appear.
|
||||||
@ -474,6 +479,11 @@ void ContentSelectorModel::ContentModel::sortFiles()
|
|||||||
if (gamefiles.contains(mFiles.at(j)->fileName()))
|
if (gamefiles.contains(mFiles.at(j)->fileName()))
|
||||||
{
|
{
|
||||||
mFiles.move(j, i);
|
mFiles.move(j, i);
|
||||||
|
|
||||||
|
QModelIndex idx2 = index (j, 0, QModelIndex());
|
||||||
|
|
||||||
|
emit dataChanged (idx1, idx2);
|
||||||
|
|
||||||
movedFiles = true;
|
movedFiles = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
components/contentselector/view/combobox.cpp
Normal file
39
components/contentselector/view/combobox.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <QRegExpValidator>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QString>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
#include "combobox.hpp"
|
||||||
|
|
||||||
|
ContentSelectorView::ComboBox::ComboBox(QWidget *parent) :
|
||||||
|
QComboBox(parent)
|
||||||
|
{
|
||||||
|
mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
||||||
|
setValidator(mValidator);
|
||||||
|
setCompleter(0);
|
||||||
|
setEnabled (true);
|
||||||
|
|
||||||
|
setInsertPolicy(QComboBox::NoInsert);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentSelectorView::ComboBox::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QStylePainter painter(this);
|
||||||
|
painter.setPen(palette().color(QPalette::Text));
|
||||||
|
|
||||||
|
// draw the combobox frame, focusrect and selected etc.
|
||||||
|
QStyleOptionComboBox opt;
|
||||||
|
initStyleOption(&opt);
|
||||||
|
painter.drawComplexControl(QStyle::CC_ComboBox, opt);
|
||||||
|
|
||||||
|
// draw the icon and text
|
||||||
|
if (!opt.editable && currentIndex() == -1) // <<< we adjust the text displayed when nothing is selected
|
||||||
|
opt.currentText = mPlaceholderText;
|
||||||
|
painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentSelectorView::ComboBox::setPlaceholderText(const QString &text)
|
||||||
|
{
|
||||||
|
mPlaceholderText = text;
|
||||||
|
}
|
30
components/contentselector/view/combobox.hpp
Normal file
30
components/contentselector/view/combobox.hpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef COMBOBOX_HPP
|
||||||
|
#define COMBOBOX_HPP
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QStylePainter>
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
class QRegExpValidator;
|
||||||
|
|
||||||
|
namespace ContentSelectorView
|
||||||
|
{
|
||||||
|
class ComboBox : public QComboBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ComboBox (QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setPlaceholderText(const QString &text);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString mPlaceholderText;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *);
|
||||||
|
QRegExpValidator *mValidator;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // COMBOBOX_HPP
|
@ -1,37 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
|
|
||||||
**
|
|
||||||
** Use, modification and distribution is allowed without limitation,
|
|
||||||
** warranty, liability or support of any kind.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef LINEEDIT_H
|
|
||||||
#define LINEEDIT_H
|
|
||||||
|
|
||||||
#include <QLineEdit>
|
|
||||||
|
|
||||||
class QToolButton;
|
|
||||||
|
|
||||||
namespace ContentSelectorView
|
|
||||||
{
|
|
||||||
class ComboBoxLineEdit : public QLineEdit
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ComboBoxLineEdit(QWidget *parent = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void resizeEvent(QResizeEvent *);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateClearButton(const QString &text);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QToolButton *mClearButton;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif // LIENEDIT_H
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
#include "contentselector.hpp"
|
#include "contentselector.hpp"
|
||||||
|
|
||||||
#include "../model/esmfile.hpp"
|
#include "../model/esmfile.hpp"
|
||||||
#include "lineedit.hpp"
|
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
@ -11,45 +10,16 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "filewidget.hpp"
|
|
||||||
#include "adjusterwidget.hpp"
|
|
||||||
#include "textinputdialog.hpp"
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector *ContentSelectorView::ContentSelector::mInstance = 0;
|
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
QStringList ContentSelectorView::ContentSelector::mFilePaths;
|
QObject(parent)
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::configure(QWidget *subject, unsigned char flags)
|
|
||||||
{
|
{
|
||||||
assert(!mInstance);
|
ui.setupUi (parent);
|
||||||
mInstance = new ContentSelector (subject, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector& ContentSelectorView::ContentSelector::instance()
|
|
||||||
{
|
|
||||||
|
|
||||||
assert(mInstance);
|
|
||||||
return *mInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent, unsigned char flags) :
|
|
||||||
QWidget(parent), mFlags (flags),
|
|
||||||
mAdjusterWidget (0), mFileWidget (0),
|
|
||||||
mIgnoreProfileSignal (false)
|
|
||||||
{
|
|
||||||
|
|
||||||
ui.setupUi (this);
|
|
||||||
|
|
||||||
parent->setLayout(new QGridLayout());
|
|
||||||
parent->layout()->addWidget(this);
|
|
||||||
|
|
||||||
buildContentModel();
|
buildContentModel();
|
||||||
buildGameFileView();
|
buildGameFileView();
|
||||||
buildAddonView();
|
buildAddonView();
|
||||||
buildNewAddonView();
|
|
||||||
buildLoadAddonView();
|
|
||||||
buildProfilesView();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//mContentModel->sort(3); // Sort by date accessed
|
//mContentModel->sort(3); // Sort by date accessed
|
||||||
@ -57,16 +27,8 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent, unsigned
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentSelectorView::ContentSelector::isFlagged(SelectorFlags flag) const
|
|
||||||
{
|
|
||||||
return (mFlags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildContentModel()
|
void ContentSelectorView::ContentSelector::buildContentModel()
|
||||||
{
|
{
|
||||||
if (!isFlagged (Flag_Content))
|
|
||||||
return;
|
|
||||||
|
|
||||||
mContentModel = new ContentSelectorModel::ContentModel();
|
mContentModel = new ContentSelectorModel::ContentModel();
|
||||||
|
|
||||||
if (mFilePaths.size()>0)
|
if (mFilePaths.size()>0)
|
||||||
@ -83,12 +45,6 @@ void ContentSelectorView::ContentSelector::buildContentModel()
|
|||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildGameFileView()
|
void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
{
|
{
|
||||||
if (!isFlagged (Flag_Content))
|
|
||||||
{
|
|
||||||
ui.gameFileView->setVisible(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.gameFileView->setVisible (true);
|
ui.gameFileView->setVisible (true);
|
||||||
|
|
||||||
mGameFileProxyModel = new QSortFilterProxyModel(this);
|
mGameFileProxyModel = new QSortFilterProxyModel(this);
|
||||||
@ -99,19 +55,17 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
|
|||||||
ui.gameFileView->setPlaceholderText(QString("Select a game file..."));
|
ui.gameFileView->setPlaceholderText(QString("Select a game file..."));
|
||||||
ui.gameFileView->setModel(mGameFileProxyModel);
|
ui.gameFileView->setModel(mGameFileProxyModel);
|
||||||
|
|
||||||
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)), this, SLOT (slotCurrentGameFileIndexChanged(int)));
|
connect (ui.gameFileView, SIGNAL(currentIndexChanged(int)),
|
||||||
|
this, SLOT (slotCurrentGameFileIndexChanged(int)));
|
||||||
|
|
||||||
|
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
|
||||||
|
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
|
||||||
|
|
||||||
ui.gameFileView->setCurrentIndex(-1);
|
ui.gameFileView->setCurrentIndex(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildAddonView()
|
void ContentSelectorView::ContentSelector::buildAddonView()
|
||||||
{
|
{
|
||||||
if (!isFlagged (Flag_Content))
|
|
||||||
{
|
|
||||||
ui.addonView->setVisible(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.addonView->setVisible (true);
|
ui.addonView->setVisible (true);
|
||||||
|
|
||||||
mAddonProxyModel = new QSortFilterProxyModel(this);
|
mAddonProxyModel = new QSortFilterProxyModel(this);
|
||||||
@ -123,91 +77,9 @@ void ContentSelectorView::ContentSelector::buildAddonView()
|
|||||||
ui.addonView->setModel(mAddonProxyModel);
|
ui.addonView->setModel(mAddonProxyModel);
|
||||||
|
|
||||||
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
|
connect(ui.addonView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotAddonTableItemClicked(const QModelIndex &)));
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildProfilesView()
|
for (int i = 0; i < mAddonProxyModel->rowCount(); ++i)
|
||||||
{
|
qDebug() << mAddonProxyModel->data(mAddonProxyModel->index(i,0,QModelIndex()));
|
||||||
if (!isFlagged (Flag_Profile))
|
|
||||||
{
|
|
||||||
ui.profileGroupBox->setVisible(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.profileGroupBox->setVisible (true);
|
|
||||||
|
|
||||||
// Add the actions to the toolbuttons
|
|
||||||
ui.newProfileButton->setDefaultAction (ui.newProfileAction);
|
|
||||||
ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction);
|
|
||||||
|
|
||||||
//enable ui elements
|
|
||||||
ui.profilesComboBox->addItem ("Default");
|
|
||||||
ui.profilesComboBox->setPlaceholderText (QString("Select a profile..."));
|
|
||||||
|
|
||||||
if (!ui.profilesComboBox->isEnabled())
|
|
||||||
ui.profilesComboBox->setEnabled(true);
|
|
||||||
|
|
||||||
if (!ui.deleteProfileAction->isEnabled())
|
|
||||||
ui.deleteProfileAction->setEnabled(true);
|
|
||||||
|
|
||||||
//establish connections
|
|
||||||
connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)), this, SLOT(slotCurrentProfileIndexChanged(int)));
|
|
||||||
connect (ui.profilesComboBox, SIGNAL (profileRenamed(QString,QString)), this, SIGNAL(signalProfileRenamed(QString,QString)));
|
|
||||||
connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString,QString)), this, SIGNAL(signalProfileChangedByUser(QString,QString)));
|
|
||||||
connect (ui.profilesComboBox, SIGNAL (signalProfileTextChanged(QString)), this, SLOT (slotProfileTextChanged (QString)));
|
|
||||||
|
|
||||||
ui.profileGroupBox->setVisible (true);
|
|
||||||
ui.projectButtonBox->setVisible (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildLoadAddonView()
|
|
||||||
{
|
|
||||||
if (!isFlagged (Flag_LoadAddon))
|
|
||||||
{
|
|
||||||
if (!isFlagged (Flag_NewAddon))
|
|
||||||
ui.projectGroupBox->setVisible (false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.projectGroupBox->setVisible (true);
|
|
||||||
ui.projectCreateButton->setVisible (false);
|
|
||||||
ui.projectGroupBox->setTitle ("");
|
|
||||||
|
|
||||||
connect(ui.projectButtonBox, SIGNAL(accepted()), this, SIGNAL(accepted()));
|
|
||||||
connect(ui.projectButtonBox, SIGNAL(rejected()), this, SIGNAL(rejected()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildNewAddonView()
|
|
||||||
{
|
|
||||||
if (!isFlagged (Flag_NewAddon))
|
|
||||||
{
|
|
||||||
if (!isFlagged (Flag_LoadAddon))
|
|
||||||
ui.projectGroupBox->setVisible (false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.projectGroupBox->setVisible (true);
|
|
||||||
|
|
||||||
mFileWidget = new CSVDoc::FileWidget (this);
|
|
||||||
mAdjusterWidget = new CSVDoc::AdjusterWidget (this);
|
|
||||||
|
|
||||||
mFileWidget->setType(true);
|
|
||||||
mFileWidget->extensionLabelIsVisible(false);
|
|
||||||
|
|
||||||
ui.fileWidgetFrame->layout()->addWidget(mFileWidget);
|
|
||||||
ui.adjusterWidgetFrame->layout()->addWidget(mAdjusterWidget);
|
|
||||||
|
|
||||||
ui.projectButtonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
|
||||||
ui.projectButtonBox->addButton(ui.projectCreateButton, QDialogButtonBox::ActionRole);
|
|
||||||
|
|
||||||
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
|
||||||
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
|
||||||
|
|
||||||
connect (mAdjusterWidget, SIGNAL (stateChanged(bool)), this, SLOT (slotUpdateCreateButton(bool)));
|
|
||||||
|
|
||||||
connect(ui.projectCreateButton, SIGNAL(clicked()), this, SIGNAL(accepted()));
|
|
||||||
connect(ui.projectButtonBox, SIGNAL(rejected()), this, SIGNAL(rejected()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::setGameFile(const QString &filename)
|
void ContentSelectorView::ContentSelector::setGameFile(const QString &filename)
|
||||||
@ -239,16 +111,6 @@ void ContentSelectorView::ContentSelector::setCheckStates(const QStringList &lis
|
|||||||
mContentModel->setCheckState(file, Qt::Checked);
|
mContentModel->setCheckState(file, Qt::Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ContentSelectorView::ContentSelector::projectFilename() const
|
|
||||||
{
|
|
||||||
QString filepath = "";
|
|
||||||
|
|
||||||
if (mAdjusterWidget)
|
|
||||||
filepath = QString::fromAscii(mAdjusterWidget->getPath().c_str());
|
|
||||||
|
|
||||||
return filepath;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentSelectorModel::ContentFileList
|
ContentSelectorModel::ContentFileList
|
||||||
ContentSelectorView::ContentSelector::selectedFiles() const
|
ContentSelectorView::ContentSelector::selectedFiles() const
|
||||||
{
|
{
|
||||||
@ -261,65 +123,10 @@ ContentSelectorModel::ContentFileList
|
|||||||
|
|
||||||
void ContentSelectorView::ContentSelector::addFiles(const QString &path)
|
void ContentSelectorView::ContentSelector::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
// if the model hasn't been instantiated, queue the path
|
mContentModel->addFiles(path);
|
||||||
if (!mInstance)
|
|
||||||
mFilePaths.append(path);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mInstance->mContentModel->addFiles(path);
|
|
||||||
mInstance->ui.gameFileView->setCurrentIndex(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ContentSelectorView::ContentSelector::getProfileIndex ( const QString &item) const
|
if (ui.gameFileView->currentIndex() != -1)
|
||||||
{
|
ui.gameFileView->setCurrentIndex(-1);
|
||||||
return ui.profilesComboBox->findText (item);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::addProfile (const QString &item, bool setAsCurrent)
|
|
||||||
{
|
|
||||||
if (item.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString previous = ui.profilesComboBox->currentText();
|
|
||||||
|
|
||||||
if (ui.profilesComboBox->findText(item) == -1)
|
|
||||||
ui.profilesComboBox->addItem(item);
|
|
||||||
|
|
||||||
if (setAsCurrent)
|
|
||||||
setProfile (ui.profilesComboBox->findText(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::setProfile(int index)
|
|
||||||
{
|
|
||||||
//programmatic change requires second call to non-signalized "slot" since no signal responses
|
|
||||||
//occur for programmatic changes to the profilesComboBox.
|
|
||||||
if (index >= -1 && index < ui.profilesComboBox->count())
|
|
||||||
{
|
|
||||||
QString previous = ui.profilesComboBox->itemText(ui.profilesComboBox->currentIndex());
|
|
||||||
QString current = ui.profilesComboBox->itemText(index);
|
|
||||||
|
|
||||||
ui.profilesComboBox->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ContentSelectorView::ContentSelector::getProfileText() const
|
|
||||||
{
|
|
||||||
return ui.profilesComboBox->currentText();
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractItemModel *ContentSelectorView::ContentSelector::profilesModel() const
|
|
||||||
{
|
|
||||||
return ui.profilesComboBox->model();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotCurrentProfileIndexChanged(int index)
|
|
||||||
{
|
|
||||||
//don't allow deleting "Default" profile
|
|
||||||
bool success = (ui.profilesComboBox->itemText(index) != "Default");
|
|
||||||
|
|
||||||
ui.deleteProfileAction->setEnabled(success);
|
|
||||||
ui.profilesComboBox->setEditEnabled(success);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int index)
|
void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int index)
|
||||||
@ -341,16 +148,6 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
|
|||||||
|
|
||||||
if (proxy)
|
if (proxy)
|
||||||
proxy->setDynamicSortFilter(true);
|
proxy->setDynamicSortFilter(true);
|
||||||
|
|
||||||
slotUpdateCreateButton(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotProfileTextChanged(const QString &text)
|
|
||||||
{
|
|
||||||
QPushButton *opnBtn = ui.projectButtonBox->button(QDialogButtonBox::Open);
|
|
||||||
|
|
||||||
if (opnBtn->isEnabled())
|
|
||||||
opnBtn->setEnabled (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
|
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)
|
||||||
@ -362,53 +159,3 @@ void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QMode
|
|||||||
else
|
else
|
||||||
model->setData(index, Qt::Unchecked, Qt::CheckStateRole);
|
model->setData(index, Qt::Unchecked, Qt::CheckStateRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::slotUpdateCreateButton(bool)
|
|
||||||
{
|
|
||||||
//enable only if a game file is selected and the adjuster widget is non-empty
|
|
||||||
bool validGameFile = (ui.gameFileView->currentIndex() != -1);
|
|
||||||
bool validFilename = false;
|
|
||||||
|
|
||||||
if (mAdjusterWidget)
|
|
||||||
validFilename = mAdjusterWidget->isValid();
|
|
||||||
|
|
||||||
ui.projectCreateButton->setEnabled(validGameFile && validFilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::on_newProfileAction_triggered()
|
|
||||||
{
|
|
||||||
TextInputDialog newDialog (tr("New Profile"), tr("Profile name:"), this);
|
|
||||||
|
|
||||||
if (newDialog.exec() == QDialog::Accepted)
|
|
||||||
emit signalAddNewProfile(newDialog.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::on_deleteProfileAction_triggered()
|
|
||||||
{
|
|
||||||
QString profile = ui.profilesComboBox->currentText();
|
|
||||||
|
|
||||||
if (profile.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QMessageBox msgBox(this);
|
|
||||||
msgBox.setWindowTitle(tr("Delete Profile"));
|
|
||||||
msgBox.setIcon(QMessageBox::Warning);
|
|
||||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
|
||||||
msgBox.setText(tr("Are you sure you want to delete <b>%0</b>?").arg(profile));
|
|
||||||
|
|
||||||
QAbstractButton *deleteButton =
|
|
||||||
msgBox.addButton(tr("Delete"), QMessageBox::ActionRole);
|
|
||||||
|
|
||||||
msgBox.exec();
|
|
||||||
|
|
||||||
if (msgBox.clickedButton() != deleteButton)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Remove the profile from the combobox
|
|
||||||
ui.profilesComboBox->removeItem(ui.profilesComboBox->findText(profile));
|
|
||||||
|
|
||||||
//signal for removal from model
|
|
||||||
emit signalProfileDeleted (profile);
|
|
||||||
|
|
||||||
slotCurrentProfileIndexChanged(ui.profilesComboBox->currentIndex());
|
|
||||||
}
|
|
||||||
|
@ -3,38 +3,19 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "ui_datafilespage.h"
|
#include "ui_contentselector.h"
|
||||||
#include "../model/contentmodel.hpp"
|
#include "../model/contentmodel.hpp"
|
||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
|
||||||
namespace CSVDoc
|
|
||||||
{
|
|
||||||
class FileWidget;
|
|
||||||
class AdjusterWidget;
|
|
||||||
}
|
|
||||||
namespace ContentSelectorView
|
namespace ContentSelectorView
|
||||||
{
|
{
|
||||||
enum SelectorFlags
|
|
||||||
{
|
|
||||||
Flag_Content = 0x01, // gamefile combobox & addon list view
|
|
||||||
Flag_NewAddon = 0x02, // enable project button box (Create/Cancel) and file/adjuster widgets
|
|
||||||
Flag_LoadAddon = 0x04, // enable project button box (Open/Cancel)
|
|
||||||
Flag_Profile = 0x08 // enable profile combo box
|
|
||||||
};
|
|
||||||
|
|
||||||
class ContentSelector : public QWidget
|
class ContentSelector : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
unsigned char mFlags;
|
QStringList mFilePaths;
|
||||||
bool mIgnoreProfileSignal;
|
|
||||||
|
|
||||||
static ContentSelector *mInstance;
|
|
||||||
static QStringList mFilePaths;
|
|
||||||
|
|
||||||
CSVDoc::FileWidget *mFileWidget;
|
|
||||||
CSVDoc::AdjusterWidget *mAdjusterWidget;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -44,64 +25,39 @@ namespace ContentSelectorView
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit ContentSelector(QWidget *parent = 0, unsigned char flags = Flag_Content);
|
explicit ContentSelector(QWidget *parent = 0);
|
||||||
|
|
||||||
static void configure(QWidget *subject, unsigned char flags = Flag_Content);
|
void addFiles(const QString &path);
|
||||||
static ContentSelector &instance();
|
|
||||||
static void addFiles(const QString &path);
|
|
||||||
|
|
||||||
void clearCheckStates();
|
void clearCheckStates();
|
||||||
void setCheckStates (const QStringList &list);
|
void setCheckStates (const QStringList &list);
|
||||||
ContentSelectorModel::ContentFileList *CheckedItems();
|
|
||||||
|
|
||||||
QString projectFilename() const;
|
|
||||||
ContentSelectorModel::ContentFileList selectedFiles() const;
|
ContentSelectorModel::ContentFileList selectedFiles() const;
|
||||||
|
|
||||||
QAbstractItemModel *profilesModel() const;
|
void setGameFile (const QString &filename = QString(""));
|
||||||
void setGameFile (const QString &filename = "");
|
|
||||||
void addProfile (const QString &item, bool setAsCurrent = false);
|
bool isGamefileSelected() const
|
||||||
void setProfile (int index);
|
{ return ui.gameFileView->currentIndex() != -1; }
|
||||||
int getProfileIndex (const QString &item) const;
|
|
||||||
QString getProfileText() const;
|
QWidget *uiWidget() const
|
||||||
|
{ return ui.contentGroupBox; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::DataFilesPage ui;
|
Ui::ContentSelector ui;
|
||||||
|
|
||||||
void buildContentModel();
|
void buildContentModel();
|
||||||
void buildGameFileView();
|
void buildGameFileView();
|
||||||
void buildAddonView();
|
void buildAddonView();
|
||||||
void buildProfilesView();
|
|
||||||
void buildNewAddonView();
|
|
||||||
void buildLoadAddonView();
|
|
||||||
|
|
||||||
bool isFlagged(SelectorFlags flag) const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void signalCurrentGamefileIndexChanged (int);
|
||||||
void accepted();
|
|
||||||
void rejected();
|
|
||||||
|
|
||||||
void signalCreateButtonClicked();
|
|
||||||
|
|
||||||
void signalProfileRenamed(QString,QString);
|
|
||||||
void signalProfileChangedByUser(QString,QString);
|
|
||||||
void signalProfileDeleted(QString);
|
|
||||||
void signalAddNewProfile(QString);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void slotProfileTextChanged (const QString &text);
|
|
||||||
void slotCurrentProfileIndexChanged(int index);
|
|
||||||
void slotCurrentGameFileIndexChanged(int index);
|
void slotCurrentGameFileIndexChanged(int index);
|
||||||
void slotAddonTableItemClicked(const QModelIndex &index);
|
void slotAddonTableItemClicked(const QModelIndex &index);
|
||||||
|
|
||||||
void slotUpdateCreateButton (bool);
|
|
||||||
|
|
||||||
// Action slots
|
|
||||||
void on_newProfileAction_triggered();
|
|
||||||
void on_deleteProfileAction_triggered();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#include <QToolButton>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QStylePainter>
|
|
||||||
|
|
||||||
#include "lineedit.hpp"
|
|
||||||
|
|
||||||
ContentSelectorView::LineEdit::LineEdit(QWidget *parent)
|
|
||||||
: QLineEdit(parent)
|
|
||||||
{
|
|
||||||
mClearButton = new QToolButton(this);
|
|
||||||
QPixmap pixmap(":images/clear.png");
|
|
||||||
mClearButton->setIcon(QIcon(pixmap));
|
|
||||||
mClearButton->setIconSize(pixmap.size());
|
|
||||||
mClearButton->setCursor(Qt::ArrowCursor);
|
|
||||||
mClearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
|
|
||||||
mClearButton->hide();
|
|
||||||
connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
|
||||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateClearButton(const QString&)));
|
|
||||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
|
||||||
|
|
||||||
setObjectName(QString("LineEdit"));
|
|
||||||
setStyleSheet(QString("LineEdit { padding-right: %1px; } ").arg(mClearButton->sizeHint().width() + frameWidth + 1));
|
|
||||||
QSize msz = minimumSizeHint();
|
|
||||||
setMinimumSize(qMax(msz.width(), mClearButton->sizeHint().height() + frameWidth * 2 + 2),
|
|
||||||
qMax(msz.height(), mClearButton->sizeHint().height() + frameWidth * 2 + 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::LineEdit::resizeEvent(QResizeEvent *)
|
|
||||||
{
|
|
||||||
QSize sz = mClearButton->sizeHint();
|
|
||||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
|
||||||
mClearButton->move(rect().right() - frameWidth - sz.width(),
|
|
||||||
(rect().bottom() + 1 - sz.height())/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentSelectorView::LineEdit::updateClearButton(const QString& text)
|
|
||||||
{
|
|
||||||
mClearButton->setVisible(!text.isEmpty());
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
#ifndef PROFILESCOMBOBOX_HPP
|
|
||||||
#define PROFILESCOMBOBOX_HPP
|
|
||||||
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QStylePainter>
|
|
||||||
class QString;
|
|
||||||
class QRegExpValidator;
|
|
||||||
|
|
||||||
namespace ContentSelectorView
|
|
||||||
{
|
|
||||||
class ProfilesComboBox : public QComboBox
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ProfilesComboBox(QWidget *parent = 0);
|
|
||||||
void setEditEnabled(bool editable);
|
|
||||||
void setPlaceholderText(const QString &text);
|
|
||||||
// void indexChanged(int index);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void signalProfileTextChanged(const QString &item);
|
|
||||||
void signalProfileChanged(const QString &previous, const QString ¤t);
|
|
||||||
void signalProfileChanged(int index);
|
|
||||||
void profileRenamed(const QString &oldName, const QString &newName);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void slotEditingFinished();
|
|
||||||
void slotIndexChangedByUser(int index);
|
|
||||||
void slotTextChanged(const QString &text);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString mOldProfile;
|
|
||||||
QString mPlaceholderText;
|
|
||||||
QRegExpValidator *mValidator;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // PROFILESCOMBOBOX_HPP
|
|
111
files/ui/contentselector.ui
Normal file
111
files/ui/contentselector.ui
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ContentSelector</class>
|
||||||
|
<widget class="QWidget" name="ContentSelector">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>518</width>
|
||||||
|
<height>436</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="contentGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Content</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="ContentSelectorView::ComboBox" name="gameFileView">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="addonView">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="dragEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropOverwriteMode">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
|
</property>
|
||||||
|
<property name="defaultDropAction">
|
||||||
|
<enum>Qt::MoveAction</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textElideMode">
|
||||||
|
<enum>Qt::ElideLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ContentSelectorView::ComboBox</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>components/contentselector/view/combobox.hpp</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>518</width>
|
<width>518</width>
|
||||||
<height>436</height>
|
<height>108</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -21,188 +21,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="contentGroupBox">
|
<widget class="QWidget" name="contentSelectorWidget" native="true"/>
|
||||||
<property name="title">
|
|
||||||
<string>Content</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="filterLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="ContentSelectorView::ProfilesComboBox" name="gameFileView">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QTableView" name="addonView">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::DefaultContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
<property name="acceptDrops">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="dragEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropOverwriteMode">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropMode">
|
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
|
||||||
</property>
|
|
||||||
<property name="defaultDropAction">
|
|
||||||
<enum>Qt::MoveAction</enum>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="textElideMode">
|
|
||||||
<enum>Qt::ElideLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="showGrid">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="horizontalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="projectGroupBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Project</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="fileWidgetFrame">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="projectCreateButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Create</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="adjusterWidgetFrame">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="profileGroupBox">
|
<widget class="QGroupBox" name="profileGroupBox">
|
||||||
@ -232,9 +51,9 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ContentSelectorView::ProfilesComboBox" name="profilesComboBox">
|
<widget class="ProfilesComboBox" name="profilesComboBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@ -242,6 +61,9 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select a profiile</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -276,13 +98,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="projectButtonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Open</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
<action name="newProfileAction">
|
<action name="newProfileAction">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
@ -332,9 +147,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ContentSelectorView::ProfilesComboBox</class>
|
<class>ProfilesComboBox</class>
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header>components/contentselector/view/profilescombobox.hpp</header>
|
<header>apps/launcher/utils/profilescombobox.hpp</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
73
files/ui/filedialog.ui
Normal file
73
files/ui/filedialog.ui
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FileDialog</class>
|
||||||
|
<widget class="QWidget" name="FileDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>518</width>
|
||||||
|
<height>108</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="contentSelectorWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="projectGroupBox">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Project Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="projectGroupBoxLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="projectWidget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="projectButtonBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="projectButtonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user