//
// filepicker.cpp - A ROM chooser
//
-// by James L. Hammons
+// by James Hammons
// (C) 2010 Underground Software
//
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
//
// Who When What
// --- ---------- -------------------------------------------------------------
#else
// This sets it to the "too large size" as the minimum!
QScrollBar * vsb = new QScrollBar(Qt::Vertical, this);
- int sbWidth = vsb->size().width();
- printf("VSB size width: %u\n", sbWidth);
+// int sbWidth = vsb->size().width();
+// printf("VSB size width: %u\n", sbWidth);
int sbWidth2 = vsb->sizeHint().width();
- printf("VSB sizeHint width: %u\n", sbWidth2);
- int sbWidth3 = vsb->minimumSize().width();
- printf("VSB minimum width: %u\n", sbWidth3);
- int sbWidth4 = vsb->frameSize().width();
- printf("VSB frame width: %u\n", sbWidth4);
+// printf("VSB sizeHint width: %u\n", sbWidth2);
+// int sbWidth3 = vsb->minimumSize().width();
+// printf("VSB minimum width: %u\n", sbWidth3);
+// int sbWidth4 = vsb->frameSize().width();
+// printf("VSB frame width: %u\n", sbWidth4);
delete vsb;
// fileList->setFixedWidth((488/4) + 4);
int sbWidth5 = fileList->frameWidth();
- printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
- int sbWidth6 = fileList->sizeHint().width();
- printf("List sizeHint width: %u\n", sbWidth6);
- int sbWidth7 = fileList->minimumSize().width();
- printf("List minimum width: %u\n", sbWidth7);
- int sbWidth8 = fileList->minimumSizeHint().width();
- printf("List minimum hint width: %u\n", sbWidth8);
-// fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-// fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+// printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
+// int sbWidth6 = fileList->sizeHint().width();
+// printf("List sizeHint width: %u\n", sbWidth6);
+// int sbWidth7 = fileList->minimumSize().width();
+// printf("List minimum width: %u\n", sbWidth7);
+// int sbWidth8 = fileList->minimumSizeHint().width();
+// printf("List minimum hint width: %u\n", sbWidth8);
+//// fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+//// fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
// (488/4) + 4 is the width of the object in the filelistmodel. Dunno why the QListView
// isn't picking that up. :-(
- fileList->setFixedWidth((488/4) + 4 + sbWidth);//ick
+ // 488/4 + 4 = 126
+ // 126 + 17 + 4 = 147 <-- correct width
+ fileList->setFixedWidth((488/4) + 4 + sbWidth2 + sbWidth5 + 1);//ick
// fileList->setFixedWidth((488/4) + 4 + 17 + 4);//sbWidth);//ick
// fileList->setSpacing(4);
title = new QLabel(QString(tr("<h2>...</h2>")));
title->setMargin(6);
title->setAlignment(Qt::AlignCenter);
+//no.
+//title->setFixedWidth(cartImage->width());
+//title->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+//YESH!!!!
+ title->setFixedWidth(cartImage->sizeHint().width());
vLayout->addWidget(title);
-#if 1
QHBoxLayout * dataLayout = new QHBoxLayout;
vLayout->addLayout(dataLayout);
dataLayout->addWidget(labels);
data = new QLabel(QString(tr(
"?MB Cartridge<br>"
- "????????<br>"
- "???<br>"
- "???"
+ "00000000<br>"
+ "?<br>"
+ "?"
)));
data->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
dataLayout->addWidget(data);
insertCart->setDefault(true); // We want this button to be the default
insertCart->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
dataLayout->addWidget(insertCart);
-#else
- QLabel * text2 = new QLabel(QString(tr(
- "<table>"
- "<tr><td align='right'><b>Type: </b></td><td>4MB Cartridge</td></tr>"
- "<tr><td align='right'><b>CRC32: </b></td><td>FEDCBA98</td></tr>"
- "<tr><td align='right'><b>Compatibility: </b></td><td>DOES NOT WORK</td></tr>"
- "<tr><td align='right'><b>Notes: </b></td><td>Universal Header detected; Requires DSP</td></tr>"
- "</table>"
- )));
- vLayout->addWidget(text2);
-#endif
fileThread = new FileThread(this);
// connect(fileThread, SIGNAL(FoundAFile(unsigned long)), this, SLOT(AddFileToList(unsigned long)));
// connect(fileList, SIGNAL(doubleClicked()), this, SLOT(LoadButtonPressed()));
// This returns:
// Object::connect: No such signal QListView::QAbstractItemView::doubleClicked() in src/gui/filepicker.cpp:203
+//can't do this, nothing's rendered yet...
+//setFixedWidth(width());
}
void FilePickerWindow::keyPressEvent(QKeyEvent * e)
cart = QImage(":/res/alpine-file.png");
}
else if (haveUnknown && (fileType == JST_ABS_TYPE1 || fileType == JST_ABS_TYPE2
- || fileType == JST_JAGSERVER))
+ || fileType == JST_JAGSERVER) || fileType == JST_WTFOMGBBQ)
{
cart = QImage(":/res/homebrew-file.png");
}
prettyFilename = "\"" + currentFile.mid(lastSlashPos + 1) + "\"";
}
+ // Ensure that the title isn't longer than the width of the dialog...
+#if 1
title->setText(QString("<h2>%1</h2>").arg(prettyFilename));
+#else
+ // This doesn't work...
+ QFontMetrics metrics(title->font());
+ QString elidedText = metrics.elidedText(QString("<h2>%1</h2>").arg(prettyFilename), Qt::ElideRight, title->sizeHint().width());
+ title->setText(elidedText);
+#endif
//Kludge for now, we'll have to fix this later...
// So let's fix it now!