mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refreshUi and translate things
This commit is contained in:
parent
a69dfdc135
commit
72192f6392
4 changed files with 29 additions and 16 deletions
|
|
@ -30,6 +30,11 @@ void BannerWidget::mousePressEvent(QMouseEvent *event)
|
|||
emit buddyVisibilityChanged();
|
||||
}
|
||||
|
||||
void BannerWidget::setText(const QString &text) const
|
||||
{
|
||||
bannerLabel->setText(text);
|
||||
}
|
||||
|
||||
void BannerWidget::toggleBuddyVisibility() const
|
||||
{
|
||||
if (buddy) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public:
|
|||
Qt::Orientation orientation = Qt::Vertical,
|
||||
int transparency = 80);
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void setText(const QString &text) const;
|
||||
void setBuddy(QWidget *_buddy)
|
||||
{
|
||||
buddy = _buddy;
|
||||
|
|
|
|||
|
|
@ -15,22 +15,7 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
|||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
QString bannerText = "Deck Storage";
|
||||
QString deckPath = SettingsCache::instance().getDeckPath();
|
||||
if (filePath != deckPath) {
|
||||
QString relativePath = filePath;
|
||||
|
||||
if (filePath.startsWith(deckPath)) {
|
||||
relativePath = filePath.mid(deckPath.length()); // Remove the deckPath prefix
|
||||
if (relativePath.startsWith('/')) {
|
||||
relativePath.remove(0, 1); // Remove leading '/' if it exists
|
||||
}
|
||||
}
|
||||
|
||||
bannerText = relativePath;
|
||||
}
|
||||
|
||||
header = new BannerWidget(this, bannerText);
|
||||
header = new BannerWidget(this, "");
|
||||
layout->addWidget(header);
|
||||
|
||||
container = new QWidget(this);
|
||||
|
|
@ -53,6 +38,27 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
|||
|
||||
createWidgetsForFiles();
|
||||
createWidgetsForFolders();
|
||||
|
||||
refreshUi();
|
||||
}
|
||||
|
||||
void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
||||
{
|
||||
QString bannerText = tr("Deck Storage");
|
||||
QString deckPath = SettingsCache::instance().getDeckPath();
|
||||
if (filePath != deckPath) {
|
||||
QString relativePath = filePath;
|
||||
|
||||
if (filePath.startsWith(deckPath)) {
|
||||
relativePath = filePath.mid(deckPath.length()); // Remove the deckPath prefix
|
||||
if (relativePath.startsWith('/')) {
|
||||
relativePath.remove(0, 1); // Remove leading '/' if it exists
|
||||
}
|
||||
}
|
||||
|
||||
bannerText = relativePath;
|
||||
}
|
||||
header->setText(bannerText);
|
||||
}
|
||||
|
||||
void VisualDeckStorageFolderDisplayWidget::createWidgetsForFiles()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ public:
|
|||
VisualDeckStorageFolderDisplayWidget(QWidget *parent,
|
||||
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
||||
QString _filePath);
|
||||
void refreshUi();
|
||||
void createWidgetsForFiles();
|
||||
void createWidgetsForFolders();
|
||||
QStringList gatherAllTagsFromFlowWidget() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue