Merge pull request #806 from ModOrganizer2/qt-5.13

Qt 5.13
This commit is contained in:
Jeremy Rimpo
2019-08-02 00:33:02 -05:00
committed by GitHub
20 changed files with 47 additions and 32 deletions
+2 -4
View File
@@ -35,7 +35,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QInputDialog>
#include <QWebEngineHistory>
#include <QDir>
#include <QDesktopWidget>
#include <QKeyEvent>
@@ -138,9 +137,8 @@ void BrowserDialog::maximizeWidth()
int contentWidth = getCurrentView()->page()->contentsSize().width();
QDesktopWidget screen;
int currentScreen = screen.screenNumber(this);
int screenWidth = screen.screenGeometry(currentScreen).size().width();
QScreen* screen = this->window()->windowHandle()->screen();
int screenWidth = screen->geometry().size().width();
int targetWidth = std::min<int>(std::max<int>(viewportWidth, contentWidth) + frameWidth, screenWidth);
this->resize(targetWidth, height());
+7 -2
View File
@@ -717,7 +717,7 @@ void DownloadManager::refreshAlphabeticalTranslation()
m_AlphabeticalTranslation.push_back(pos);
}
qSort(m_AlphabeticalTranslation.begin(), m_AlphabeticalTranslation.end(), LessThanWrapper(this));
std::sort(m_AlphabeticalTranslation.begin(), m_AlphabeticalTranslation.end(), LessThanWrapper(this));
}
@@ -1155,7 +1155,12 @@ QDateTime DownloadManager::getFileTime(int index) const
DownloadInfo *info = m_ActiveDownloads.at(index);
if (!info->m_Created.isValid()) {
info->m_Created = QFileInfo(info->m_Output).created();
QFileInfo fileInfo(info->m_Output);
info->m_Created = fileInfo.birthTime();
if (!info->m_Created.isValid())
info->m_Created = fileInfo.metadataChangeTime();
if (!info->m_Created.isValid())
info->m_Created = fileInfo.lastModified();
}
return info->m_Created;
+1 -1
View File
@@ -61,7 +61,7 @@ void ListDialog::on_filterEdit_textChanged(QString filter)
if (newChoices.length() == 1) {
QListWidgetItem *item = ui->choiceList->item(0);
ui->choiceList->setItemSelected(item, true);
item->setSelected(true);
ui->choiceList->setCurrentItem(item);
}
+6 -3
View File
@@ -666,9 +666,12 @@ int runApplication(MOApplication &application, SingleInstance &instance,
if (settings.contains("window_monitor")) {
const int monitor = settings.value("window_monitor").toInt();
if (monitor != -1) {
QDesktopWidget* desktop = QApplication::desktop();
const QPoint center = desktop->availableGeometry(monitor).center();
if (monitor != -1 && QGuiApplication::screens().size() > monitor) {
QGuiApplication::screens().at(monitor)->geometry().center();
const QPoint center = QGuiApplication::screens().at(monitor)->geometry().center();
splash.move(center - splash.rect().center());
} else {
const QPoint center = QGuiApplication::primaryScreen()->geometry().center();
splash.move(center - splash.rect().center());
}
}
+9 -3
View File
@@ -99,7 +99,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QCoreApplication>
#include <QCursor>
#include <QDebug>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QDialog>
#include <QDirIterator>
@@ -1342,7 +1341,12 @@ void MainWindow::displaySaveGameInfo(QListWidgetItem *newItem)
}
m_CurrentSaveView->setSave(save);
QRect screenRect = QApplication::desktop()->availableGeometry(m_CurrentSaveView);
QWindow *window = m_CurrentSaveView->window()->windowHandle();
QRect screenRect;
if (window == nullptr)
screenRect = QGuiApplication::primaryScreen()->geometry();
else
screenRect = window->screen()->geometry();
QPoint pos = QCursor::pos();
if (pos.x() + m_CurrentSaveView->width() > screenRect.right()) {
@@ -2281,7 +2285,9 @@ void MainWindow::storeSettings(QSettings &settings) {
settings.setValue("menubar_visible", m_menuBarVisible);
settings.setValue("statusbar_visible", m_statusBarVisible);
settings.setValue("window_split", ui->splitter->saveState());
settings.setValue("window_monitor", QApplication::desktop()->screenNumber(this));
QScreen *screen = this->window()->windowHandle()->screen();
int screenId = QGuiApplication::screens().indexOf(screen);
settings.setValue("window_monitor", screenId);
settings.setValue("log_split", ui->topLevelSplitter->saveState());
settings.setValue("browser_geometry", m_IntegratedBrowser.saveGeometry());
settings.setValue("filters_visible", ui->displayCategoriesBtn->isChecked());
+1 -1
View File
@@ -50,7 +50,7 @@ public:
if(element == QStyle::PE_IndicatorItemViewItemDrop) {
painter->setRenderHint(QPainter::Antialiasing, true);
QColor col(option->palette.foreground().color());
QColor col(option->palette.windowText().color());
QPen pen(col);
pen.setWidth(2);
col.setAlpha(50);
+2
View File
@@ -6,6 +6,8 @@
class ModInfoBackup : public ModInfoRegular
{
Q_OBJECT
friend class ModInfo;
public:
+5 -6
View File
@@ -7,7 +7,6 @@
using namespace MOShared;
using namespace MOBase;
namespace shell = MOBase::shell;
// if there are more than 50 selected items in the conflict tree, don't bother
// checking whether menu items apply to them, just show all of them
@@ -935,7 +934,7 @@ ConflictItem GeneralConflictsTab::createOverwriteItem(
auto origin = ToQString(ds.getOriginByID(alternatives.back().first).getName());
return ConflictItem(
ToQString(altString), std::move(relativeName), QString::null, index,
ToQString(altString), std::move(relativeName), QString(), index,
std::move(fileName), true, std::move(origin), archive);
}
@@ -943,8 +942,8 @@ ConflictItem GeneralConflictsTab::createNoConflictItem(
FileEntry::Index index, bool archive, QString fileName, QString relativeName)
{
return ConflictItem(
QString::null, std::move(relativeName), QString::null, index,
std::move(fileName), false, QString::null, archive);
QString(), std::move(relativeName), QString(), index,
std::move(fileName), false, QString(), archive);
}
ConflictItem GeneralConflictsTab::createOverwrittenItem(
@@ -958,7 +957,7 @@ ConflictItem GeneralConflictsTab::createOverwrittenItem(
QString altOrigin = after;
return ConflictItem(
QString::null, std::move(relativeName), std::move(after),
QString(), std::move(relativeName), std::move(after),
index, std::move(fileName), true, std::move(altOrigin), archive);
}
@@ -1225,5 +1224,5 @@ std::optional<ConflictItem> AdvancedConflictsTab::createItem(
return ConflictItem(
std::move(beforeQS), std::move(relativeName), std::move(afterQS),
index, std::move(fileName), hasAlts, QString::null, archive);
index, std::move(fileName), hasAlts, QString(), archive);
}
+3
View File
@@ -2,9 +2,12 @@
#define MODINFODIALOGFILETREE_H
#include "modinfodialogtab.h"
#include <QFileSystemModel>
class FileTreeTab : public ModInfoDialogTab
{
Q_OBJECT;
public:
FileTreeTab(ModInfoDialogTabContext cx);
+2
View File
@@ -32,6 +32,8 @@ signals:
class NexusTab : public ModInfoDialogTab
{
Q_OBJECT;
public:
NexusTab(ModInfoDialogTabContext cx);
+1 -1
View File
@@ -55,7 +55,7 @@ ModInfoForeign::ModInfoForeign(const QString &modName,
PluginContainer *pluginContainer)
: ModInfoWithConflictInfo(pluginContainer, directoryStructure),
m_ReferenceFile(referenceFile), m_Archives(archives) {
m_CreationTime = QFileInfo(referenceFile).created();
m_CreationTime = QFileInfo(referenceFile).birthTime();
switch (modType) {
case ModInfo::EModType::MOD_DLC:
m_Name = tr("DLC: ") + modName;
+1 -1
View File
@@ -39,7 +39,7 @@ ModInfoRegular::ModInfoRegular(PluginContainer *pluginContainer, const IPluginGa
, m_NexusBridge(pluginContainer)
{
testValid();
m_CreationTime = QFileInfo(path.absolutePath()).created();
m_CreationTime = QFileInfo(path.absolutePath()).birthTime();
// read out the meta-file for information
readMeta();
if (m_GameName.compare(game->gameShortName(), Qt::CaseInsensitive) != 0)
+2
View File
@@ -6,6 +6,8 @@
class ModInfoSeparator:
public ModInfoRegular
{
Q_OBJECT;
friend class ModInfo;
public:
+1 -1
View File
@@ -1324,7 +1324,7 @@ bool ModList::moveSelection(QAbstractItemView *itemView, int direction)
QModelIndexList rows = selectionModel->selectedRows();
if (direction > 0) {
for (int i = 0; i < rows.size() / 2; ++i) {
rows.swap(i, rows.size() - i - 1);
rows.swapItemsAt(i, rows.size() - i - 1);
}
}
for (QModelIndex idx : rows) {
-1
View File
@@ -32,7 +32,6 @@ using namespace MOBase;
class MyFileSystemModel : public QFileSystemModel {
public:
MyFileSystemModel(QObject *parent)
: QFileSystemModel(parent), m_RegularColumnCount(0) {}
-1
View File
@@ -91,7 +91,6 @@
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDialog>
#include <QDialogButtonBox>
#include <QDir>
+1 -1
View File
@@ -1304,7 +1304,7 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event)
}
if (keyEvent->key() == Qt::Key_Down) {
for (int i = 0; i < rows.size() / 2; ++i) {
rows.swap(i, rows.size() - i - 1);
rows.swapItemsAt(i, rows.size() - i - 1);
}
}
for (QModelIndex idx : rows) {
+1 -4
View File
@@ -22,14 +22,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel>
#include <QImageReader>
#include <QTextEdit>
#include <QDesktopWidget>
#include <utility.h>
PreviewGenerator::PreviewGenerator()
{
QDesktopWidget desk;
m_MaxSize = desk.screenGeometry().size() * 0.8;
m_MaxSize = QGuiApplication::primaryScreen()->size() * 0.8;
}
void PreviewGenerator::registerPlugin(MOBase::IPluginPreview *plugin)
+1 -1
View File
@@ -899,7 +899,7 @@ void Profile::rename(const QString &newName)
{
QDir profileDir(Settings::instance().getProfileDirectory());
profileDir.rename(name(), newName);
m_Directory = profileDir.absoluteFilePath(newName);
m_Directory.setPath(profileDir.absoluteFilePath(newName));
}
QVariant Profile::setting(const QString &section, const QString &name,
+1 -1
View File
@@ -61,7 +61,7 @@ public:
virtual QDateTime getCreationTime() const override
{
return QFileInfo(m_File).created();
return QFileInfo(m_File).birthTime();
}
virtual QString getSaveGroupIdentifier() const override