mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -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();
|
emit buddyVisibilityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BannerWidget::setText(const QString &text) const
|
||||||
|
{
|
||||||
|
bannerLabel->setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void BannerWidget::toggleBuddyVisibility() const
|
void BannerWidget::toggleBuddyVisibility() const
|
||||||
{
|
{
|
||||||
if (buddy) {
|
if (buddy) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ public:
|
||||||
Qt::Orientation orientation = Qt::Vertical,
|
Qt::Orientation orientation = Qt::Vertical,
|
||||||
int transparency = 80);
|
int transparency = 80);
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
void setText(const QString &text) const;
|
||||||
void setBuddy(QWidget *_buddy)
|
void setBuddy(QWidget *_buddy)
|
||||||
{
|
{
|
||||||
buddy = _buddy;
|
buddy = _buddy;
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,7 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
QString bannerText = "Deck Storage";
|
header = new BannerWidget(this, "");
|
||||||
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);
|
|
||||||
layout->addWidget(header);
|
layout->addWidget(header);
|
||||||
|
|
||||||
container = new QWidget(this);
|
container = new QWidget(this);
|
||||||
|
|
@ -53,6 +38,27 @@ VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
||||||
|
|
||||||
createWidgetsForFiles();
|
createWidgetsForFiles();
|
||||||
createWidgetsForFolders();
|
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()
|
void VisualDeckStorageFolderDisplayWidget::createWidgetsForFiles()
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ public:
|
||||||
VisualDeckStorageFolderDisplayWidget(QWidget *parent,
|
VisualDeckStorageFolderDisplayWidget(QWidget *parent,
|
||||||
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
||||||
QString _filePath);
|
QString _filePath);
|
||||||
|
void refreshUi();
|
||||||
void createWidgetsForFiles();
|
void createWidgetsForFiles();
|
||||||
void createWidgetsForFolders();
|
void createWidgetsForFolders();
|
||||||
QStringList gatherAllTagsFromFlowWidget() const;
|
QStringList gatherAllTagsFromFlowWidget() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue