35 std::shared_ptr<Drumkit> pDrumkit )
37 m_pDrumkit( pDrumkit )
43 exportBtn->setText( tr(
"&Export" ) );
44 cancelBtn->setText( pCommonStrings->getButtonCancel() );
46 setWindowTitle( QString(
"%1 [%2]" )
47 .arg( tr(
"Export Drumkit" ) )
48 .arg( pDrumkit !=
nullptr ? pDrumkit->get_name() : tr(
"invalid drumkit" ) ) );
50 setFixedSize( width(), height() );
53 if ( pDrumkit !=
nullptr ) {
54 for (
const auto& pComponent : *pDrumkit->get_components() ) {
78 QMessageBox::warning(
this,
"Hydrogen",
79 pCommonStrings->getFileDialogMissingWritePermissions(),
86 ERRORLOG(
"User cancelled dialog due to licensing issues." );
90 bool bRecentVersion = versionList->currentIndex() == 1 ? false :
true;
92 QString sTargetComponent;
93 if ( componentList->currentIndex() == 0 && bRecentVersion ) {
95 sTargetComponent =
"";
97 sTargetComponent = componentList->currentText();
102 QString sTargetName = drumkitPathTxt->text() +
"/" +
108 msgBox.setWindowTitle(
"Hydrogen");
109 msgBox.setIcon( QMessageBox::Warning );
110 msgBox.setText( tr(
"The file [%1] does already exist and will be overwritten.")
111 .arg( sTargetName ) );
113 msgBox.setStandardButtons( QMessageBox::Ok | QMessageBox::Cancel );
114 msgBox.setButtonText(QMessageBox::Ok,
115 pCommonStrings->getButtonOk() );
116 msgBox.setButtonText(QMessageBox::Cancel,
117 pCommonStrings->getButtonCancel());
118 msgBox.setDefaultButton(QMessageBox::Ok);
120 if ( msgBox.exec() == QMessageBox::Cancel ) {
125 QApplication::setOverrideCursor(Qt::WaitCursor);
130 QApplication::restoreOverrideCursor();
131 QMessageBox::critical(
this,
"Hydrogen", tr(
"Unable to export drumkit") );
135 QApplication::restoreOverrideCursor();
136 QMessageBox::information(
this,
"Hydrogen",
137 tr(
"Drumkit exported to") +
"\n" +
143 QString path = drumkitPathTxt->text();
144 if (path.isEmpty()) {
145 exportBtn->setEnabled(
false );
148 exportBtn->setEnabled(
true );
156 sPath = QDir::homePath();
160 fd.setFileMode( QFileDialog::Directory );
161 fd.setAcceptMode( QFileDialog::AcceptOpen );
162 fd.setDirectory( sPath );
163 fd.setWindowTitle( tr(
"Directory") );
165 if ( fd.exec() == QDialog::Accepted ) {
166 QString sFilename = fd.selectedFiles().first();
167 if ( sFilename.isEmpty() ) {
168 drumkitPathTxt->setText( sPath );
170 drumkitPathTxt->setText( sFilename );
188 componentList->clear();
190 if ( versionList->currentIndex() == 0 ) {
195 componentList->addItem( tr(
"All" ) );
196 componentList->insertSeparator( 1 );
200 componentList->addItem( sComponentName );
Custom file dialog checking whether the user has write access to the selected folder before allowing ...
QString getExportName(const QString &sComponentName, bool bRecentVersion) const
Returns the base name used when exporting the drumkit.
bool exportTo(const QString &sTargetDir, const QString &sComponentName="", bool bRecentVersion=true, bool bSilent=false)
Compresses the drumkit into a .h2drumkit file.
static bool dir_writable(const QString &path, bool silent=false)
returns true if the given path is a writable regular directory
static bool file_exists(const QString &path, bool silent=false)
returns true if the given path is an existing regular file
static const QString drumkit_ext
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
void setLastExportDrumkitDirectory(QString sPath)
QString getLastExportDrumkitDirectory() const
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
std::shared_ptr< CommonStrings > getCommonStrings()
static bool checkDrumkitLicense(std::shared_ptr< H2Core::Drumkit > pDrumkit)
void on_drumkitPathTxt_textChanged(QString str)
void updateComponentList()
void on_cancelBtn_clicked()
SoundLibraryExportDialog(QWidget *pParent, std::shared_ptr< H2Core::Drumkit > pDrumkit)
void on_browseBtn_clicked()
void on_versionList_currentIndexChanged(int index)
~SoundLibraryExportDialog()
std::shared_ptr< H2Core::Drumkit > m_pDrumkit
void on_exportBtn_clicked()