Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Qt 5.13 #806

Merged
merged 8 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/browserdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>


Expand Down Expand Up @@ -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());
Expand Down
9 changes: 7 additions & 2 deletions src/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/listdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
9 changes: 6 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -1343,7 +1342,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()) {
Expand Down Expand Up @@ -2282,7 +2286,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());
Expand Down
2 changes: 1 addition & 1 deletion src/moapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ProxyStyle : public QProxyStyle {
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);
Expand Down
2 changes: 2 additions & 0 deletions src/modinfobackup.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class ModInfoBackup : public ModInfoRegular
{

Q_OBJECT

friend class ModInfo;

public:
Expand Down
11 changes: 5 additions & 6 deletions src/modinfodialogconflicts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -935,16 +934,16 @@ 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);
}

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(
Expand All @@ -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);
}

Expand Down Expand Up @@ -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 changes: 3 additions & 0 deletions src/modinfodialogfiletree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
#define MODINFODIALOGFILETREE_H

#include "modinfodialogtab.h"
#include <QFileSystemModel>

class FileTreeTab : public ModInfoDialogTab
{
Q_OBJECT;

public:
FileTreeTab(ModInfoDialogTabContext cx);

Expand Down
2 changes: 2 additions & 0 deletions src/modinfodialognexus.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class NexusTabWebpage : public QWebEnginePage

class NexusTab : public ModInfoDialogTab
{
Q_OBJECT;

public:
NexusTab(ModInfoDialogTabContext cx);

Expand Down
2 changes: 1 addition & 1 deletion src/modinfoforeign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/modinforegular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/modinfoseparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class ModInfoSeparator:
public ModInfoRegular
{
Q_OBJECT;

friend class ModInfo;

public:
Expand Down
2 changes: 1 addition & 1 deletion src/modlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/overwriteinfodialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ using namespace MOBase;


class MyFileSystemModel : public QFileSystemModel {

public:
MyFileSystemModel(QObject *parent)
: QFileSystemModel(parent), m_RegularColumnCount(0) {}
Expand Down
1 change: 0 additions & 1 deletion src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDialog>
#include <QDialogButtonBox>
#include <QDir>
Expand Down
2 changes: 1 addition & 1 deletion src/pluginlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 1 addition & 4 deletions src/previewgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/transfersavesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DummySave : public ISaveGame

virtual QDateTime getCreationTime() const override
{
return QFileInfo(m_File).created();
return QFileInfo(m_File).birthTime();
}

virtual QString getSaveGroupIdentifier() const override
Expand Down