Skip to content

Commit

Permalink
Improve, format the code and add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
MinyazevR committed Jan 10, 2025
1 parent 01a37ac commit 92ba14e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions qrtranslations/fr/qrutils_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+35"/>
<source>Select directory</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>utils::MetamodelGeneratorSupport</name>
Expand Down
7 changes: 6 additions & 1 deletion qrtranslations/ru/qrutils_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,12 @@
<message>
<location filename="../../qrutils/widgets/dirPicker.cpp" line="+33"/>
<source>Browse...</source>
<translation type="unfinished">Обзор...</translation>
<translation>Обзор...</translation>
</message>
<message>
<location line="+35"/>
<source>Select directory</source>
<translation>Выберите директорию</translation>
</message>
</context>
<context>
Expand Down
11 changes: 6 additions & 5 deletions qrutils/widgets/dirPicker.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2017 CyberTech Labs Ltd.
/* Copyright 2025 CyberTech Labs Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,9 +27,9 @@ using namespace qReal::ui;

dirPicker::dirPicker(QWidget *parent)
: QWidget(parent)
, mLabel(new QLabel(this))
, mPathEditor(new QLineEdit(this))
{
mLabel = new QLabel(this);
mPathEditor = new QLineEdit(this);
QPushButton *button = new QPushButton(style()->standardIcon(QStyle::SP_DirIcon), tr("Browse..."), this);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(mLabel);
Expand All @@ -44,7 +44,8 @@ void dirPicker::configure(const QString &settingsKey, const QString &title)
mLabel->setText(title);
}

bool dirPicker::isSavedDirExist(){
bool dirPicker::isSavedDirExist()
{
return QDir(SettingsManager::value(mSettingsKey).toString()).exists();
}

Expand All @@ -64,7 +65,7 @@ void dirPicker::restore()

void dirPicker::pick()
{
QDir dirPath=QFileDialog::getExistingDirectory(this, "Get Any File");
QDir dirPath = QFileDialog::getExistingDirectory(this, tr("Select directory"));
SettingsManager::setValue(mSettingsKey, dirPath.absolutePath());
mPathEditor->setText(dirPath.absolutePath());
}
4 changes: 2 additions & 2 deletions qrutils/widgets/dirPicker.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2017 CyberTech Labs Ltd.
/* Copyright 2025 CyberTech Labs Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
#pragma once

#include <QtWidgets/QWidget>

#include <qrutils/utilsDeclSpec.h>

class QLabel;
Expand All @@ -41,6 +40,7 @@ class QRUTILS_EXPORT dirPicker : public QWidget
/// Restores last picked value.
void restore();

/// Determines whether the picked location exists or not
bool isSavedDirExist();


Expand Down

0 comments on commit 92ba14e

Please sign in to comment.