Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into skin_selector
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -85,6 +85,7 @@ QString getCreditsHtml()
|
||||
stream << QString("<p>TayouVR %1</p>\n").arg(getGitHub("TayouVR"));
|
||||
stream << QString("<p>TheKodeToad %1</p>\n").arg(getGitHub("TheKodeToad"));
|
||||
stream << QString("<p>getchoo %1</p>\n").arg(getGitHub("getchoo"));
|
||||
stream << QString("<p>Alexandru Tripon (Trial97) %1</p>\n").arg(getGitHub("Trial97"));
|
||||
stream << "<br />\n";
|
||||
|
||||
// TODO: possibly retrieve from git history at build time?
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <QApplication>
|
||||
#include <QCache>
|
||||
#include <QDrag>
|
||||
#include <QFont>
|
||||
#include <QListView>
|
||||
#include <QMimeData>
|
||||
#include <QMouseEvent>
|
||||
@ -478,6 +479,38 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
|
||||
#endif
|
||||
option.widget = this;
|
||||
|
||||
if (model()->rowCount() == 0) {
|
||||
painter.save();
|
||||
const QString line1 = tr("Welcome!");
|
||||
const QString line2 = tr("Click \"Add Instance\" to get started.");
|
||||
auto rect = this->viewport()->rect();
|
||||
auto font = option.font;
|
||||
font.setPointSize(37);
|
||||
painter.setFont(font);
|
||||
auto fm = painter.fontMetrics();
|
||||
|
||||
if (rect.height() <= (fm.height() * 5) || rect.width() <= fm.horizontalAdvance(line2)) {
|
||||
auto s = rect.height() / (5. * fm.height());
|
||||
auto sx = rect.width() * 1. / fm.horizontalAdvance(line2);
|
||||
if (s >= sx)
|
||||
s = sx;
|
||||
auto ps = font.pointSize() * s;
|
||||
if (ps <= 0)
|
||||
ps = 1;
|
||||
font.setPointSize(ps);
|
||||
painter.setFont(font);
|
||||
fm = painter.fontMetrics();
|
||||
}
|
||||
|
||||
// text
|
||||
rect.setTop(rect.top() + fm.height() * 1.5);
|
||||
painter.drawText(rect, Qt::AlignHCenter, line1);
|
||||
rect.setTop(rect.top() + fm.height());
|
||||
painter.drawText(rect, Qt::AlignHCenter, line2);
|
||||
painter.restore();
|
||||
return;
|
||||
}
|
||||
|
||||
int wpWidth = viewport()->width();
|
||||
option.rect.setWidth(wpWidth);
|
||||
for (int i = 0; i < m_groups.size(); ++i) {
|
||||
|
@ -383,20 +383,31 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
|
||||
QList<ScreenShot::Ptr> uploaded;
|
||||
auto job = NetJob::Ptr(new NetJob("Screenshot Upload", APPLICATION->network()));
|
||||
|
||||
ProgressDialog dialog(this);
|
||||
dialog.setSkipButton(true, tr("Abort"));
|
||||
|
||||
if (selection.size() < 2) {
|
||||
auto item = selection.at(0);
|
||||
auto info = m_model->fileInfo(item);
|
||||
auto screenshot = std::make_shared<ScreenShot>(info);
|
||||
job->addNetAction(ImgurUpload::make(screenshot));
|
||||
|
||||
m_uploadActive = true;
|
||||
ProgressDialog dialog(this);
|
||||
connect(job.get(), &Task::failed, [this](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), reason, QMessageBox::Critical)->show();
|
||||
});
|
||||
connect(job.get(), &Task::aborted, [this] {
|
||||
CustomMessageBox::selectable(this, tr("Screenshots upload aborted"), tr("The task has been aborted by the user."),
|
||||
QMessageBox::Information)
|
||||
->show();
|
||||
});
|
||||
|
||||
if (dialog.execWithTask(job.get()) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), tr("Unknown error"), QMessageBox::Warning)->exec();
|
||||
} else {
|
||||
m_uploadActive = true;
|
||||
|
||||
if (dialog.execWithTask(job.get()) == QDialog::Accepted) {
|
||||
auto link = screenshot->m_url;
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
qDebug() << "ImgurUpload link" << link;
|
||||
clipboard->setText(link);
|
||||
CustomMessageBox::selectable(
|
||||
this, tr("Upload finished"),
|
||||
@ -417,22 +428,36 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
}
|
||||
SequentialTask task;
|
||||
auto albumTask = NetJob::Ptr(new NetJob("Imgur Album Creation", APPLICATION->network()));
|
||||
auto imgurAlbum = ImgurAlbumCreation::make(uploaded);
|
||||
auto imgurResult = std::make_shared<ImgurAlbumCreation::Result>();
|
||||
auto imgurAlbum = ImgurAlbumCreation::make(imgurResult, uploaded);
|
||||
albumTask->addNetAction(imgurAlbum);
|
||||
task.addTask(job);
|
||||
task.addTask(albumTask);
|
||||
m_uploadActive = true;
|
||||
ProgressDialog prog(this);
|
||||
if (prog.execWithTask(&task) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), tr("Unknown error"), QMessageBox::Warning)->exec();
|
||||
} else {
|
||||
auto link = QString("https://imgur.com/a/%1").arg(imgurAlbum->id());
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(link);
|
||||
CustomMessageBox::selectable(this, tr("Upload finished"),
|
||||
tr("The <a href=\"%1\">link to the uploaded album</a> has been placed in your clipboard.").arg(link),
|
||||
|
||||
connect(&task, &Task::failed, [this](QString reason) {
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), reason, QMessageBox::Critical)->show();
|
||||
});
|
||||
connect(&task, &Task::aborted, [this] {
|
||||
CustomMessageBox::selectable(this, tr("Screenshots upload aborted"), tr("The task has been aborted by the user."),
|
||||
QMessageBox::Information)
|
||||
->exec();
|
||||
->show();
|
||||
});
|
||||
|
||||
m_uploadActive = true;
|
||||
if (dialog.execWithTask(&task) == QDialog::Accepted) {
|
||||
if (imgurResult->id.isEmpty()) {
|
||||
CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), tr("Unknown error"), QMessageBox::Warning)->exec();
|
||||
} else {
|
||||
auto link = QString("https://imgur.com/a/%1").arg(imgurResult->id);
|
||||
qDebug() << "ImgurUpload link" << link;
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(link);
|
||||
CustomMessageBox::selectable(
|
||||
this, tr("Upload finished"),
|
||||
tr("The <a href=\"%1\">link to the uploaded album</a> has been placed in your clipboard.").arg(link),
|
||||
QMessageBox::Information)
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
m_uploadActive = false;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ void ImportFTBPage::suggestCurrent()
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(selected.name, new PackInstallTask(selected));
|
||||
QString editedLogoName = QString("ftb_%1_%2,jpg").arg(selected.name, selected.id);
|
||||
QString editedLogoName = QString("ftb_%1_%2.jpg").arg(selected.name, QString::number(selected.id));
|
||||
dialog->setSuggestedIconFromFile(FS::PathCombine(selected.path, "folder.jpg"), editedLogoName);
|
||||
}
|
||||
|
||||
|
@ -165,11 +165,15 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
||||
QString path = FS::PathCombine("themes", m_id);
|
||||
QString pathResources = FS::PathCombine("themes", m_id, "resources");
|
||||
|
||||
if (!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) {
|
||||
themeWarningLog() << "couldn't create folder for theme!";
|
||||
if (!FS::ensureFolderPathExists(path)) {
|
||||
themeWarningLog() << "Theme directory for" << m_id << "could not be created. This theme might be invalid";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FS::ensureFolderPathExists(pathResources)) {
|
||||
themeWarningLog() << "Resources directory for" << m_id << "could not be created";
|
||||
}
|
||||
|
||||
auto themeFilePath = FS::PathCombine(path, themeFile);
|
||||
|
||||
bool jsonDataIncomplete = false;
|
||||
@ -230,7 +234,11 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
||||
|
||||
QStringList CustomTheme::searchPaths()
|
||||
{
|
||||
return { FS::PathCombine("themes", m_id, "resources") };
|
||||
QString pathResources = FS::PathCombine("themes", m_id, "resources");
|
||||
if (QFileInfo::exists(pathResources))
|
||||
return { pathResources };
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QString CustomTheme::id()
|
||||
|
Reference in New Issue
Block a user