mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 14:59:54 +00:00
Implement a refresh button on data files page
This commit is contained in:
parent
f4ace20885
commit
a37bdfd492
7 changed files with 97 additions and 5 deletions
|
@ -88,6 +88,7 @@ Programmers
|
|||
Jacob Essex (Yacoby)
|
||||
Jake Westrip (16bitint)
|
||||
James Carty (MrTopCat)
|
||||
James Moore (moore.work)
|
||||
James Stephens (james-h-stephens)
|
||||
Jan-Peter Nilsson (peppe)
|
||||
Jan Borsodi (am0s)
|
||||
|
|
|
@ -252,6 +252,7 @@
|
|||
Feature #5091: Human-readable light source duration
|
||||
Feature #5094: Unix like console hotkeys
|
||||
Feature #5098: Allow user controller bindings
|
||||
Feature #5114: Refresh launcher mod list
|
||||
Feature #5121: Handle NiTriStrips and NiTriStripsData
|
||||
Feature #5122: Use magic glow for enchanted arrows
|
||||
Feature #5131: Custom skeleton bones
|
||||
|
|
|
@ -62,10 +62,13 @@ void Launcher::DataFilesPage::buildView()
|
|||
{
|
||||
ui.verticalLayout->insertWidget (0, mSelector->uiWidget());
|
||||
|
||||
QToolButton * refreshButton = mSelector->refreshButton();
|
||||
|
||||
//tool buttons
|
||||
ui.newProfileButton->setToolTip ("Create a new Content List");
|
||||
ui.cloneProfileButton->setToolTip ("Clone the current Content List");
|
||||
ui.deleteProfileButton->setToolTip ("Delete an existing Content List");
|
||||
refreshButton->setToolTip("Refresh Data Files");
|
||||
|
||||
//combo box
|
||||
ui.profilesComboBox->addItem(mDefaultContentListName);
|
||||
|
@ -76,6 +79,7 @@ void Launcher::DataFilesPage::buildView()
|
|||
ui.newProfileButton->setDefaultAction (ui.newProfileAction);
|
||||
ui.cloneProfileButton->setDefaultAction (ui.cloneProfileAction);
|
||||
ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction);
|
||||
refreshButton->setDefaultAction(ui.refreshDataFilesAction);
|
||||
|
||||
//establish connections
|
||||
connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)),
|
||||
|
@ -86,6 +90,8 @@ void Launcher::DataFilesPage::buildView()
|
|||
|
||||
connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString, QString)),
|
||||
this, SLOT (slotProfileChangedByUser(QString, QString)));
|
||||
|
||||
connect(ui.refreshDataFilesAction, SIGNAL(triggered()),this, SLOT(slotRefreshButtonClicked()));
|
||||
}
|
||||
|
||||
bool Launcher::DataFilesPage::loadSettings()
|
||||
|
@ -114,6 +120,8 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||
if (!mDataLocal.isEmpty())
|
||||
paths.insert(0, mDataLocal);
|
||||
|
||||
mSelector->clearFiles();
|
||||
|
||||
for (const QString &path : paths)
|
||||
mSelector->addFiles(path);
|
||||
|
||||
|
@ -167,7 +175,16 @@ QStringList Launcher::DataFilesPage::selectedFilePaths()
|
|||
QStringList filePaths;
|
||||
for (const ContentSelectorModel::EsmFile *item : items)
|
||||
{
|
||||
filePaths.append(item->filePath());
|
||||
QFile file(item->filePath());
|
||||
|
||||
if(file.exists())
|
||||
{
|
||||
filePaths.append(item->filePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
slotRefreshButtonClicked();
|
||||
}
|
||||
}
|
||||
return filePaths;
|
||||
}
|
||||
|
@ -221,6 +238,18 @@ void Launcher::DataFilesPage::slotProfileDeleted (const QString &item)
|
|||
removeProfile (item);
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage:: refreshDataFilesView ()
|
||||
{
|
||||
QString currentProfile = ui.profilesComboBox->currentText();
|
||||
saveSettings(currentProfile);
|
||||
populateFileViews(currentProfile);
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage::slotRefreshButtonClicked ()
|
||||
{
|
||||
refreshDataFilesView();
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage::slotProfileChangedByUser(const QString &previous, const QString ¤t)
|
||||
{
|
||||
setProfile(previous, current, true);
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace Launcher
|
|||
void slotProfileRenamed(const QString &previous, const QString ¤t);
|
||||
void slotProfileDeleted(const QString &item);
|
||||
void slotAddonDataChanged ();
|
||||
void slotRefreshButtonClicked ();
|
||||
|
||||
void updateNewProfileOkButton(const QString &text);
|
||||
void updateCloneProfileOkButton(const QString &text);
|
||||
|
@ -100,6 +101,7 @@ namespace Launcher
|
|||
void checkForDefaultProfile();
|
||||
void populateFileViews(const QString& contentModelName);
|
||||
void reloadCells(QStringList selectedFiles);
|
||||
void refreshDataFilesView ();
|
||||
|
||||
class PathIterator
|
||||
{
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace ContentSelectorView
|
|||
QWidget *uiWidget() const
|
||||
{ return ui.contentGroupBox; }
|
||||
|
||||
QToolButton *refreshButton() const
|
||||
{ return ui.refreshButton; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -20,7 +20,16 @@
|
|||
<enum>Qt::DefaultContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -33,10 +42,41 @@
|
|||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ContentSelectorView::ComboBox" name="gameFileView">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
<widget class="QWidget" name="gameSelectorGroup" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ContentSelectorView::ComboBox" name="gameFileView">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="refreshButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -159,6 +159,22 @@
|
|||
<string>Uncheck Selection</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="refreshDataFilesAction">
|
||||
<property name="icon">
|
||||
<iconset theme="view-refresh">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Refresh Data Files</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Refresh Data Files</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Reference in a new issue