Merge branch 'master' of https://github.com/tahoma2d/tahoma2d into v1.3_translation_files

This commit is contained in:
manongjohn 2022-05-05 07:12:52 -04:00
commit cbf2e01fbd
36 changed files with 297 additions and 128 deletions

View file

@ -310,7 +310,6 @@ QMenu {
} }
QMenu::item { QMenu::item {
border: 0; border: 0;
padding: 3 28;
} }
QMenu::item:selected { QMenu::item:selected {
background-color: #a35293; background-color: #a35293;
@ -2239,7 +2238,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: #9fdaff; qproperty-PreviewFrameTextColor: #9fdaff;
qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7); qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7);
qproperty-OnionSkinAreaBgColor: #282828; qproperty-OnionSkinAreaBgColor: #282828;
qproperty-CellFocusColor: #000;
qproperty-ColumnIconLineColor: #111111; qproperty-ColumnIconLineColor: #111111;
qproperty-EmptyColumnHeadColor: #303030; qproperty-EmptyColumnHeadColor: #303030;
qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0); qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0);

View file

@ -310,7 +310,6 @@ QMenu {
} }
QMenu::item { QMenu::item {
border: 0; border: 0;
padding: 3 28;
} }
QMenu::item:selected { QMenu::item:selected {
background-color: #a35293; background-color: #a35293;
@ -2239,7 +2238,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: #9fdaff; qproperty-PreviewFrameTextColor: #9fdaff;
qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7); qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7);
qproperty-OnionSkinAreaBgColor: #1b1b1b; qproperty-OnionSkinAreaBgColor: #1b1b1b;
qproperty-CellFocusColor: #000;
qproperty-ColumnIconLineColor: #060606; qproperty-ColumnIconLineColor: #060606;
qproperty-EmptyColumnHeadColor: #343434; qproperty-EmptyColumnHeadColor: #343434;
qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0); qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0);

View file

@ -310,7 +310,6 @@ QMenu {
} }
QMenu::item { QMenu::item {
border: 0; border: 0;
padding: 3 28;
} }
QMenu::item:selected { QMenu::item:selected {
background-color: #d97fbe; background-color: #d97fbe;
@ -2239,7 +2238,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: #2d42b9; qproperty-PreviewFrameTextColor: #2d42b9;
qproperty-CurrentRowBgColor: rgba(216, 87, 177, 0.7); qproperty-CurrentRowBgColor: rgba(216, 87, 177, 0.7);
qproperty-OnionSkinAreaBgColor: #c2c2c2; qproperty-OnionSkinAreaBgColor: #c2c2c2;
qproperty-CellFocusColor: #000;
qproperty-ColumnIconLineColor: #707070; qproperty-ColumnIconLineColor: #707070;
qproperty-EmptyColumnHeadColor: #DBDBDB; qproperty-EmptyColumnHeadColor: #DBDBDB;
qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0); qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0);

View file

@ -310,7 +310,6 @@ QMenu {
} }
QMenu::item { QMenu::item {
border: 0; border: 0;
padding: 3 28;
} }
QMenu::item:selected { QMenu::item:selected {
background-color: #a35293; background-color: #a35293;
@ -2239,7 +2238,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: #9fdaff; qproperty-PreviewFrameTextColor: #9fdaff;
qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7); qproperty-CurrentRowBgColor: rgba(163, 82, 147, 0.7);
qproperty-OnionSkinAreaBgColor: #393939; qproperty-OnionSkinAreaBgColor: #393939;
qproperty-CellFocusColor: #000;
qproperty-ColumnIconLineColor: #2c2c2c; qproperty-ColumnIconLineColor: #2c2c2c;
qproperty-EmptyColumnHeadColor: #484848; qproperty-EmptyColumnHeadColor: #484848;
qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0); qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0);

View file

@ -140,7 +140,6 @@ QMenu {
padding: 2 0; padding: 2 0;
&::item { &::item {
border: 0; border: 0;
padding: 3 28;
&:selected { &:selected {
background-color: @menu-item-bg-color-selected; background-color: @menu-item-bg-color-selected;
color: @menu-item-text-color-selected; color: @menu-item-text-color-selected;

View file

@ -83,7 +83,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: @xsheet-PreviewFrameText-color; qproperty-PreviewFrameTextColor: @xsheet-PreviewFrameText-color;
qproperty-CurrentRowBgColor: @xsheet-CurrentRowBG-color; qproperty-CurrentRowBgColor: @xsheet-CurrentRowBG-color;
qproperty-OnionSkinAreaBgColor: @xsheet-OnionSkinAreaBG-color; qproperty-OnionSkinAreaBgColor: @xsheet-OnionSkinAreaBG-color;
qproperty-CellFocusColor: @xsheet-CellFocus-color;
qproperty-ColumnIconLineColor: @xsheet-ColumnIconLine-color; qproperty-ColumnIconLineColor: @xsheet-ColumnIconLine-color;
qproperty-EmptyColumnHeadColor: @xsheet-EmptyColumnHead-color; qproperty-EmptyColumnHeadColor: @xsheet-EmptyColumnHead-color;
qproperty-ColumnHeadPastelizer: @xsheet-ColumnHeadPastelizer-color; qproperty-ColumnHeadPastelizer: @xsheet-ColumnHeadPastelizer-color;

View file

@ -310,7 +310,6 @@ QMenu {
} }
QMenu::item { QMenu::item {
border: 0; border: 0;
padding: 3 28;
} }
QMenu::item:selected { QMenu::item:selected {
background-color: #c16099; background-color: #c16099;
@ -2239,7 +2238,6 @@ XsheetViewer {
qproperty-PreviewFrameTextColor: #17239c; qproperty-PreviewFrameTextColor: #17239c;
qproperty-CurrentRowBgColor: rgba(251, 140, 205, 0.7); qproperty-CurrentRowBgColor: rgba(251, 140, 205, 0.7);
qproperty-OnionSkinAreaBgColor: #6c6c6c; qproperty-OnionSkinAreaBgColor: #6c6c6c;
qproperty-CellFocusColor: #000;
qproperty-ColumnIconLineColor: #4d4d4d; qproperty-ColumnIconLineColor: #4d4d4d;
qproperty-EmptyColumnHeadColor: #808080; qproperty-EmptyColumnHeadColor: #808080;
qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0); qproperty-ColumnHeadPastelizer: rgba(0, 0, 0, 0);

View file

@ -220,8 +220,8 @@ bool TPSDReader::doLayersInfo() {
m_headerInfo.layersCount = -m_headerInfo.layersCount; m_headerInfo.layersCount = -m_headerInfo.layersCount;
} }
if (!m_headerInfo.linfoBlockEmpty) { if (!m_headerInfo.linfoBlockEmpty) {
m_headerInfo.linfo = (TPSDLayerInfo *)mymalloc( m_headerInfo.linfo = (TPSDLayerInfo *)mycalloc(
m_headerInfo.layersCount * sizeof(struct TPSDLayerInfo)); m_headerInfo.layersCount, sizeof(struct TPSDLayerInfo));
int i = 0; int i = 0;
for (i = 0; i < m_headerInfo.layersCount; i++) { for (i = 0; i < m_headerInfo.layersCount; i++) {
readLayerInfo(i); readLayerInfo(i);
@ -306,6 +306,9 @@ bool TPSDReader::readLayerInfo(int i) {
} }
// process layer's 'additional info' // process layer's 'additional info'
// Assumption: File will provide all layerIds or none at all.
// Set layer id, for now, knowing it may be overwritten if found in file
li->layerId = i + 1;
li->additionalpos = ftell(m_file); li->additionalpos = ftell(m_file);
li->additionallen = extrastart + extralen - li->additionalpos; li->additionallen = extrastart + extralen - li->additionalpos;

View file

@ -136,6 +136,15 @@ void *mymalloc(long n) {
return NULL; return NULL;
} }
void *mycalloc(long n, int size) {
void *p = calloc(n, size);
if (p)
return p;
else {
// ALLOCATION ERROR
}
return NULL;
}
// ZIP COMPRESSION // ZIP COMPRESSION
// ZIP WITHOUT PREDICTION // ZIP WITHOUT PREDICTION

View file

@ -36,6 +36,7 @@ void readrow(FILE *psd, TPSDChannelInfo *chan, psdPixel rowIndex,
void skipBlock(FILE *f); void skipBlock(FILE *f);
void *mymalloc(long n); void *mymalloc(long n);
void *mycalloc(long n, int size);
unsigned read2UBytes(FILE *f); unsigned read2UBytes(FILE *f);
int read2Bytes(FILE *f); int read2Bytes(FILE *f);
long read4Bytes(FILE *f); long read4Bytes(FILE *f);

View file

@ -172,6 +172,7 @@ enum class PredefinedPath {
VOLUME_SLIDER_TRACK, //! slider track VOLUME_SLIDER_TRACK, //! slider track
VOLUME_SLIDER_HEAD, //! slider head VOLUME_SLIDER_HEAD, //! slider head
TIME_INDICATOR_HEAD, //! current time indicator head TIME_INDICATOR_HEAD, //! current time indicator head
FRAME_MARKER_DIAMOND_SMALL,
FRAME_MARKER_DIAMOND, FRAME_MARKER_DIAMOND,
FRAME_MARKER_DIAMOND_LARGE, FRAME_MARKER_DIAMOND_LARGE,
NAVIGATION_TAG NAVIGATION_TAG

View file

@ -200,7 +200,10 @@ public:
QStringList getLanguageList() const { return m_languageList; } QStringList getLanguageList() const { return m_languageList; }
QMap<int, QString> getRoomMap() const { return m_roomMaps; } QMap<int, QString> getRoomMap() const { return m_roomMaps; }
QString getCurrentStyleSheetPath() const; // OK QString getCurrentStyleSheet() const;
QString getAdditionalStyleSheet() const {
return getStringValue(additionalStyleSheet);
}
bool getPixelsOnly() const { return getBoolValue(pixelsOnly); } bool getPixelsOnly() const { return getBoolValue(pixelsOnly); }
QString getOldUnits() const { return getStringValue(oldUnits); } QString getOldUnits() const { return getStringValue(oldUnits); }
QString getOldCameraUnits() const { return getStringValue(oldCameraUnits); } QString getOldCameraUnits() const { return getStringValue(oldCameraUnits); }

View file

@ -24,6 +24,7 @@ enum PreferencesItemId {
//---------- //----------
// Interface // Interface
CurrentStyleSheetName, CurrentStyleSheetName,
additionalStyleSheet,
iconTheme, iconTheme,
pixelsOnly, pixelsOnly,
oldUnits, oldUnits,

View file

@ -440,6 +440,7 @@ private:
class DVAPI TColorChipProperty final : public TProperty { class DVAPI TColorChipProperty final : public TProperty {
public: public:
typedef std::vector<std::wstring> Range;
struct ColorChip { struct ColorChip {
QString UIName; QString UIName;
TPixel32 pixelColor; TPixel32 pixelColor;
@ -455,12 +456,8 @@ public:
TProperty *clone() const override { return new TColorChipProperty(*this); } TProperty *clone() const override { return new TColorChipProperty(*this); }
int indexOf(const std::wstring &value) { int indexOf(const std::wstring &value) {
ColorChips::const_iterator it; Range::const_iterator it = std::find(m_range.begin(), m_range.end(), value);
for (it = m_chips.begin(); it != m_chips.end(); it++) { return (it == m_range.end()) ? -1 : it - m_range.begin();
ColorChip chip = *it;
if (chip.UIName == QString::fromStdWString(value)) break;
}
return (it == m_chips.end()) ? -1 : it - m_chips.begin();
} }
int indexOf(TPixel32 color) { int indexOf(TPixel32 color) {
@ -472,10 +469,15 @@ public:
return (it == m_chips.end()) ? -1 : it - m_chips.begin(); return (it == m_chips.end()) ? -1 : it - m_chips.begin();
} }
bool isValue(const std::wstring &value) { return (indexOf(value) != -1); } bool isValue(const std::wstring &value) {
bool ret =
std::find(m_range.begin(), m_range.end(), value) != m_range.end();
return ret;
}
void addValue(std::wstring value, const TPixel32 &color) { void addValue(std::wstring value, const TPixel32 &color) {
if (m_index == -1) m_index = 0; if (m_index == -1) m_index = 0;
m_range.push_back(value);
m_chips.push_back(ColorChip(QString::fromStdWString(value), color)); m_chips.push_back(ColorChip(QString::fromStdWString(value), color));
} }
@ -486,6 +488,7 @@ public:
} }
void deleteAllValues() { void deleteAllValues() {
m_range.clear();
m_chips.clear(); m_chips.clear();
m_index = -1; m_index = -1;
} }
@ -509,13 +512,14 @@ public:
int getCount() const { return (int)m_chips.size(); } int getCount() const { return (int)m_chips.size(); }
const Range &getRange() const { return m_range; }
const ColorChips &getColorChips() const { return m_chips; } const ColorChips &getColorChips() const { return m_chips; }
std::wstring getValue() const { std::wstring getValue() const {
return (m_index < 0) ? L"" : m_chips[m_index].UIName.toStdWString(); return (m_index < 0) ? L"" : m_range[m_index];
} }
std::string getValueAsString() override { std::string getValueAsString() override {
return (m_index < 0) ? "" : m_chips[m_index].UIName.toStdString(); return ::to_string(m_range[m_index]);
} }
TPixel32 getColorValue() const { TPixel32 getColorValue() const {
return (m_index < 0) ? TPixel32(0, 0, 0) : m_chips[m_index].pixelColor; return (m_index < 0) ? TPixel32(0, 0, 0) : m_chips[m_index].pixelColor;
@ -528,6 +532,7 @@ public:
void assignUIName(TProperty *refP) override; void assignUIName(TProperty *refP) override;
private: private:
Range m_range;
ColorChips m_chips; ColorChips m_chips;
int m_index; int m_index;
}; };

View file

@ -602,10 +602,10 @@ void ColorChipCombo::updateStatus() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ColorChipCombo::onActivated(int index) { void ColorChipCombo::onActivated(int index) {
const TColorChipProperty::ColorChips &chips = m_property->getColorChips(); const TColorChipProperty::Range &range = m_property->getRange();
if (index < 0 || index >= (int)chips.size()) return; if (index < 0 || index >= (int)range.size()) return;
std::wstring item = chips[index].UIName.toStdWString(); std::wstring item = range[index];
m_property->setValue(item); m_property->setValue(item);
notifyTool(); notifyTool();
} }

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="11px" height="11px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="rect4" transform="matrix(1,0,0,1,0,-1)">
<rect x="0" y="0" width="11" height="13" style="fill:none;"/>
</g>
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z"/>
<g transform="matrix(0.817027,0,0,0.776366,1.00635,1.22999)">
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z" style="fill:white;"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 760 B

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="11px" height="11px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="rect4" transform="matrix(1,0,0,1,0,-1)">
<rect x="0" y="0" width="11" height="13" style="fill:none;"/>
</g>
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z"/>
<g transform="matrix(0.817027,0,0,0.776366,1.00635,1.22999)">
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z" style="fill:rgb(171,206,255);"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 771 B

View file

@ -495,6 +495,7 @@ void FileBrowser::getRevisionHistory() {
timelineDialog->show(); timelineDialog->show();
timelineDialog->raise(); timelineDialog->raise();
timelineDialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -573,6 +574,7 @@ void FileBrowser::showLockInformation() {
SVNLockInfoDialog *dialog = new SVNLockInfoDialog(this, status); SVNLockInfoDialog *dialog = new SVNLockInfoDialog(this, status);
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -532,6 +532,7 @@ void FileSelection::separateFilesByColors() {
popup->setFiles(files); popup->setFiles(files);
popup->show(); popup->show();
popup->raise(); popup->raise();
popup->activateWindow();
// popup->exec(); // popup->exec();
} }

View file

@ -909,8 +909,9 @@ FlipBook *FlipBookPool::pop() {
// The panel need to be added to currentRoom's layout control. // The panel need to be added to currentRoom's layout control.
currentRoom->addDockWidget(panel); currentRoom->addDockWidget(panel);
panel->raise();
panel->show(); panel->show();
panel->raise();
panel->activateWindow();
return flipbook; return flipbook;
} }

View file

@ -126,6 +126,7 @@ TPanel *OpenFloatingPanel::getOrOpenFloatingPanel(
currentRoom->addDockWidget(panel); currentRoom->addDockWidget(panel);
panel->show(); panel->show();
panel->raise(); panel->raise();
panel->activateWindow();
return panel; return panel;
} else } else
lastFloatingPos = panel->pos(); lastFloatingPos = panel->pos();
@ -141,6 +142,7 @@ TPanel *OpenFloatingPanel::getOrOpenFloatingPanel(
panel->setFloating(true); panel->setFloating(true);
panel->show(); panel->show();
panel->raise(); panel->raise();
panel->activateWindow();
if (!lastFloatingPos.isNull()) if (!lastFloatingPos.isNull())
panel->move(QPoint(lastFloatingPos.x() + 30, lastFloatingPos.y() + 30)); panel->move(QPoint(lastFloatingPos.x() + 30, lastFloatingPos.y() + 30));

View file

@ -12,6 +12,7 @@
#include "cleanupsettingspopup.h" #include "cleanupsettingspopup.h"
#include "filebrowsermodel.h" #include "filebrowsermodel.h"
#include "expressionreferencemanager.h" #include "expressionreferencemanager.h"
#include "startuppopup.h"
// TnzTools includes // TnzTools includes
#include "tools/tool.h" #include "tools/tool.h"
@ -230,7 +231,7 @@ project->setUseScenePath(TProject::Extras, false);
// Imposto la rootDir per ImageCache // Imposto la rootDir per ImageCache
/*-- TOONZCACHEROOTの設定 --*/ /*-- TOONZCACHEROOTの設定 --*/
TFilePath cacheDir = ToonzFolder::getCacheRootFolder(); TFilePath cacheDir = ToonzFolder::getCacheRootFolder();
if (cacheDir.isEmpty()) cacheDir = TEnv::getStuffDir() + "cache"; if (cacheDir.isEmpty()) cacheDir = TEnv::getStuffDir() + "cache";
TImageCache::instance()->setRootDir(cacheDir); TImageCache::instance()->setRootDir(cacheDir);
@ -338,10 +339,10 @@ int main(int argc, char *argv[]) {
QApplication a(argc, argv); QApplication a(argc, argv);
#ifdef MACOSX #ifdef MACOSX
// This workaround is to avoid missing left button problem on Qt5.6.0. // This workaround is to avoid missing left button problem on Qt5.6.0.
// To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending // To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending
// NSLeftButtonDown event before NSLeftMouseDragged event propagated to // NSLeftButtonDown event before NSLeftMouseDragged event propagated to
// QApplication. See more details in ../mousedragfilter/mousedragfilter.mm. // QApplication. See more details in ../mousedragfilter/mousedragfilter.mm.
#include "mousedragfilter.h" #include "mousedragfilter.h"
@ -761,7 +762,7 @@ int main(int argc, char *argv[]) {
a.processEvents(); a.processEvents();
// Carico lo styleSheet // Carico lo styleSheet
QString currentStyle = Preferences::instance()->getCurrentStyleSheetPath(); QString currentStyle = Preferences::instance()->getCurrentStyleSheet();
a.setStyleSheet(currentStyle); a.setStyleSheet(currentStyle);
// Perspective grid tool - custom grid // Perspective grid tool - custom grid
@ -812,6 +813,13 @@ int main(int argc, char *argv[]) {
// Show floating panels only after the main window has been shown // Show floating panels only after the main window has been shown
w.startupFloatingPanels(); w.startupFloatingPanels();
if (Preferences::instance()->isStartupPopupEnabled()) {
StartupPopup *startupPopup = new StartupPopup();
startupPopup->show();
startupPopup->raise();
startupPopup->activateWindow();
}
CommandManager::instance()->execute(T_Hand); CommandManager::instance()->execute(T_Hand);
if (!loadFilePath.isEmpty()) { if (!loadFilePath.isEmpty()) {
splash.showMessage( splash.showMessage(

View file

@ -12,7 +12,6 @@
#include "iocommand.h" #include "iocommand.h"
#include "tapp.h" #include "tapp.h"
#include "viewerpane.h" #include "viewerpane.h"
#include "startuppopup.h"
#include "tooloptionsshortcutinvoker.h" #include "tooloptionsshortcutinvoker.h"
#include "statusbar.h" #include "statusbar.h"
#include "aboutpopup.h" #include "aboutpopup.h"
@ -1264,7 +1263,7 @@ void MainWindow::onMenuCheckboxChanged() {
FieldGuideToggleAction = isChecked; FieldGuideToggleAction = isChecked;
else if (cm->getAction(MI_RasterizePli) == action) { else if (cm->getAction(MI_RasterizePli) == action) {
if (!QGLPixelBuffer::hasOpenGLPbuffers()) isChecked = 0; if (!QGLPixelBuffer::hasOpenGLPbuffers()) isChecked = 0;
RasterizePliToggleAction = isChecked; RasterizePliToggleAction = isChecked;
} else if (cm->getAction(MI_SafeArea) == action) } else if (cm->getAction(MI_SafeArea) == action)
SafeAreaToggleAction = isChecked; SafeAreaToggleAction = isChecked;
else if (cm->getAction(MI_ViewColorcard) == action) else if (cm->getAction(MI_ViewColorcard) == action)
@ -1308,12 +1307,6 @@ void MainWindow::onMenuCheckboxChanged() {
void MainWindow::showEvent(QShowEvent *event) { void MainWindow::showEvent(QShowEvent *event) {
getCurrentRoom()->layout()->setEnabled(true); // See main function in getCurrentRoom()->layout()->setEnabled(true); // See main function in
// main.cpp // main.cpp
if (Preferences::instance()->isStartupPopupEnabled() &&
!m_startupPopupShown) {
StartupPopup *startupPopup = new StartupPopup();
startupPopup->show();
m_startupPopupShown = true;
}
} }
extern const char *applicationName; extern const char *applicationName;
extern const char *applicationVersion; extern const char *applicationVersion;
@ -3165,7 +3158,7 @@ void MainWindow::clearCacheFolder() {
// 1. $CACHE/[Current ProcessID] // 1. $CACHE/[Current ProcessID]
// 2. $CACHE/temp/[Current scene folder] if the current scene is untitled // 2. $CACHE/temp/[Current scene folder] if the current scene is untitled
TFilePath cacheRoot = ToonzFolder::getCacheRootFolder(); TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache"; if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache";
TFilePathSet filesToBeRemoved; TFilePathSet filesToBeRemoved;
@ -3317,12 +3310,8 @@ class ReloadStyle final : public MenuItemHandler {
public: public:
ReloadStyle() : MenuItemHandler("MI_ReloadStyle") {} ReloadStyle() : MenuItemHandler("MI_ReloadStyle") {}
void execute() override { void execute() override {
QString currentStyle = Preferences::instance()->getCurrentStyleSheetPath(); QString currentStyle = Preferences::instance()->getCurrentStyleSheet();
QFile file(currentStyle); qApp->setStyleSheet(currentStyle);
file.open(QFile::ReadOnly);
QString styleSheet = QString(file.readAll());
qApp->setStyleSheet(styleSheet);
file.close();
} }
} reloadStyle; } reloadStyle;

View file

@ -60,7 +60,6 @@ class MainWindow final : public QMainWindow {
Q_OBJECT Q_OBJECT
bool m_saveSettingsOnQuit; bool m_saveSettingsOnQuit;
bool m_startupPopupShown = false;
bool m_shownOnce = false; bool m_shownOnce = false;
int m_oldRoomIndex; int m_oldRoomIndex;
QString m_currentRoomsChoice; QString m_currentRoomsChoice;

View file

@ -1322,8 +1322,9 @@ public:
static MeshifyPopup *thePopup = 0; static MeshifyPopup *thePopup = 0;
if (!thePopup) thePopup = new MeshifyPopup; if (!thePopup) thePopup = new MeshifyPopup;
thePopup->raise();
thePopup->show(); thePopup->show();
thePopup->raise();
thePopup->activateWindow();
} }
} meshifyCommand; } meshifyCommand;

View file

@ -172,6 +172,7 @@ public:
pane->getPanelType() == "Message") { pane->getPanelType() == "Message") {
pane->show(); pane->show();
pane->raise(); pane->raise();
pane->activateWindow();
return; return;
} }
} }
@ -180,6 +181,7 @@ public:
pane->setFloating(true); pane->setFloating(true);
pane->show(); pane->show();
pane->raise(); pane->raise();
pane->activateWindow();
} }
} }
} openFloatingLogPanelCommand; } openFloatingLogPanelCommand;

View file

@ -108,7 +108,7 @@ SizeField::SizeField(QSize min, QSize max, QSize value, QWidget* parent)
bool ret = true; bool ret = true;
ret = ret && connect(m_fieldX, SIGNAL(editingFinished()), this, ret = ret && connect(m_fieldX, SIGNAL(editingFinished()), this,
SIGNAL(editingFinished())); SIGNAL(editingFinished()));
ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this, ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this,
SIGNAL(editingFinished())); SIGNAL(editingFinished()));
assert(ret); assert(ret);
} }
@ -355,6 +355,53 @@ PreferencesPopup::Display30bitChecker::~Display30bitChecker() {
QSurfaceFormat::setDefaultFormat(m_currentDefaultFormat); QSurfaceFormat::setDefaultFormat(m_currentDefaultFormat);
} }
//**********************************************************************************
// PreferencesPopup::AdditionalStyleEdit implementation
//**********************************************************************************
PreferencesPopup::AdditionalStyleEdit::AdditionalStyleEdit(
PreferencesPopup* parent)
: DVGui::Dialog(parent, true, false, "AdditionalStyleEdit") {
setWindowTitle(tr("Additional Style Sheet"));
setModal(true);
m_edit = new QTextEdit(this);
QPushButton* okButton = new QPushButton(tr("OK"), this);
QPushButton* applyButton = new QPushButton(tr("Apply"), this);
QPushButton* closeButton = new QPushButton(tr("Close"), this);
QString placeHolderTxt(
"/* Type additional style sheet here to customize GUI. \n"
" Example: To enlarge the Style Editor buttons */\n\n"
"#StyleEditor #bottomWidget QPushButton{ \n padding : 13 21; \n }");
m_edit->setPlaceholderText(placeHolderTxt);
m_edit->setAcceptRichText(false);
m_topLayout->addWidget(m_edit);
addButtonBarWidget(okButton, applyButton, closeButton);
bool ret = true;
ret = ret && connect(okButton, SIGNAL(pressed()), this, SLOT(onOK()));
ret = ret && connect(applyButton, SIGNAL(pressed()), this, SLOT(onApply()));
ret = ret && connect(closeButton, SIGNAL(pressed()), this, SLOT(close()));
}
void PreferencesPopup::AdditionalStyleEdit::showEvent(QShowEvent*) {
m_edit->setPlainText(Preferences::instance()->getAdditionalStyleSheet());
}
void PreferencesPopup::AdditionalStyleEdit::onOK() {
onApply();
close();
}
void PreferencesPopup::AdditionalStyleEdit::onApply() {
Preferences::instance()->setValue(additionalStyleSheet,
m_edit->toPlainText());
emit additionalSheetEdited();
}
//********************************************************************************** //**********************************************************************************
// PreferencesPopup implementation // PreferencesPopup implementation
//********************************************************************************** //**********************************************************************************
@ -437,14 +484,16 @@ void PreferencesPopup::onPathAliasPriorityChanged() {
void PreferencesPopup::onStyleSheetTypeChanged() { void PreferencesPopup::onStyleSheetTypeChanged() {
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
QString currentStyle = m_pref->getCurrentStyleSheetPath(); QString currentStyle = m_pref->getCurrentStyleSheet();
QString iconThemeName = QIcon::themeName(); QString iconThemeName = QIcon::themeName();
std::string styleString = currentStyle.toStdString(); std::string styleString = currentStyle.toStdString();
std::string iconThemeString = iconThemeName.toStdString(); std::string iconThemeString = iconThemeName.toStdString();
qApp->setStyleSheet(currentStyle); qApp->setStyleSheet(currentStyle);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if (currentStyle.contains("Light") || currentStyle.contains("Neutral")) { if (currentStyle.contains("file:///") && (currentStyle.contains("Light") ||
currentStyle.contains("Neutral")) ||
currentStyle.contains("imgs/black")) {
m_pref->setValue(iconTheme, true); m_pref->setValue(iconTheme, true);
if (iconThemeName != "dark") { if (iconThemeName != "dark") {
// QIcon::setThemeName(Preferences::instance()->getIconTheme() ? "dark" // QIcon::setThemeName(Preferences::instance()->getIconTheme() ? "dark"
@ -741,6 +790,25 @@ void PreferencesPopup::onAutoSavePeriodExternallyChanged() {
//} //}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void PreferencesPopup::onEditAdditionalStyleSheet() {
if (!m_additionalStyleEdit) {
m_additionalStyleEdit = new AdditionalStyleEdit(this);
bool ret = connect(m_additionalStyleEdit, SIGNAL(additionalSheetEdited()),
this, SLOT(onAdditionalStyleSheetEdited()));
assert(ret);
}
m_additionalStyleEdit->show();
}
//-----------------------------------------------------------------------------
void PreferencesPopup::onAdditionalStyleSheetEdited() {
onStyleSheetTypeChanged();
}
//-----------------------------------------------------------------------------
void PreferencesPopup::onPixelUnitExternallySelected(bool on) { void PreferencesPopup::onPixelUnitExternallySelected(bool on) {
CheckBox* pixelsOnlyCB = getUI<CheckBox*>(pixelsOnly); CheckBox* pixelsOnlyCB = getUI<CheckBox*>(pixelsOnly);
// call slot function onPixelsOnlyChanged() accordingly // call slot function onPixelsOnlyChanged() accordingly
@ -760,7 +828,7 @@ void PreferencesPopup::onInterfaceFontChanged(const QString& text) {
for (ComboBoxItem& item : newStyleItems) for (ComboBoxItem& item : newStyleItems)
fontStyleCombo->addItem(item.first, item.second); fontStyleCombo->addItem(item.first, item.second);
if (!oldTypeface.isEmpty()) { if (!oldTypeface.isEmpty()) {
int newIndex = fontStyleCombo->findText(oldTypeface); int newIndex = fontStyleCombo->findText(oldTypeface);
if (newIndex < 0) newIndex = 0; if (newIndex < 0) newIndex = 0;
fontStyleCombo->setCurrentIndex(newIndex); fontStyleCombo->setCurrentIndex(newIndex);
} }
@ -887,7 +955,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
for (const ComboBoxItem& item : comboItems) for (const ComboBoxItem& item : comboItems)
combo->addItem(item.first, item.second); combo->addItem(item.first, item.second);
combo->setCurrentIndex(combo->findData(item.value)); combo->setCurrentIndex(combo->findData(item.value));
ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
SLOT(onChange())); SLOT(onChange()));
widget = combo; widget = combo;
} else { // create IntLineEdit } else { // create IntLineEdit
@ -924,7 +992,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
if (id == interfaceFont) { // create QFontComboBox if (id == interfaceFont) { // create QFontComboBox
QFontComboBox* combo = new QFontComboBox(this); QFontComboBox* combo = new QFontComboBox(this);
combo->setCurrentText(item.value.toString()); combo->setCurrentText(item.value.toString());
ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this, ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this,
SLOT(onInterfaceFontChanged(const QString&))); SLOT(onInterfaceFontChanged(const QString&)));
widget = combo; widget = combo;
} else if (!comboItems.isEmpty()) { // create QComboBox } else if (!comboItems.isEmpty()) { // create QComboBox
@ -932,7 +1000,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
for (const ComboBoxItem& item : comboItems) for (const ComboBoxItem& item : comboItems)
combo->addItem(item.first, item.second); combo->addItem(item.first, item.second);
combo->setCurrentIndex(combo->findData(item.value)); combo->setCurrentIndex(combo->findData(item.value));
ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
SLOT(onChange())); SLOT(onChange()));
widget = combo; widget = combo;
} else { // create FileField } else { // create FileField
@ -955,7 +1023,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id,
{ {
ColorField* field = ColorField* field =
new ColorField(this, false, colorToTPixel(item.value.value<QColor>())); new ColorField(this, false, colorToTPixel(item.value.value<QColor>()));
ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this, ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this,
SLOT(onColorFieldChanged(const TPixel32&, bool))); SLOT(onColorFieldChanged(const TPixel32&, bool)));
widget = field; widget = field;
} break; } break;
@ -1405,7 +1473,9 @@ inline T PreferencesPopup::getUI(PreferencesItemId id) {
//********************************************************************************** //**********************************************************************************
PreferencesPopup::PreferencesPopup() PreferencesPopup::PreferencesPopup()
: QDialog(TApp::instance()->getMainWindow()), m_formatProperties() { : QDialog(TApp::instance()->getMainWindow())
, m_formatProperties()
, m_additionalStyleEdit(nullptr) {
setWindowTitle(tr("Preferences")); setWindowTitle(tr("Preferences"));
setObjectName("PreferencesPopup"); setObjectName("PreferencesPopup");
@ -1546,9 +1616,9 @@ QWidget* PreferencesPopup::createGeneralPage() {
bool ret = true; bool ret = true;
ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this, ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this,
SLOT(onAutoSaveExternallyChanged())); SLOT(onAutoSaveExternallyChanged()));
ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this, ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this,
SLOT(onAutoSaveExternallyChanged())); SLOT(onAutoSaveExternallyChanged()));
ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this, ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
SLOT(onAutoSavePeriodExternallyChanged())); SLOT(onAutoSavePeriodExternallyChanged()));
// ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)), // ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
@ -1585,12 +1655,16 @@ QWidget* PreferencesPopup::createInterfacePage() {
QPushButton* check30bitBtn = new QPushButton(tr("Check Availability")); QPushButton* check30bitBtn = new QPushButton(tr("Check Availability"));
QPushButton* additionalStyleSheetBtn =
new QPushButton(tr("Edit Additional Style Sheet.."));
QWidget* widget = new QWidget(this); QWidget* widget = new QWidget(this);
QGridLayout* lay = new QGridLayout(); QGridLayout* lay = new QGridLayout();
setupLayout(lay); setupLayout(lay);
insertUI(CurrentStyleSheetName, lay, styleSheetItemList); insertUI(CurrentStyleSheetName, lay, styleSheetItemList);
int row = lay->rowCount(); int row = lay->rowCount();
lay->addWidget(additionalStyleSheetBtn, row - 1, 3);
// lay->addWidget(new QLabel(tr("Icon Theme*:"), this), 2, 0, // lay->addWidget(new QLabel(tr("Icon Theme*:"), this), 2, 0,
// Qt::AlignRight | Qt::AlignVCenter); // Qt::AlignRight | Qt::AlignVCenter);
@ -1642,6 +1716,8 @@ QWidget* PreferencesPopup::createInterfacePage() {
ret = ret && connect(TApp::instance()->getCurrentScene(), ret = ret && connect(TApp::instance()->getCurrentScene(),
SIGNAL(pixelUnitSelected(bool)), this, SIGNAL(pixelUnitSelected(bool)), this,
SLOT(onPixelUnitExternallySelected(bool))); SLOT(onPixelUnitExternallySelected(bool)));
ret = ret && connect(additionalStyleSheetBtn, SIGNAL(clicked()), this,
SLOT(onEditAdditionalStyleSheet()));
ret = ret && connect(check30bitBtn, SIGNAL(clicked()), this, ret = ret && connect(check30bitBtn, SIGNAL(clicked()), this,
SLOT(onCheck30bitDisplay())); SLOT(onCheck30bitDisplay()));
assert(ret); assert(ret);

View file

@ -17,6 +17,7 @@
// Qt includes // Qt includes
#include <QComboBox> #include <QComboBox>
#include <QFontComboBox> #include <QFontComboBox>
#include <QTextEdit>
#include <QOpenGLWidget> #include <QOpenGLWidget>
#include <QSurfaceFormat> #include <QSurfaceFormat>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
@ -68,11 +69,13 @@ public:
private: private:
class FormatProperties; class FormatProperties;
class AdditionalStyleEdit;
class Display30bitChecker; class Display30bitChecker;
private: private:
Preferences* m_pref; Preferences* m_pref;
FormatProperties* m_formatProperties; FormatProperties* m_formatProperties;
AdditionalStyleEdit* m_additionalStyleEdit;
// DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop, // DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop,
// *m_projectRootCustom; // *m_projectRootCustom;
@ -175,6 +178,9 @@ private slots:
void onAutoSaveExternallyChanged(); void onAutoSaveExternallyChanged();
void onAutoSavePeriodExternallyChanged(); void onAutoSavePeriodExternallyChanged();
// void onProjectRootChanged(); // void onProjectRootChanged();
void onEditAdditionalStyleSheet();
void onAdditionalStyleSheetEdited();
void onPixelUnitExternallySelected(bool on); void onPixelUnitExternallySelected(bool on);
void onInterfaceFontChanged(const QString& text); void onInterfaceFontChanged(const QString& text);
void onLutPathChanged(); void onLutPathChanged();
@ -251,4 +257,27 @@ protected:
void paintGL() override; void paintGL() override;
}; };
//**********************************************************************************
// PreferencesPopup::AdditionalStyleEdit definition
//**********************************************************************************
class PreferencesPopup::AdditionalStyleEdit final : public DVGui::Dialog {
Q_OBJECT
public:
AdditionalStyleEdit(PreferencesPopup* parent);
private:
QTextEdit* m_edit;
protected:
void showEvent(QShowEvent* e) override;
private slots:
void onOK();
void onApply();
signals:
void additionalSheetEdited();
};
#endif // PREFERENCESPOPUP_H #endif // PREFERENCESPOPUP_H

View file

@ -546,6 +546,7 @@ void SceneSettingsPopup::onEditCellMarksButtonClicked() {
if (!m_cellMarksPopup) m_cellMarksPopup = new CellMarksPopup(this); if (!m_cellMarksPopup) m_cellMarksPopup = new CellMarksPopup(this);
m_cellMarksPopup->show(); m_cellMarksPopup->show();
m_cellMarksPopup->raise(); m_cellMarksPopup->raise();
m_cellMarksPopup->activateWindow();
} }
//============================================================================= //=============================================================================

View file

@ -127,6 +127,7 @@ public:
pane->getPanelType() == "Test") { pane->getPanelType() == "Test") {
pane->show(); pane->show();
pane->raise(); pane->raise();
pane->activateWindow();
return; return;
} }
} }
@ -136,6 +137,7 @@ public:
pane->setFloating(true); pane->setFloating(true);
pane->show(); pane->show();
pane->raise(); pane->raise();
pane->activateWindow();
} }
} }
} openFloatingTestPanelCommand; } openFloatingTestPanelCommand;

View file

@ -597,7 +597,6 @@
<file>Resources/iron.png</file> <file>Resources/iron.png</file>
<file>Resources/iconplay.png</file> <file>Resources/iconplay.png</file>
<file>Resources/iconpause.png</file> <file>Resources/iconpause.png</file>
<file>Resources/key.svg</file>
<file>Resources/magnet.png</file> <file>Resources/magnet.png</file>
<file>Resources/motionpath.svg</file> <file>Resources/motionpath.svg</file>
<file>Resources/motionpath_delete.svg</file> <file>Resources/motionpath_delete.svg</file>
@ -634,7 +633,6 @@
<file>Resources/schematic_spin_arrows.svg</file> <file>Resources/schematic_spin_arrows.svg</file>
<file>Resources/schematic_spline_aim_rhomb.svg</file> <file>Resources/schematic_spline_aim_rhomb.svg</file>
<file>Resources/schematic_spline_aim_square.svg</file> <file>Resources/schematic_spline_aim_square.svg</file>
<file>Resources/selected_key.svg</file>
<file>Resources/selection_add.png</file> <file>Resources/selection_add.png</file>
<file>Resources/selection_convert.png</file> <file>Resources/selection_convert.png</file>
<file>Resources/shear.png</file> <file>Resources/shear.png</file>

View file

@ -652,6 +652,7 @@ void VersionControl::commit(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -665,6 +666,7 @@ void VersionControl::revert(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -680,6 +682,7 @@ void VersionControl::update(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -693,6 +696,7 @@ void VersionControl::updateAndLock(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -705,6 +709,7 @@ void VersionControl::lock(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -718,6 +723,7 @@ void VersionControl::unlock(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -730,6 +736,7 @@ void VersionControl::lockFrameRange(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -742,6 +749,7 @@ void VersionControl::lockFrameRange(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -755,6 +763,7 @@ void VersionControl::unlockFrameRange(QWidget *parent,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -768,6 +777,7 @@ void VersionControl::unlockFrameRange(QWidget *parent,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -779,6 +789,7 @@ void VersionControl::showFrameRangeLockInfo(QWidget *parent,
new SVNFrameRangeLockInfoDialog(parent, workingDir, file); new SVNFrameRangeLockInfoDialog(parent, workingDir, file);
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -790,6 +801,7 @@ void VersionControl::showFrameRangeLockInfo(QWidget *parent,
new SVNMultiFrameRangeLockInfoDialog(parent, workingDir, files); new SVNMultiFrameRangeLockInfoDialog(parent, workingDir, files);
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -803,6 +815,7 @@ void VersionControl::commitFrameRange(QWidget *parent,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -817,6 +830,7 @@ void VersionControl::revertFrameRange(QWidget *parent,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -830,6 +844,7 @@ void VersionControl::deleteFiles(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -842,6 +857,7 @@ void VersionControl::deleteFolder(QWidget *parent, const QString &workingDir,
SIGNAL(commandDone(const QStringList &))); SIGNAL(commandDone(const QStringList &)));
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -850,6 +866,7 @@ void VersionControl::cleanupFolder(QWidget *parent, const QString &workingDir) {
SVNCleanupDialog *dialog = new SVNCleanupDialog(parent, workingDir); SVNCleanupDialog *dialog = new SVNCleanupDialog(parent, workingDir);
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -858,6 +875,7 @@ void VersionControl::purgeFolder(QWidget *parent, const QString &workingDir) {
SVNPurgeDialog *dialog = new SVNPurgeDialog(parent, workingDir); SVNPurgeDialog *dialog = new SVNPurgeDialog(parent, workingDir);
dialog->show(); dialog->show();
dialog->raise(); dialog->raise();
dialog->activateWindow();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -1898,16 +1898,17 @@ void CellArea::drawFrameMarker(QPainter &p, const QPoint &xy, QColor color,
->rect(PredefinedRect::FRAME_MARKER_AREA) ->rect(PredefinedRect::FRAME_MARKER_AREA)
.translated(xy) .translated(xy)
.translated(-frameAdj / 2); .translated(-frameAdj / 2);
bool useSmall =
m_viewer->getFrameZoomFactor() <=
m_viewer->orientation()->dimension(PredefinedDimension::SCALE_THRESHOLD);
if (isKeyFrame) { if (isKeyFrame) {
if (isCamera && !m_viewer->orientation()->isVerticalTimeline() && if (isCamera && !m_viewer->orientation()->isVerticalTimeline())
m_viewer->getFrameZoomFactor() <=
m_viewer->orientation()->dimension(
PredefinedDimension::SCALE_THRESHOLD))
dotRect.adjust(0, -3, 0, -3); dotRect.adjust(0, -3, 0, -3);
PredefinedPath diamondPath = PredefinedPath diamondPath =
keyHighlight ? PredefinedPath::FRAME_MARKER_DIAMOND_LARGE keyHighlight ? PredefinedPath::FRAME_MARKER_DIAMOND_LARGE
: PredefinedPath::FRAME_MARKER_DIAMOND; : useSmall ? PredefinedPath::FRAME_MARKER_DIAMOND_SMALL
: PredefinedPath::FRAME_MARKER_DIAMOND;
m_viewer->drawPredefinedPath(p, diamondPath, m_viewer->drawPredefinedPath(p, diamondPath,
dotRect.adjusted(1, 1, 1, 1).center(), color, dotRect.adjusted(1, 1, 1, 1).center(), color,
outlineColor); outlineColor);
@ -3068,8 +3069,6 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) {
c0 = visible.from().layer(); c0 = visible.from().layer();
c1 = visible.to().layer(); c1 = visible.to().layer();
static QPixmap selectedKey = svgToPixmap(":Resources/selected_key.svg");
static QPixmap key = svgToPixmap(":Resources/key.svg");
QPoint frameAdj = m_viewer->getFrameZoomAdjustment(); QPoint frameAdj = m_viewer->getFrameZoomAdjustment();
const QRect &keyRect = const QRect &keyRect =
o->rect(PredefinedRect::KEY_ICON).translated(-frameAdj / 2); o->rect(PredefinedRect::KEY_ICON).translated(-frameAdj / 2);
@ -3150,46 +3149,27 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) {
if (pegbar->isKeyframe(row)) { if (pegbar->isKeyframe(row)) {
QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
QPoint target = tmpKeyRect.translated(xy).topLeft(); QPoint target = tmpKeyRect.translated(xy).topLeft();
QColor color = Qt::white;
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col))
color = QColor(85, 157, 255);
int x = xy.x();
int y = xy.y();
if (m_viewer->getFrameZoomFactor() <= if (m_viewer->getFrameZoomFactor() <=
o->dimension(PredefinedDimension::SCALE_THRESHOLD)) { o->dimension(PredefinedDimension::SCALE_THRESHOLD)) {
QColor color = Qt::white;
int x = xy.x();
int y = xy.y();
if (row == 0) { if (row == 0) {
if (o->isVerticalTimeline()) if (o->isVerticalTimeline())
xy.setY(xy.y() + 1); xy.setY(xy.y() + 1);
else else
xy.setX(xy.x() + 1); xy.setX(xy.x() + 1);
} }
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col))
color = QColor(85, 157, 255);
drawFrameMarker(p, QPoint(x, y), color, true, (col < 0),
(m_keyHighlight == QPoint(row, col)));
} else {
QPixmap keyPM;
if (o->isVerticalTimeline())
target = QPoint(target.x() - 2, target.y() + 2);
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col)) {
// keyframe selected
keyPM = selectedKey;
} else {
// keyframe not selected
keyPM = key;
}
if (m_keyHighlight == QPoint(row, col)) {
keyPM = keyPM.scaled(keyPM.width() + 10, keyPM.height() + 10);
target.setX(target.x() - 3);
target.setY(target.y() - 3);
}
p.drawPixmap(target, keyPM);
} }
drawFrameMarker(p, QPoint(x, y), color, true, (col < 0),
(m_keyHighlight == QPoint(row, col)));
} }
} }

View file

@ -81,6 +81,12 @@ void getRange(ToonzScene *scene, bool isPreview, int &from, int &to) {
int r0, r1; int r0, r1;
xs->getCellRange(k, r0, r1); xs->getCellRange(k, r0, r1);
// Sound columns should be based on frame 0 for timing purposes
TXshColumn *col = xs->getColumn(k);
TXshSoundColumn *sndCol = col ? col->getSoundColumn() : 0;
if (sndCol) r0 = 0;
from = std::min(from, r0), to = std::max(to, r1); from = std::min(from, r0), to = std::max(to, r1);
} }
} }

View file

@ -16,8 +16,9 @@ const int PLAY_MARKER_SIZE = 10;
const int PINNED_SIZE = 11; const int PINNED_SIZE = 11;
const int NAV_TAG_WIDTH = 7; const int NAV_TAG_WIDTH = 7;
const int NAV_TAG_HEIGHT = 13; const int NAV_TAG_HEIGHT = 13;
const int FRAME_MARKER_SIZE = 4; const int FRAME_MARKER_SIZE_SMALL = 4;
const int FRAME_MARKER_SIZE_LARGE = FRAME_MARKER_SIZE + 2; const int FRAME_MARKER_SIZE = FRAME_MARKER_SIZE_SMALL + 1;
const int FRAME_MARKER_SIZE_LARGE = FRAME_MARKER_SIZE_SMALL + 2;
const int FOLDED_CELL_SIZE = 9; const int FOLDED_CELL_SIZE = 9;
const int SHIFTTRACE_DOT_SIZE = 12; const int SHIFTTRACE_DOT_SIZE = 12;
@ -943,6 +944,13 @@ TopToBottomOrientation::TopToBottomOrientation() {
corner.lineTo(QPointF(0, CELL_HEIGHT)); corner.lineTo(QPointF(0, CELL_HEIGHT));
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner); addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
QPainterPath diamondSmall(QPointF(0, -FRAME_MARKER_SIZE_SMALL));
diamondSmall.lineTo(FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, FRAME_MARKER_SIZE_SMALL);
diamondSmall.lineTo(-FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, -FRAME_MARKER_SIZE_SMALL);
addPath(PredefinedPath::FRAME_MARKER_DIAMOND_SMALL, diamondSmall);
QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE)); QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE));
diamond.lineTo(FRAME_MARKER_SIZE, 0); diamond.lineTo(FRAME_MARKER_SIZE, 0);
diamond.lineTo(0, FRAME_MARKER_SIZE); diamond.lineTo(0, FRAME_MARKER_SIZE);
@ -1407,6 +1415,13 @@ LeftToRightOrientation::LeftToRightOrientation() {
corner.lineTo(QPointF(CELL_WIDTH, 0)); corner.lineTo(QPointF(CELL_WIDTH, 0));
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner); addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
QPainterPath diamondSmall(QPointF(0, -FRAME_MARKER_SIZE_SMALL));
diamondSmall.lineTo(FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, FRAME_MARKER_SIZE_SMALL);
diamondSmall.lineTo(-FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, -FRAME_MARKER_SIZE_SMALL);
addPath(PredefinedPath::FRAME_MARKER_DIAMOND_SMALL, diamondSmall);
QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE)); QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE));
diamond.lineTo(FRAME_MARKER_SIZE, 0); diamond.lineTo(FRAME_MARKER_SIZE, 0);
diamond.lineTo(0, FRAME_MARKER_SIZE); diamond.lineTo(0, FRAME_MARKER_SIZE);

View file

@ -25,6 +25,7 @@
#include <QStringList> #include <QStringList>
#include <QAction> #include <QAction>
#include <QColor> #include <QColor>
#include <QTextStream>
#include <QStandardPaths> #include <QStandardPaths>
// boost includes // boost includes
@ -401,6 +402,7 @@ void Preferences::definePreferenceItems() {
// Interface // Interface
define(CurrentStyleSheetName, "CurrentStyleSheetName", QMetaType::QString, define(CurrentStyleSheetName, "CurrentStyleSheetName", QMetaType::QString,
"Dark"); "Dark");
define(additionalStyleSheet, "additionalStyleSheet", QMetaType::QString, "");
define(iconTheme, "iconTheme", QMetaType::Bool, false); define(iconTheme, "iconTheme", QMetaType::Bool, false);
define(pixelsOnly, "pixelsOnly", QMetaType::Bool, true); define(pixelsOnly, "pixelsOnly", QMetaType::Bool, true);
define(oldUnits, "oldUnits", QMetaType::QString, "mm"); define(oldUnits, "oldUnits", QMetaType::QString, "mm");
@ -993,13 +995,61 @@ QString Preferences::getCurrentLanguage() const {
//----------------------------------------------------------------- //-----------------------------------------------------------------
QString Preferences::getCurrentStyleSheetPath() const { QString Preferences::getCurrentStyleSheet() const {
QString currentStyleSheetName = getStringValue(CurrentStyleSheetName); QString currentStyleSheetName = getStringValue(CurrentStyleSheetName);
if (currentStyleSheetName.isEmpty()) return QString(); if (currentStyleSheetName.isEmpty()) return QString();
TFilePath path(TEnv::getConfigDir() + "qss"); TFilePath path(TEnv::getConfigDir() + "qss");
QString string = currentStyleSheetName + QString("/") + QString string = currentStyleSheetName + QString("/") +
currentStyleSheetName + QString(".qss"); currentStyleSheetName + QString(".qss");
return QString("file:///" + path.getQString() + "/" + string); QString styleSheetPath = path.getQString() + "/" + string;
// Set base stylesheet settings. This is used to correct QT styling
// issues between different versions/OSes. Stylesheets and Additional
// stylesheets can override these settings.
QString baseSheetStr = "";
// Qt has a bug in recent versions that Menu item Does not show correctly
// (QTBUG-90242) Since the current OT is made to handle such issue, so we need
// to apply an extra adjustment when it is run on the older versions (5.9.x)
// of Qt
// Update: confirmed that the bug does not appear at least in Qt 5.12.8
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 9)
baseSheetStr += "QMenu::Item{ padding: 3 28 3 28; }";
#else
baseSheetStr += "QMenu::Item{ padding: 3 28 3 8; }";
#endif
// Linux system font size appears a lot smaller than it should be despite
// setting QApplication's setPixelSize = 12 in main.cpp. We'll correct it using
// the additional stylesheet.
#if defined(LINUX) || defined(FREEBSD)
baseSheetStr += "QWidget{ font: 12px; }QToolTip{ font: 12px; }";
#endif
QString styleSheetStr = baseSheetStr;
// Load style sheet from the file and add to base style sheet
QFile f(styleSheetPath);
if (f.open(QFile::ReadOnly | QFile::Text)) {
QTextStream ts(&f);
styleSheetStr += ts.readAll();
}
// If there is any additional style sheet, append to loaded stylesheet
styleSheetStr += getStringValue(additionalStyleSheet);
// here we will convert all relative paths to absolute paths
// or Qt will look for images relative to the current working directory
// since it has no idea where the style sheet comes from.
QString currentStyleFolderPath =
path.getQString().replace("\\", "/") + "/" + currentStyleSheetName;
styleSheetStr.replace(QRegExp("url\\(['\"]([^'\"]+)['\"]\\)"),
"url(\"" + currentStyleFolderPath + QString("/\\1\")"));
return styleSheetStr;
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------