mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-13 20:22:13 +00:00
Compare commits
2 Commits
feature/so
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91bf81b621 | ||
|
|
9db802b468 |
@@ -321,7 +321,7 @@ QString DirNameFromString(QString string, QString inDir)
|
||||
}
|
||||
else
|
||||
{
|
||||
dirName = baseName + QString::number(num);;
|
||||
dirName = baseName + QString::number(num);
|
||||
}
|
||||
|
||||
// If it's over 9000
|
||||
|
||||
@@ -805,12 +805,18 @@ QString InstanceList::getStagedInstancePath()
|
||||
|
||||
bool InstanceList::commitStagedInstance(const QString& path, const QString& instanceName, const QString& groupName)
|
||||
{
|
||||
QDir dir;
|
||||
QString instID = FS::DirNameFromString(instanceName, m_instDir);
|
||||
QString instanceDirName = instID;
|
||||
if(instanceDirName.length() > 180)
|
||||
{
|
||||
instanceDirName.truncate(176);
|
||||
instanceDirName += instID.at(instID.length() - 4); // In case the last 4 chars were changed
|
||||
// to prevent double folder names
|
||||
}
|
||||
{
|
||||
WatchLock lock(m_watcher, m_instDir);
|
||||
QString destination = FS::PathCombine(m_instDir, instID);
|
||||
if(!dir.rename(path, destination))
|
||||
QString destination = FS::PathCombine(m_instDir, instanceDirName);
|
||||
if(!QDir().rename(path, destination))
|
||||
{
|
||||
qWarning() << "Failed to move" << path << "to" << destination;
|
||||
return false;
|
||||
|
||||
@@ -661,7 +661,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
||||
// Create the instance list widget
|
||||
{
|
||||
view = new GroupView(ui->centralWidget);
|
||||
view->setTextElideMode(Qt::TextElideMode::ElideRight);
|
||||
|
||||
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
// FIXME: leaks ListViewDelegate
|
||||
|
||||
@@ -34,6 +34,7 @@ static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &he
|
||||
height = 0;
|
||||
widthUsed = 0;
|
||||
textLayout.beginLayout();
|
||||
QString str = textLayout.text();
|
||||
while (true)
|
||||
{
|
||||
QTextLine line = textLayout.createLine();
|
||||
@@ -189,13 +190,11 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
|
||||
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
|
||||
|
||||
// FIXME: Things go really weird with long instance names
|
||||
// const int iconSize = style->pixelMetric(QStyle::PM_IconViewIconSize);
|
||||
const int iconSize = 48;
|
||||
QRect iconbox = opt.rect;
|
||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, opt.widget) + 1;
|
||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, opt.widget) + 1;
|
||||
QRect textRect = opt.rect;
|
||||
textRect.setWidth(qMin(textRect.width(), iconbox.width()));
|
||||
QRect textHighlightRect = textRect;
|
||||
// clip the decoration on top, remove width padding
|
||||
textRect.adjust(textMargin, iconSize + textMargin + 5, -textMargin, 0);
|
||||
@@ -300,7 +299,7 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
const int lineCount = textLayout.lineCount();
|
||||
|
||||
const QRect layoutRect = QStyle::alignedRect(
|
||||
opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect);
|
||||
opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect);
|
||||
const QPointF position = layoutRect.topLeft();
|
||||
for (int i = 0; i < lineCount; ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user