Merge branch 'develop' into feature/close_after_launch

This commit is contained in:
swirl
2022-02-03 13:43:44 -05:00
18 changed files with 232 additions and 1763 deletions

View File

@ -32,8 +32,14 @@ QString getCreditsHtml()
QTextStream stream(&output);
stream.setCodec(QTextCodec::codecForName("UTF-8"));
stream << "<center>\n";
stream << "<h3>" << QObject::tr("PolyMC Developers", "About Credits") << "</h3>\n";
stream << "<p>swirl &lt;<a href='mailto:swurl@swurl.xyz'>swurl@swurl.xyz </a>&gt;</p>\n";
stream << "<p>LennyMcLennington &lt;<a href='mailto:lenny@sneed.church'>lenny@sneed.church</a>&gt;</p>\n";
stream << "<br />\n";
// TODO: possibly retrieve from git history at build time?
stream << "<h3>" << QObject::tr("Developers", "About Credits") << "</h3>\n";
stream << "<h3>" << QObject::tr("MultiMC Developers", "About Credits") << "</h3>\n";
stream << "<p>Andrew Okin &lt;<a href='mailto:forkk@forkk.net'>forkk@forkk.net</a>&gt;</p>\n";
stream << "<p>Petr Mrázek &lt;<a href='mailto:peterix@gmail.com'>peterix@gmail.com</a>&gt;</p>\n";
stream << "<p>Sky Welch &lt;<a href='mailto:multimc@bunnies.io'>multimc@bunnies.io</a>&gt;</p>\n";
@ -47,6 +53,7 @@ QString getCreditsHtml()
stream << "<p>Kilobyte &lt;<a href='mailto:stiepen22@gmx.de'>stiepen22@gmx.de</a>&gt;</p>\n";
stream << "<p>Rootbear75 &lt;<a href='https://twitter.com/rootbear75'>@rootbear75</a>&gt;</p>\n";
stream << "<p>Zeker Zhayard &lt;<a href='https://twitter.com/zeker_zhayard'>@Zeker_Zhayard</a>&gt;</p>\n";
stream << "<p>Everyone else who <a href='https://github.com/PolyMC/PolyMC/graphs/contributors'>contributed</a>!</p>\n";
stream << "<br />\n";
stream << "</center>\n";
@ -83,8 +90,12 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
ui->icon->setPixmap(APPLICATION->getThemedIcon("logo").pixmap(64));
ui->title->setText(launcherName);
ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString());
ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM);
ui->versionLabel->setText(BuildConfig.printableVersionString());
if (!BuildConfig.BUILD_PLATFORM.isEmpty())
ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM);
else
ui->platformLabel->setVisible(false);
if (BuildConfig.VERSION_BUILD >= 0)
ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(BuildConfig.VERSION_BUILD));

View File

@ -86,6 +86,13 @@
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
@ -151,16 +158,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>Version:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="platformLabel">
<property name="text">

View File

@ -250,6 +250,12 @@ bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
return QWidget::eventFilter(obj, evt);
}
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
if (keyEvent->matches(QKeySequence::Copy)) {
on_actionCopy_File_s_triggered();
return true;
}
switch (keyEvent->key())
{
case Qt::Key_Delete:
@ -272,6 +278,11 @@ ScreenshotsPage::~ScreenshotsPage()
void ScreenshotsPage::ShowContextMenu(const QPoint& pos)
{
auto menu = ui->toolBar->createContextMenu(this, tr("Context menu"));
if (ui->listView->selectionModel()->selectedRows().size() > 1) {
menu->removeAction( ui->actionCopy_Image );
}
menu->exec(ui->listView->mapToGlobal(pos));
delete menu;
}
@ -377,6 +388,42 @@ void ScreenshotsPage::on_actionUpload_triggered()
m_uploadActive = false;
}
void ScreenshotsPage::on_actionCopy_Image_triggered()
{
auto selection = ui->listView->selectionModel()->selectedRows();
if(selection.size() < 1)
{
return;
}
// You can only copy one image to the clipboard. In the case of multiple selected files, only the first one gets copied.
auto item = selection[0];
auto info = m_model->fileInfo(item);
QImage image(info.absoluteFilePath());
Q_ASSERT(!image.isNull());
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
}
void ScreenshotsPage::on_actionCopy_File_s_triggered()
{
auto selection = ui->listView->selectionModel()->selectedRows();
if(selection.size() < 1)
{
// Don't do anything so we don't empty the users clipboard
return;
}
QString buf = "";
for (auto item : selection)
{
auto info = m_model->fileInfo(item);
buf += "file:///" + info.absoluteFilePath() + "\r\n";
}
QMimeData* mimeData = new QMimeData();
mimeData->setData("text/uri-list", buf.toLocal8Bit());
QApplication::clipboard()->setMimeData(mimeData);
}
void ScreenshotsPage::on_actionDelete_triggered()
{
auto mbox = CustomMessageBox::selectable(

View File

@ -73,6 +73,8 @@ protected:
private slots:
void on_actionUpload_triggered();
void on_actionCopy_Image_triggered();
void on_actionCopy_File_s_triggered();
void on_actionDelete_triggered();
void on_actionRename_triggered();
void on_actionView_Folder_triggered();

View File

@ -50,6 +50,8 @@
<bool>false</bool>
</attribute>
<addaction name="actionUpload"/>
<addaction name="actionCopy_Image"/>
<addaction name="actionCopy_File_s"/>
<addaction name="actionDelete"/>
<addaction name="actionRename"/>
<addaction name="actionView_Folder"/>
@ -74,6 +76,22 @@
<string>View Folder</string>
</property>
</action>
<action name="actionCopy_Image">
<property name="text">
<string>Copy Image</string>
</property>
<property name="toolTip">
<string>Copy Image</string>
</property>
</action>
<action name="actionCopy_File_s">
<property name="text">
<string>Copy File(s)</string>
</property>
<property name="toolTip">
<string>Copy File(s)</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>