Create/Modify/Remove style sets + misc fix and some refactoring
This commit is contained in:
parent
276a177ee6
commit
185efe7b70
11 changed files with 1579 additions and 498 deletions
|
@ -218,6 +218,14 @@ public:
|
||||||
QString filters = QString("*"),
|
QString filters = QString("*"),
|
||||||
QSize chipSize = QSize(30, 30));
|
QSize chipSize = QSize(30, 30));
|
||||||
|
|
||||||
|
TFilePathSet getCustomStyleFolders();
|
||||||
|
TFilePathSet getTextureStyleFolders();
|
||||||
|
TFilePathSet getBrushStyleFolders();
|
||||||
|
|
||||||
|
void removeCustomStyleFolder(TFilePath styleFolder);
|
||||||
|
void removeTextureStyleFolder(TFilePath styleFolder);
|
||||||
|
void removeBrushStyleFolder(TFilePath styleFolder);
|
||||||
|
|
||||||
bool isLoading();
|
bool isLoading();
|
||||||
void signalLoadsFinished();
|
void signalLoadsFinished();
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
virtual void setCurrentLevelStyleIndex(int index,
|
virtual void setCurrentLevelStyleIndex(int index,
|
||||||
bool forceUpdate = false) = 0;
|
bool forceUpdate = false) = 0;
|
||||||
virtual void refreshStatusBar() = 0;
|
virtual void refreshStatusBar() = 0;
|
||||||
|
virtual void showMessage(QString message, int duration = 2000) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TAPPLICATION_H
|
#endif // TAPPLICATION_H
|
||||||
|
|
|
@ -217,4 +217,9 @@ protected:
|
||||||
|
|
||||||
QString DVAPI operator+(const QString &a, const TFilePath &fp);
|
QString DVAPI operator+(const QString &a, const TFilePath &fp);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// This is used to translate Windows keys to macOS keys
|
||||||
|
//
|
||||||
|
QString DVAPI trModKey(QString key);
|
||||||
|
|
||||||
#endif // GUTIL_H
|
#endif // GUTIL_H
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "tpixel.h"
|
#include "tpixel.h"
|
||||||
#include "tpalette.h"
|
#include "tpalette.h"
|
||||||
#include "saveloadqsettings.h"
|
#include "saveloadqsettings.h"
|
||||||
|
#include "../toonz/tapplication.h"
|
||||||
|
|
||||||
// TnzLib includes
|
// TnzLib includes
|
||||||
#include "toonz/tpalettehandle.h"
|
#include "toonz/tpalettehandle.h"
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
#include "toonzqt/colorfield.h"
|
#include "toonzqt/colorfield.h"
|
||||||
#include "toonzqt/tabbar.h"
|
#include "toonzqt/tabbar.h"
|
||||||
#include "toonzqt/glwidget_for_highdpi.h"
|
#include "toonzqt/glwidget_for_highdpi.h"
|
||||||
|
#include "toonzqt/dvdialog.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
@ -34,6 +36,8 @@
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
#undef DVAPI
|
#undef DVAPI
|
||||||
#undef DVVAR
|
#undef DVVAR
|
||||||
|
@ -420,22 +424,11 @@ signals:
|
||||||
*/
|
*/
|
||||||
class StyleEditorPage : public QFrame {
|
class StyleEditorPage : public QFrame {
|
||||||
public:
|
public:
|
||||||
bool m_favorite = false;
|
|
||||||
bool m_allowFavorite = false;
|
|
||||||
StyleEditor *m_editor;
|
StyleEditor *m_editor;
|
||||||
|
|
||||||
std::vector<int> m_selection;
|
std::vector<int> m_selection;
|
||||||
|
|
||||||
StyleEditorPage(QWidget *parent);
|
StyleEditorPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void setFavorite(bool favorite) { m_favorite = favorite; }
|
|
||||||
bool isFavorite() { return m_favorite; }
|
|
||||||
|
|
||||||
void setAllowFavorite(bool allow) { m_allowFavorite = allow; }
|
|
||||||
bool allowFavorite() { return m_allowFavorite; }
|
|
||||||
|
|
||||||
void clearSelection() { m_selection.clear(); }
|
|
||||||
std::vector<int> getSelection() { return m_selection; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -557,35 +550,63 @@ protected:
|
||||||
QSize m_chipSize;
|
QSize m_chipSize;
|
||||||
int m_chipPerRow;
|
int m_chipPerRow;
|
||||||
StylePageType m_pageType = StylePageType::Unknown;
|
StylePageType m_pageType = StylePageType::Unknown;
|
||||||
|
TFilePath m_stylesFolder;
|
||||||
|
QString m_styleSetName;
|
||||||
|
bool m_allowPageDelete;
|
||||||
|
|
||||||
|
bool m_favorite = false;
|
||||||
|
bool m_allowFavorite = false;
|
||||||
|
bool m_external = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StyleChooserPage(QWidget *parent = 0);
|
StyleChooserPage(QWidget *parent = 0);
|
||||||
|
|
||||||
QSize getChipSize() const { return m_chipSize; }
|
QSize getChipSize() const { return m_chipSize; }
|
||||||
|
|
||||||
|
TFilePath getStylesFolder() { return m_stylesFolder; }
|
||||||
|
|
||||||
void setPageType(StylePageType pageType) { m_pageType = pageType; }
|
void setPageType(StylePageType pageType) { m_pageType = pageType; }
|
||||||
StylePageType getPageType() { return m_pageType; }
|
StylePageType getPageType() { return m_pageType; }
|
||||||
|
|
||||||
virtual bool loadIfNeeded() = 0;
|
virtual void setFavorite(bool favorite) { m_favorite = favorite; }
|
||||||
|
bool isFavorite() { return m_favorite; }
|
||||||
|
|
||||||
|
void setAllowFavorite(bool allow) { m_allowFavorite = allow; }
|
||||||
|
bool allowFavorite() { return m_allowFavorite; }
|
||||||
|
|
||||||
|
virtual void setExternal(bool external) { m_external = external; }
|
||||||
|
bool isExternal() { return m_external; }
|
||||||
|
|
||||||
|
void clearSelection() { m_selection.clear(); }
|
||||||
|
std::vector<int> getSelection() { return m_selection; }
|
||||||
|
|
||||||
|
virtual void loadItems() {}
|
||||||
|
virtual bool loadIfNeeded() = 0;
|
||||||
|
virtual bool isLoading() { return false; }
|
||||||
virtual int getChipCount() const = 0;
|
virtual int getChipCount() const = 0;
|
||||||
|
|
||||||
virtual void drawChip(QPainter &p, QRect rect, int index) = 0;
|
virtual void drawChip(QPainter &p, QRect rect, int index) = 0;
|
||||||
virtual void onSelect(int index) {}
|
virtual void onSelect(int index) {}
|
||||||
|
|
||||||
virtual void removeFavorite(){};
|
virtual void removeSelectedStylesFromSet(std::vector<int> selection){};
|
||||||
virtual void removeSelectedFavorites(std::vector<int> selection){};
|
virtual void addSelectedStylesToSet(std::vector<int> selection,
|
||||||
virtual void addFavorite() {}
|
TFilePath setPath){};
|
||||||
virtual void addSelectedFavorites(std::vector<int> selection){};
|
|
||||||
virtual void updateFavorite(){};
|
virtual void updateFavorite(){};
|
||||||
virtual void addSelectedStyles(std::vector<int> selection){};
|
virtual void addSelectedStylesToPalette(std::vector<int> selection){};
|
||||||
|
|
||||||
bool copyToFavorites(TFilePathSet srcFiles, TFilePath destDir);
|
bool copyFilesToStyleFolder(TFilePathSet srcFiles, TFilePath destDir);
|
||||||
bool deleteFromFavorites(TFilePathSet targetFiles);
|
bool deleteFilesFromStyleFolder(TFilePathSet targetFiles);
|
||||||
|
|
||||||
void processContextMenuEvent(QContextMenuEvent *event) {
|
void processContextMenuEvent(QContextMenuEvent *event) {
|
||||||
contextMenuEvent(event);
|
contextMenuEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setStyleSetName(QString name) { m_styleSetName = name; }
|
||||||
|
QString getStyleSetName() { return m_styleSetName; }
|
||||||
|
|
||||||
|
void setAllowPageDelete(bool allowDelete) { m_allowPageDelete = allowDelete; }
|
||||||
|
bool canDeletePage() { return m_allowPageDelete; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_currentIndex;
|
int m_currentIndex;
|
||||||
|
|
||||||
|
@ -598,19 +619,24 @@ protected:
|
||||||
void mouseMoveEvent(QMouseEvent *event) override {}
|
void mouseMoveEvent(QMouseEvent *event) override {}
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
void enterEvent(QEvent *event) override;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void computeSize();
|
void computeSize();
|
||||||
void onTogglePage(bool toggled);
|
void onTogglePage(bool toggled);
|
||||||
void onRemoveFavorite();
|
void onRemoveStyleFromSet();
|
||||||
void onRemoveAllFavorites();
|
void onEmptySet();
|
||||||
void onAddFavorite();
|
void onAddStyleToFavorite();
|
||||||
void onAddStyle();
|
void onAddStyleToPalette();
|
||||||
void onAddAllStyles();
|
void onCopyStyleToSet();
|
||||||
|
void onMoveStyleToSet();
|
||||||
|
void onAddSetToPalette();
|
||||||
void onUpdateFavorite();
|
void onUpdateFavorite();
|
||||||
|
void onRemoveStyleSet();
|
||||||
|
void onReloadStyleSet();
|
||||||
|
void onLabelContextMenu(const QPoint &pos);
|
||||||
signals:
|
signals:
|
||||||
void styleSelected(const TColorStyle &style);
|
void styleSelected(const TColorStyle &style);
|
||||||
void favoritesUpdated();
|
|
||||||
void refreshFavorites();
|
void refreshFavorites();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -666,12 +692,61 @@ private slots:
|
||||||
|
|
||||||
using namespace StyleEditorGUI;
|
using namespace StyleEditorGUI;
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// Clickable Label
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ClickableLabel : public QLabel {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ClickableLabel(const QString &text, QWidget *parent = nullptr,
|
||||||
|
Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
~ClickableLabel();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void click();
|
||||||
|
};
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// New Style Set Popup
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class NewStyleSetPopup : public DVGui::Dialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DVGui::LineEdit *m_nameFld;
|
||||||
|
DVGui::CheckBox *m_isFavorite;
|
||||||
|
QButtonGroup *m_styleSetType;
|
||||||
|
QRadioButton *m_texture, *m_vectorCustom, *m_vectorBrush, *m_raster;
|
||||||
|
StyleEditor *m_editor;
|
||||||
|
|
||||||
|
StylePageType m_pageType;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NewStyleSetPopup(StylePageType pageType, QWidget *parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event) override { m_nameFld->setFocus(); }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void createStyleSet();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onFavoriteToggled();
|
||||||
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// StyleEditor
|
// StyleEditor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
|
class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
TApplication *m_app;
|
||||||
|
|
||||||
PaletteController *m_paletteController;
|
PaletteController *m_paletteController;
|
||||||
TPaletteHandle *m_paletteHandle;
|
TPaletteHandle *m_paletteHandle;
|
||||||
|
@ -727,17 +802,21 @@ class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
|
||||||
bool m_enabledFirstAndLastTab;
|
bool m_enabledFirstAndLastTab;
|
||||||
bool m_colorPageIsVertical = true;
|
bool m_colorPageIsVertical = true;
|
||||||
|
|
||||||
|
QScrollArea *m_textureOutsideArea;
|
||||||
|
QScrollArea *m_rasterOutsideArea;
|
||||||
|
QScrollArea *m_vectorOutsideArea;
|
||||||
|
|
||||||
std::vector<QPushButton *> m_textureButtons;
|
std::vector<QPushButton *> m_textureButtons;
|
||||||
std::vector<QPushButton *> m_vectorButtons;
|
std::vector<QPushButton *> m_vectorButtons;
|
||||||
std::vector<QPushButton *> m_rasterButtons;
|
std::vector<QPushButton *> m_rasterButtons;
|
||||||
|
|
||||||
std::vector<QLabel *> m_textureLabels;
|
std::vector<ClickableLabel *> m_textureLabels;
|
||||||
std::vector<QLabel *> m_vectorLabels;
|
std::vector<ClickableLabel *> m_vectorLabels;
|
||||||
std::vector<QLabel *> m_rasterLabels;
|
std::vector<ClickableLabel *> m_rasterLabels;
|
||||||
|
|
||||||
std::vector<StyleEditorPage *> m_texturePages;
|
std::vector<StyleChooserPage *> m_texturePages;
|
||||||
std::vector<StyleEditorPage *> m_vectorPages;
|
std::vector<StyleChooserPage *> m_vectorPages;
|
||||||
std::vector<StyleEditorPage *> m_rasterPages;
|
std::vector<StyleChooserPage *> m_rasterPages;
|
||||||
|
|
||||||
QMenu *m_textureMenu;
|
QMenu *m_textureMenu;
|
||||||
QMenu *m_vectorMenu;
|
QMenu *m_vectorMenu;
|
||||||
|
@ -750,6 +829,9 @@ public:
|
||||||
StyleEditor(PaletteController *, QWidget *parent = 0);
|
StyleEditor(PaletteController *, QWidget *parent = 0);
|
||||||
~StyleEditor();
|
~StyleEditor();
|
||||||
|
|
||||||
|
void setApplication(TApplication *app) { m_app = app; }
|
||||||
|
TApplication *getApplication() { return m_app; }
|
||||||
|
|
||||||
void setPaletteHandle(TPaletteHandle *paletteHandle);
|
void setPaletteHandle(TPaletteHandle *paletteHandle);
|
||||||
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
|
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
|
||||||
|
|
||||||
|
@ -774,7 +856,7 @@ public:
|
||||||
QString filters = QString("*"), bool isFavorite = false,
|
QString filters = QString("*"), bool isFavorite = false,
|
||||||
int dirDepth = 0);
|
int dirDepth = 0);
|
||||||
|
|
||||||
void createStyleMenus();
|
void initializeStyleMenus();
|
||||||
|
|
||||||
bool isAltPressed() { return m_isAltPressed; }
|
bool isAltPressed() { return m_isAltPressed; }
|
||||||
bool isCtrlPressed() { return m_isCtrlPressed; }
|
bool isCtrlPressed() { return m_isCtrlPressed; }
|
||||||
|
@ -791,6 +873,18 @@ public:
|
||||||
QStringList savePageStates(StylePageType pageType) const;
|
QStringList savePageStates(StylePageType pageType) const;
|
||||||
void loadPageStates(StylePageType pageType, QStringList pageStateData);
|
void loadPageStates(StylePageType pageType, QStringList pageStateData);
|
||||||
|
|
||||||
|
void createNewStyleSet(StylePageType pageType, TFilePath pagePath,
|
||||||
|
bool isFavorite);
|
||||||
|
void removeStyleSet(QString styleSetName);
|
||||||
|
void removeStyleSetAtIndex(int index, int pageIndex);
|
||||||
|
|
||||||
|
std::vector<StyleChooserPage *> getStyleSetList(StylePageType pageType);
|
||||||
|
|
||||||
|
void setUpdated(TFilePath setPath);
|
||||||
|
TFilePath getSetStyleFolder(QString setName);
|
||||||
|
|
||||||
|
void updatePage(int pageIndex);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*! Return false if style is linked and style must be set to null.*/
|
/*! Return false if style is linked and style must be set to null.*/
|
||||||
bool setStyle(TColorStyle *currentStyle);
|
bool setStyle(TColorStyle *currentStyle);
|
||||||
|
@ -880,12 +974,16 @@ protected slots:
|
||||||
void onExpandAllVectorSet();
|
void onExpandAllVectorSet();
|
||||||
void onExpandAllRasterSet();
|
void onExpandAllRasterSet();
|
||||||
|
|
||||||
void onReloadFavorites();
|
|
||||||
void onUpdateFavorites();
|
void onUpdateFavorites();
|
||||||
|
|
||||||
void onRemoveSelectedFavorites();
|
void onRemoveSelectedStylesFromFavorites();
|
||||||
void onAddSelectedFavorites();
|
void onAddSelectedStylesToFavorites();
|
||||||
void onAddSelectedStyles();
|
void onAddSelectedStylesToPalette();
|
||||||
|
void onCopySelectedStylesToSet();
|
||||||
|
void onMoveSelectedStylesToSet();
|
||||||
|
void onRemoveSelectedStyleFromSet();
|
||||||
|
|
||||||
|
void onAddNewStyleSet();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFrame *createBottomWidget();
|
QFrame *createBottomWidget();
|
||||||
|
|
|
@ -147,17 +147,6 @@ void StatusBar::updateInfoText() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
QString trModKey(QString key) {
|
|
||||||
#ifdef MACOSX
|
|
||||||
// Convert Windows key modifier to macOS modifier
|
|
||||||
key = key.replace("Ctrl", QString::fromStdWString(L"\u2318"));
|
|
||||||
key = key.replace("Shift", QString::fromStdWString(L"\u21e7"));
|
|
||||||
key = key.replace("Alt", QString::fromStdWString(L"\u2325"));
|
|
||||||
key = key.replace("Meta", QString::fromStdWString(L"\u2303"));
|
|
||||||
key = key.replace("+", "");
|
|
||||||
#endif
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unordered_map<std::string, QString> StatusBar::makeMap(
|
std::unordered_map<std::string, QString> StatusBar::makeMap(
|
||||||
QString spacer, QString cmdTextSeparator, QString cmd2TextSeparator) {
|
QString spacer, QString cmdTextSeparator, QString cmd2TextSeparator) {
|
||||||
|
|
|
@ -876,8 +876,8 @@ void TApp::setStatusBarFrameInfo(QString text) {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void TApp::showMessage(QString message) {
|
void TApp::showMessage(QString message, int duration) {
|
||||||
if (m_statusBar) m_statusBar->showMessage(message, 2000);
|
if (m_statusBar) m_statusBar->showMessage(message, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -206,7 +206,7 @@ public:
|
||||||
|
|
||||||
XsheetViewer *getCurrentXsheetViewer() const { return m_xsheetViewer; }
|
XsheetViewer *getCurrentXsheetViewer() const { return m_xsheetViewer; }
|
||||||
|
|
||||||
void showMessage(QString message);
|
void showMessage(QString message, int duration = 2000) override;
|
||||||
void sendShowTitleBars(bool on, bool force = false);
|
void sendShowTitleBars(bool on, bool force = false);
|
||||||
bool getShowTitleBars() { return m_showTitleBars; }
|
bool getShowTitleBars() { return m_showTitleBars; }
|
||||||
void setShowTitleBars(bool on);
|
void setShowTitleBars(bool on);
|
||||||
|
|
|
@ -918,6 +918,7 @@ StyleEditorPanel::StyleEditorPanel(QWidget *parent) : TPanel(parent) {
|
||||||
new StyleEditor(TApp::instance()->getPaletteController(), this);
|
new StyleEditor(TApp::instance()->getPaletteController(), this);
|
||||||
setWidget(m_styleEditor);
|
setWidget(m_styleEditor);
|
||||||
|
|
||||||
|
m_styleEditor->setApplication(TApp::instance());
|
||||||
m_styleEditor->setLevelHandle(TApp::instance()->getCurrentLevel());
|
m_styleEditor->setLevelHandle(TApp::instance()->getCurrentLevel());
|
||||||
setMinimumWidth(200);
|
setMinimumWidth(200);
|
||||||
resize(340, 630);
|
resize(340, 630);
|
||||||
|
|
|
@ -608,3 +608,90 @@ void TStyleManager::signalLoadsFinished() {
|
||||||
if (cm->hasLoadedItems()) cm->signalLoadDone();
|
if (cm->hasLoadedItems()) cm->signalLoadDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
TFilePathSet TStyleManager::getCustomStyleFolders() {
|
||||||
|
TFilePathSet fps;
|
||||||
|
|
||||||
|
std::vector<CustomStyleManager *>::iterator it;
|
||||||
|
for (it = m_customStyleManagers.begin(); it != m_customStyleManagers.end();
|
||||||
|
it++) {
|
||||||
|
CustomStyleManager *cm = *it;
|
||||||
|
fps.push_back(cm->stylesFolder());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
TFilePathSet TStyleManager::getTextureStyleFolders() {
|
||||||
|
TFilePathSet fps;
|
||||||
|
|
||||||
|
std::vector<TextureStyleManager *>::iterator it;
|
||||||
|
for (it = m_textureStyleManagers.begin(); it != m_textureStyleManagers.end();
|
||||||
|
it++) {
|
||||||
|
TextureStyleManager *tm = *it;
|
||||||
|
fps.push_back(tm->stylesFolder());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
TFilePathSet TStyleManager::getBrushStyleFolders() {
|
||||||
|
TFilePathSet fps;
|
||||||
|
|
||||||
|
std::vector<BrushStyleManager *>::iterator it;
|
||||||
|
for (it = m_brushStyleManagers.begin(); it != m_brushStyleManagers.end();
|
||||||
|
it++) {
|
||||||
|
BrushStyleManager *rm = *it;
|
||||||
|
fps.push_back(rm->stylesFolder());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fps;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
void TStyleManager::removeCustomStyleFolder(TFilePath styleFolder) {
|
||||||
|
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||||
|
int i = 0;
|
||||||
|
for (int i = 0; i < m_customStyleFolders.size(); i++) {
|
||||||
|
std::pair<TFilePath, QString> fpInfo = m_customStyleFolders[i];
|
||||||
|
if (fpInfo.first != styleFolder) continue;
|
||||||
|
m_customStyleFolders.erase(m_customStyleFolders.begin() + i);
|
||||||
|
m_customStyleManagers.erase(m_customStyleManagers.begin() + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
void TStyleManager::removeTextureStyleFolder(TFilePath styleFolder) {
|
||||||
|
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||||
|
int i = 0;
|
||||||
|
for (int i = 0; i < m_textureStyleFolders.size(); i++) {
|
||||||
|
std::pair<TFilePath, QString> fpInfo = m_textureStyleFolders[i];
|
||||||
|
if (fpInfo.first != styleFolder) continue;
|
||||||
|
m_textureStyleFolders.erase(m_textureStyleFolders.begin() + i);
|
||||||
|
m_textureStyleManagers.erase(m_textureStyleManagers.begin() + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
void TStyleManager::removeBrushStyleFolder(TFilePath styleFolder) {
|
||||||
|
std::vector<std::pair<TFilePath, QString>>::iterator it;
|
||||||
|
int i = 0;
|
||||||
|
for (int i = 0; i < m_brushStyleFolders.size(); i++) {
|
||||||
|
std::pair<TFilePath, QString> fpInfo = m_brushStyleFolders[i];
|
||||||
|
if (fpInfo.first != styleFolder) continue;
|
||||||
|
m_brushStyleFolders.erase(m_brushStyleFolders.begin() + i);
|
||||||
|
m_brushStyleManagers.erase(m_brushStyleManagers.begin() + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -739,3 +739,17 @@ void ToolBarContainer::paintEvent(QPaintEvent *event) { QPainter p(this); }
|
||||||
QString operator+(const QString &a, const TFilePath &fp) {
|
QString operator+(const QString &a, const TFilePath &fp) {
|
||||||
return a + QString::fromStdWString(fp.getWideString());
|
return a + QString::fromStdWString(fp.getWideString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
QString trModKey(QString key) {
|
||||||
|
#ifdef MACOSX
|
||||||
|
// Convert Windows key modifier to macOS modifier
|
||||||
|
key = key.replace("Ctrl", QString::fromStdWString(L"\u2318"));
|
||||||
|
key = key.replace("Shift", QString::fromStdWString(L"\u21e7"));
|
||||||
|
key = key.replace("Alt", QString::fromStdWString(L"\u2325"));
|
||||||
|
key = key.replace("Meta", QString::fromStdWString(L"\u2303"));
|
||||||
|
key = key.replace("+", "");
|
||||||
|
#endif
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue