hydrogen 1.2.3
FileDialog.cpp
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include "FileDialog.h"
24#include "../CommonStrings.h"
25#include "../HydrogenApp.h"
26
28
29FileDialog::FileDialog( QWidget *pParent )
30 : QFileDialog( pParent ) {
31}
32
35
37 auto pCommonStrings = HydrogenApp::get_instance()->getCommonStrings();
38
39 QFileInfo fileInfo( selectedFiles().first() );
40 if ( acceptMode() == QFileDialog::AcceptSave &&
42 fileInfo.absoluteDir().absolutePath(), false ) ) {
43 QMessageBox::warning( this, "Hydrogen",
44 pCommonStrings->getFileDialogMissingWritePermissions(),
45 QMessageBox::Ok );
46 return;
47 }
48
49 QFileDialog::accept();
50}
void accept()
FileDialog(QWidget *pParent)
static bool dir_writable(const QString &path, bool silent=false)
returns true if the given path is a writable regular directory
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
std::shared_ptr< CommonStrings > getCommonStrings()