Skip to content

Commit

Permalink
Replace RabbitCommon::CDir::GetOpenDirectory with QFileDialog::getExi…
Browse files Browse the repository at this point in the history
…stingDirectory etc
  • Loading branch information
KangLin committed Jul 18, 2023
1 parent edc91bc commit 4b3c917
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
10 changes: 4 additions & 6 deletions App/FrmBrowseFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ void CFrmBrowseFile::on_pbBrowse_clicked()
{
QString szFile;
if(m_bIsDirectory)
szFile = RabbitCommon::CDir::GetOpenDirectory(this,
tr("Open folder"),
getFile());
szFile = QFileDialog::getExistingDirectory(this,
tr("Open folder"),
getFile());
else
szFile = RabbitCommon::CDir::GetOpenFileName(this,
tr("Open file"),
getFile());
szFile = QFileDialog::getOpenFileName(this, tr("Open file"), getFile());
if(szFile.isEmpty()) return;
setFile(szFile);
}
Expand Down
2 changes: 1 addition & 1 deletion App/FrmRecognizerImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CFrmRecognizerImage::~CFrmRecognizerImage()

void CFrmRecognizerImage::on_pbBrower_clicked()
{
QString szFile = RabbitCommon::CDir::GetOpenFileName(this,
QString szFile = QFileDialog::getOpenFileName(this,
tr("Select image"),
ui->leFile->text(),
tr("Image files(*.png *.gif *.jpeg *.jpg *.bmp);; All files(*.*)"));
Expand Down
2 changes: 1 addition & 1 deletion App/FrmRegisterImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int CFrmRegisterImage::ProcessImage(const QImage &image)

void CFrmRegisterImage::on_pbBrowser_clicked()
{
QString szFile = RabbitCommon::CDir::GetOpenFileName(this,
QString szFile = QFileDialog::getOpenFileName(this,
tr("Select image"),
ui->leFile->text(),
tr("Image files(*.png *.gif *.jpeg *.jpg *.bmp);; All files(*.*)"));
Expand Down
24 changes: 11 additions & 13 deletions App/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,16 @@ void MainWindow::slotCameraOrientation(QAction *pAction)
void MainWindow::on_actionFile_triggered()
{
#ifdef RABBITCOMMON
QString szFile;
QUrl szUrl;
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
szFile = set.value("SourceFile").toString();
szUrl = set.value("SourceFileUrl").toUrl();

szFile = RabbitCommon::CDir::GetOpenFileName(this,
tr("Open file"),
szFile);
if(szFile.isEmpty())
szUrl = QFileDialog::getOpenFileUrl(this, tr("Open file"), szUrl);
if(szUrl.isEmpty())
return;

set.setValue("SourceFile", szFile);
set.setValue("SourceFileUrl", szUrl);
#endif
}

Expand Down Expand Up @@ -399,12 +397,12 @@ void MainWindow::on_actionStart_triggered()
} else {
m_Player.stop();

QString szFile;
QUrl url;
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
szFile = set.value("SourceFile").toString();
qDebug(log) << "Open file:" << szFile;
QUrl url = QUrl::fromLocalFile(szFile);
url = set.value("SourceFileUrl").toUrl();
qDebug(log) << "Open file:" << url;

#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
m_Player.setSource(url);
#else
Expand Down Expand Up @@ -492,8 +490,8 @@ void MainWindow::slotScreenOrientationChanged(Qt::ScreenOrientation orientation)
void MainWindow::on_actionSet_model_path_triggered()
{
#ifdef RABBITCOMMON
QString szPath = RabbitCommon::CDir::GetOpenDirectory(this,
tr("Open model file path"));
QString szPath = QFileDialog::getExistingDirectory(this,
tr("Open model file path"));
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
set.setValue("ModuleDir", szPath);
Expand Down
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
See RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f
+ FFmpeg: update API avpicture_* to av_image_*
+ Support Qt6
+ Replace RabbitCommon::CDir::GetOpenDirectory with QFileDialog::getExistingDirectory etc

- v0.0.4
+ Add opencv face
Expand Down
1 change: 1 addition & 0 deletions ChangeLog_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
详见:RabbitCommon: 7ed300a206d8a36c30003b6c19ad181682d0ff5f
+ FFmpeg: 兼容 API avpicture_* to av_image_*
+ 支持 Qt6
+ 用 QFileDialog::getExistingDirectory 替换 RabbitCommon::CDir::GetOpenDirectory

- v0.0.4
+ 增加 opencv 实现人脸接口
Expand Down
2 changes: 1 addition & 1 deletion etc/FaceRecognizer_logqt.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Log]
;Path=log
Name="yyyy-MM-dd"
Pattern="[%{time hh:mm:ss.zzz} %{pid}|%{threadid} %{if-debug}DEBUG%{endif}%{if-info}INFO%{endif}%{if-warning}WARN%{endif}%{if-critical}ERROR%{endif}%{if-fatal}FATALF%{endif} %{category}] - %{message} [%{file}:%{line}, %{function}]"
Pattern="[%{time hh:mm:ss.zzz} %{pid}|%{threadid} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}E%{endif}%{if-fatal}F%{endif}] %{category} - %{message} [%{file}:%{line}, %{function}]"
;Length=100M
;Count=10
;Interval=1
Expand Down

0 comments on commit 4b3c917

Please sign in to comment.