mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
--Bug fixes:
-Fix path bugs when creating dialogs on Mac. -Add new setting for path when creating palette from image.
This commit is contained in:
@ -425,6 +425,10 @@ void PaletteEditor::EmitPaletteChanged()
|
||||
/// </summary>
|
||||
QStringList PaletteEditor::SetupOpenImagesDialog()
|
||||
{
|
||||
QStringList filenames;
|
||||
auto settings = FractoriumSettings::Instance();
|
||||
#ifndef __APPLE__
|
||||
|
||||
if (!m_FileDialog)
|
||||
{
|
||||
m_FileDialog = new QFileDialog(this);
|
||||
@ -433,20 +437,33 @@ QStringList PaletteEditor::SetupOpenImagesDialog()
|
||||
m_FileDialog->setAcceptMode(QFileDialog::AcceptOpen);
|
||||
m_FileDialog->setNameFilter("Image Files (*.png *.jpg *.bmp)");
|
||||
m_FileDialog->setWindowTitle("Open Image");
|
||||
m_FileDialog->setDirectory(QCoreApplication::applicationDirPath());
|
||||
m_FileDialog->setDirectory(settings->OpenPaletteImageFolder());
|
||||
m_FileDialog->selectNameFilter("*.jpg");
|
||||
}
|
||||
|
||||
QStringList filenames;
|
||||
|
||||
if (m_FileDialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
filenames = m_FileDialog->selectedFiles();
|
||||
|
||||
if (!filenames.empty())
|
||||
m_FileDialog->setDirectory(QFileInfo(filenames[0]).canonicalPath());
|
||||
{
|
||||
auto path = QFileInfo(filenames[0]).canonicalPath();
|
||||
m_FileDialog->setDirectory(path);
|
||||
settings->OpenPaletteImageFolder(path);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
auto filename = QFileDialog::getOpenFileName(this, tr("Open Image"), settings->OpenPaletteImageFolder(), tr("Image Files (*.png *.jpg *.bmp)"));
|
||||
|
||||
if (filename.size() > 0)
|
||||
{
|
||||
filenames.append(filename);
|
||||
auto path = QFileInfo(filenames[0]).canonicalPath();
|
||||
settings->OpenPaletteImageFolder(path);
|
||||
}
|
||||
|
||||
#endif
|
||||
return filenames;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,9 @@ private:
|
||||
string m_CurrentPaletteFilePath;
|
||||
ColorPickerWidget* m_ColorPicker = nullptr;
|
||||
GradientColorsView* m_GradientColorView = nullptr;
|
||||
#ifndef __APPLE__
|
||||
QFileDialog* m_FileDialog = nullptr;
|
||||
#endif
|
||||
shared_ptr<PaletteList<float>> m_PaletteList;
|
||||
std::unique_ptr<Ui::PaletteEditor> ui;
|
||||
};
|
||||
|
Reference in New Issue
Block a user