Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dont open elems catalog in view mode, use custom elems tool instead
- Loading branch information
Showing
9 changed files
with
102 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "CustomElemsWindow.h" | ||
|
||
#include "CustomPrefs.h" | ||
#include "helpers/OriWindows.h" | ||
|
||
#include <QIcon> | ||
|
||
namespace { | ||
|
||
CustomElemsWindow* __instance = nullptr; | ||
|
||
} // namespace | ||
|
||
void CustomElemsWindow::showWindow() | ||
{ | ||
if (!__instance) | ||
__instance = new CustomElemsWindow; | ||
__instance->show(); | ||
__instance->activateWindow(); | ||
} | ||
|
||
CustomElemsWindow::CustomElemsWindow(QWidget *parent) : QWidget(parent) | ||
{ | ||
setAttribute(Qt::WA_DeleteOnClose); | ||
setWindowTitle(tr("Custom Elements")); | ||
setWindowIcon(QIcon(":/window_icons/catalog")); | ||
|
||
restoreState(); | ||
Ori::Wnd::moveToScreenCenter(this); | ||
} | ||
|
||
CustomElemsWindow::~CustomElemsWindow() | ||
{ | ||
storeState(); | ||
__instance = nullptr; | ||
} | ||
|
||
void CustomElemsWindow::restoreState() | ||
{ | ||
QJsonObject root = CustomDataHelpers::loadCustomData("elems"); | ||
|
||
CustomDataHelpers::restoreWindowSize(root, this, 750, 400); | ||
} | ||
|
||
void CustomElemsWindow::storeState() | ||
{ | ||
QJsonObject root; | ||
root["window_width"] = width(); | ||
root["window_height"] = height(); | ||
|
||
CustomDataHelpers::saveCustomData(root, "elems"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef CUSTOM_ELEMS_WINDOW_H | ||
#define CUSTOM_ELEMS_WINDOW_H | ||
|
||
#include <QWidget> | ||
|
||
class CustomElemsWindow : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit CustomElemsWindow(QWidget *parent = nullptr); | ||
~CustomElemsWindow() override; | ||
|
||
static void showWindow(); | ||
|
||
private: | ||
void restoreState(); | ||
void storeState(); | ||
}; | ||
|
||
#endif // CUSTOM_ELEMS_WINDOW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters