Implement a refresh button on data files page

pull/578/head
James Moore 5 years ago committed by Andrei Kortunov
parent f4ace20885
commit a37bdfd492

@ -88,6 +88,7 @@ Programmers
Jacob Essex (Yacoby) Jacob Essex (Yacoby)
Jake Westrip (16bitint) Jake Westrip (16bitint)
James Carty (MrTopCat) James Carty (MrTopCat)
James Moore (moore.work)
James Stephens (james-h-stephens) James Stephens (james-h-stephens)
Jan-Peter Nilsson (peppe) Jan-Peter Nilsson (peppe)
Jan Borsodi (am0s) Jan Borsodi (am0s)

@ -252,6 +252,7 @@
Feature #5091: Human-readable light source duration Feature #5091: Human-readable light source duration
Feature #5094: Unix like console hotkeys Feature #5094: Unix like console hotkeys
Feature #5098: Allow user controller bindings Feature #5098: Allow user controller bindings
Feature #5114: Refresh launcher mod list
Feature #5121: Handle NiTriStrips and NiTriStripsData Feature #5121: Handle NiTriStrips and NiTriStripsData
Feature #5122: Use magic glow for enchanted arrows Feature #5122: Use magic glow for enchanted arrows
Feature #5131: Custom skeleton bones Feature #5131: Custom skeleton bones

@ -62,10 +62,13 @@ void Launcher::DataFilesPage::buildView()
{ {
ui.verticalLayout->insertWidget (0, mSelector->uiWidget()); ui.verticalLayout->insertWidget (0, mSelector->uiWidget());
QToolButton * refreshButton = mSelector->refreshButton();
//tool buttons //tool buttons
ui.newProfileButton->setToolTip ("Create a new Content List"); ui.newProfileButton->setToolTip ("Create a new Content List");
ui.cloneProfileButton->setToolTip ("Clone the current Content List"); ui.cloneProfileButton->setToolTip ("Clone the current Content List");
ui.deleteProfileButton->setToolTip ("Delete an existing Content List"); ui.deleteProfileButton->setToolTip ("Delete an existing Content List");
refreshButton->setToolTip("Refresh Data Files");
//combo box //combo box
ui.profilesComboBox->addItem(mDefaultContentListName); ui.profilesComboBox->addItem(mDefaultContentListName);
@ -76,6 +79,7 @@ void Launcher::DataFilesPage::buildView()
ui.newProfileButton->setDefaultAction (ui.newProfileAction); ui.newProfileButton->setDefaultAction (ui.newProfileAction);
ui.cloneProfileButton->setDefaultAction (ui.cloneProfileAction); ui.cloneProfileButton->setDefaultAction (ui.cloneProfileAction);
ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction); ui.deleteProfileButton->setDefaultAction (ui.deleteProfileAction);
refreshButton->setDefaultAction(ui.refreshDataFilesAction);
//establish connections //establish connections
connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)), connect (ui.profilesComboBox, SIGNAL (currentIndexChanged(int)),
@ -86,6 +90,8 @@ void Launcher::DataFilesPage::buildView()
connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString, QString)), connect (ui.profilesComboBox, SIGNAL (signalProfileChanged(QString, QString)),
this, SLOT (slotProfileChangedByUser(QString, QString))); this, SLOT (slotProfileChangedByUser(QString, QString)));
connect(ui.refreshDataFilesAction, SIGNAL(triggered()),this, SLOT(slotRefreshButtonClicked()));
} }
bool Launcher::DataFilesPage::loadSettings() bool Launcher::DataFilesPage::loadSettings()
@ -114,6 +120,8 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
if (!mDataLocal.isEmpty()) if (!mDataLocal.isEmpty())
paths.insert(0, mDataLocal); paths.insert(0, mDataLocal);
mSelector->clearFiles();
for (const QString &path : paths) for (const QString &path : paths)
mSelector->addFiles(path); mSelector->addFiles(path);
@ -167,7 +175,16 @@ QStringList Launcher::DataFilesPage::selectedFilePaths()
QStringList filePaths; QStringList filePaths;
for (const ContentSelectorModel::EsmFile *item : items) 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; return filePaths;
} }
@ -221,6 +238,18 @@ void Launcher::DataFilesPage::slotProfileDeleted (const QString &item)
removeProfile (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 &current) void Launcher::DataFilesPage::slotProfileChangedByUser(const QString &previous, const QString &current)
{ {
setProfile(previous, current, true); setProfile(previous, current, true);

@ -61,6 +61,7 @@ namespace Launcher
void slotProfileRenamed(const QString &previous, const QString &current); void slotProfileRenamed(const QString &previous, const QString &current);
void slotProfileDeleted(const QString &item); void slotProfileDeleted(const QString &item);
void slotAddonDataChanged (); void slotAddonDataChanged ();
void slotRefreshButtonClicked ();
void updateNewProfileOkButton(const QString &text); void updateNewProfileOkButton(const QString &text);
void updateCloneProfileOkButton(const QString &text); void updateCloneProfileOkButton(const QString &text);
@ -100,6 +101,7 @@ namespace Launcher
void checkForDefaultProfile(); void checkForDefaultProfile();
void populateFileViews(const QString& contentModelName); void populateFileViews(const QString& contentModelName);
void reloadCells(QStringList selectedFiles); void reloadCells(QStringList selectedFiles);
void refreshDataFilesView ();
class PathIterator class PathIterator
{ {

@ -44,6 +44,9 @@ namespace ContentSelectorView
QWidget *uiWidget() const QWidget *uiWidget() const
{ return ui.contentGroupBox; } { return ui.contentGroupBox; }
QToolButton *refreshButton() const
{ return ui.refreshButton; }
private: private:

@ -20,7 +20,16 @@
<enum>Qt::DefaultContextMenu</enum> <enum>Qt::DefaultContextMenu</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <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> <number>0</number>
</property> </property>
<item> <item>
@ -33,10 +42,41 @@
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<widget class="ContentSelectorView::ComboBox" name="gameFileView"> <widget class="QWidget" name="gameSelectorGroup" native="true">
<property name="editable"> <property name="focusPolicy">
<bool>false</bool> <enum>Qt::NoFocus</enum>
</property> </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> </widget>
</item> </item>
<item> <item>

@ -159,6 +159,22 @@
<string>Uncheck Selection</string> <string>Uncheck Selection</string>
</property> </property>
</action> </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> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

Loading…
Cancel
Save