├── .gitignore
├── CbersApp.pro
├── CbersApp
├── CbersApp.ico
├── CbersApp.pro
├── CbersApp.qrc
├── CbersApp_win32.rc
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── pluginmanager.cpp
├── pluginmanager.h
├── ribbonpluginmanager.cpp
└── ribbonpluginmanager.h
├── CbersPluginCore
├── CbersPluginCore.pro
├── UICore.cpp
├── UICore.h
├── UIPlugins.h
├── UIPluginsEvents.h
├── cbersplugincore_global.h
├── module.cpp
└── pluginconfig.pri
├── CbersUI
├── CbersUI.pro
├── Resource
│ ├── office2007_black
│ │ ├── AppCaption
│ │ │ ├── Btn_HideElements.png
│ │ │ ├── Btn_ShowElements.png
│ │ │ ├── SysBtn_Close.png
│ │ │ ├── SysBtn_Maximize.png
│ │ │ ├── SysBtn_Minimize.png
│ │ │ └── SysBtn_Restore.png
│ │ ├── Black
│ │ │ ├── caret-down_ffffff_14.png
│ │ │ ├── caret-right_ffffff_14.png
│ │ │ ├── check.png
│ │ │ ├── cross.svg
│ │ │ ├── down_arrow.png
│ │ │ ├── eye-blocked.svg
│ │ │ ├── eye.svg
│ │ │ └── up_arrow.png
│ │ └── office2007_black.qss
│ └── office2007_blue
│ │ ├── AppCaption
│ │ ├── Btn_HideElements.png
│ │ ├── Btn_ShowElements.png
│ │ ├── SysBtn_Close.png
│ │ ├── SysBtn_Maximize.png
│ │ ├── SysBtn_Minimize.png
│ │ └── SysBtn_Restore.png
│ │ └── office2007_blue.qss
├── cbersui.qrc
├── cbersui_global.h
├── qribbonbar.cpp
├── qribbonbar.h
├── qribboncategory.cpp
├── qribboncategory.h
├── qribbonpanel.cpp
├── qribbonpanel.h
├── qribbonstylesheetmanager.cpp
├── qribbonstylesheetmanager.h
├── qribbontabwidget.cpp
├── qribbontabwidget.h
├── qseparator.cpp
├── qseparator.h
├── qtitlewidget.cpp
└── qtitlewidget.h
├── LICENSE
├── README.md
├── plugins
├── PluginDemo
│ ├── CommandPlugin.png
│ ├── DockWidgetPlugin.png
│ ├── PluginDemo.pro
│ ├── ToolPlugin.png
│ ├── ViewPlugin.png
│ ├── commandplugin.cpp
│ ├── commandplugin.h
│ ├── dockwidgetplugin.cpp
│ ├── dockwidgetplugin.h
│ ├── module.cpp
│ ├── toolplugin.cpp
│ ├── toolplugin.h
│ ├── viewplugin.cpp
│ └── viewplugin.h
└── plugins.pro
├── x3py
├── interface
│ └── core
│ │ ├── iobject.h
│ │ ├── manager
│ │ ├── iplugins.h
│ │ ├── iworkpath.h
│ │ └── x3manager.h
│ │ ├── module
│ │ ├── classentry.h
│ │ ├── classmacro.h
│ │ ├── moduleitem.h
│ │ ├── modulemacro.h
│ │ ├── normalobject.h
│ │ ├── pluginimpl.h
│ │ ├── plugininc.h
│ │ └── singletonobj.h
│ │ ├── nonplugin
│ │ ├── scanplugins.h
│ │ ├── swigext.h
│ │ ├── useplugin.h
│ │ └── useplugins.h
│ │ ├── objptr.h
│ │ ├── observer
│ │ ├── eventobserver.h
│ │ ├── fireevent.h
│ │ ├── fireeventex.h
│ │ ├── fireobjevent.h
│ │ ├── fireobjeventex.h
│ │ ├── observerimpl.h
│ │ └── observerobject.h
│ │ ├── portability
│ │ ├── func_s.h
│ │ ├── pathstr.h
│ │ ├── portimpl.h
│ │ ├── uniximpl.h
│ │ ├── winimpl.h
│ │ ├── x3port.h
│ │ ├── x3unix.h
│ │ └── x3win.h
│ │ └── utilfunc
│ │ ├── convstr.h
│ │ ├── loadmodule.h
│ │ ├── lockcount.h
│ │ ├── lockrw.h
│ │ ├── readints.h
│ │ ├── roundstr.h
│ │ ├── safecall.h
│ │ ├── scanfiles.h
│ │ ├── syserrstr.h
│ │ └── vecfunc.h
├── source
│ ├── Makefile
│ ├── core
│ │ ├── Makefile
│ │ └── x3manager
│ │ │ ├── Makefile
│ │ │ ├── module.cpp
│ │ │ ├── plugins.cpp
│ │ │ ├── plugins.h
│ │ │ ├── swig
│ │ │ ├── Makefile
│ │ │ ├── testx3manager.py
│ │ │ └── x3manager.i
│ │ │ ├── workpath.cpp
│ │ │ └── workpath.h
│ └── public
│ │ ├── mk
│ │ ├── Makefile.libp
│ │ ├── Makefile.pln
│ │ └── Makefile.qt4
│ │ └── swig
│ │ ├── Makefile.plswig
│ │ ├── Makefile.swig
│ │ ├── observer.i
│ │ └── plugin.i
└── x3py.pro
└── 插件模板
└── qtcreator
└── share
└── qtcreator
└── templates
└── wizards
├── CbersPlugin
├── lib.png
├── lib@2x.png
├── module.cpp
├── project.pro
└── wizard.json
└── classes
└── CbersPluginClass
├── file.cpp
├── file.h
├── file.png
└── wizard.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 | *.smod
19 |
20 | # Compiled Static libraries
21 | *.lai
22 | *.la
23 | *.a
24 | *.lib
25 |
26 | # Executables
27 | *.exe
28 | *.out
29 | *.app
30 |
--------------------------------------------------------------------------------
/CbersApp.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | SUBDIRS = CbersUI x3py CbersPluginCore CbersApp plugins
3 | CbersApp.depends = CbersUI CbersPluginCore plugins
4 | CbersPluginCore.depends = x3py
5 | plugins.depends = CbersPluginCore
6 |
--------------------------------------------------------------------------------
/CbersApp/CbersApp.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/longhuan2018/CbersUI/85bfe9f16e0ff17361875461818006efc51d8d28/CbersApp/CbersApp.ico
--------------------------------------------------------------------------------
/CbersApp/CbersApp.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2016-09-08T16:10:14
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui opengl xml
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10 |
11 | CONFIG += c++11
12 |
13 | TARGET = CbersApp
14 | TEMPLATE = app
15 |
16 | {
17 | CONFIG(debug, debug|release){
18 | TARGET = $$join(TARGET,,,d)
19 |
20 | DESTDIR = $$PWD/../bin/debug
21 | }
22 | else{
23 | DESTDIR = $$PWD/../bin/release
24 | }
25 | }
26 |
27 |
28 | SOURCES += main.cpp\
29 | mainwindow.cpp \
30 | pluginmanager.cpp \
31 | ribbonpluginmanager.cpp
32 |
33 | HEADERS += mainwindow.h \
34 | pluginmanager.h \
35 | ribbonpluginmanager.h
36 |
37 | FORMS += mainwindow.ui
38 |
39 |
40 | CONFIG(release, debug|release): LIBS += -L$$PWD/../lib/release/ -lCbersUI
41 | else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../lib/debug/ -lCbersUId
42 |
43 | unix{
44 | LIBS += -ldl
45 | }
46 |
47 | INCLUDEPATH += $$PWD/../include
48 | INCLUDEPATH += $$PWD/../include/CbersUI
49 | INCLUDEPATH += $$PWD/../include/x3py
50 | INCLUDEPATH += $$PWD/../include/PluginCore
51 | DEPENDPATH += $$PWD/../include
52 | DEPENDPATH += $$PWD/../include/CbersUI
53 | DEPENDPATH += $$PWD/../include/x3py
54 | DEPENDPATH += $$PWD/../include/PluginCore
55 |
56 | win32{
57 | LIBS += -lDbghelp
58 | }
59 |
60 | SDK_PATH = $$PWD/../
61 |
62 | win32{
63 | RC_FILE= CbersApp_win32.rc
64 | }
65 |
66 | RESOURCES += \
67 | CbersApp.qrc
68 |
69 | TRANSLATION_DIR = $$PWD/../i18n/
70 | TRANSLATIONS = $$TRANSLATION_DIR/CbersApp_zh_CN.ts
71 |
72 | # Copies the given files to the destination directory
73 | defineReplace(copyToDir) {
74 | files = $$1
75 | DIR = $$2
76 | SRCDIR = $$3
77 | LINK =
78 |
79 | win32:DIR ~= s,/,\\,g
80 | win32{
81 | LINK += if not exist $$quote($$DIR) ( $$QMAKE_MKDIR $$quote($$DIR) ) $$escape_expand(\\n\\t)
82 | }
83 | unix{
84 | LINK += $$QMAKE_MKDIR $$quote($$DIR) $$escape_expand(\\n\\t)
85 | }
86 | for(FILE, files) {
87 | !isEmpty(SRCDIR){
88 | FILE = $$SRCDIR/$$FILE
89 | }
90 | win32:FILE ~= s,/,\\,g
91 | LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DIR) $$escape_expand(\\n\\t)
92 | }
93 | return($$LINK)
94 | }
95 |
96 | win32{
97 | QMAKE_POST_LINK += cd $$quote($$PWD) $$escape_expand(\\n\\t)
98 | }
99 | unix{
100 | QMAKE_POST_LINK += cd $$quote($$PWD) $$escape_expand(\\n\\t)
101 | }
102 |
103 | # Auto Update And Release TRANSLATIONS
104 | win32:TRANSLATION_DIR ~= s,/,\\,g
105 | win32{
106 | QMAKE_POST_LINK += if not exist $$quote($$TRANSLATION_DIR) ( $$QMAKE_MKDIR $$quote($$TRANSLATION_DIR) ) $$escape_expand(\\n\\t)
107 | }
108 | unix{
109 | QMAKE_POST_LINK += $$QMAKE_MKDIR -p $$quote($$TRANSLATION_DIR) $$escape_expand(\\n\\t)
110 | }
111 |
112 | QMAKE_POST_LINK += $(QTDIR)/bin/lupdate $$PWD/CbersApp.pro $$escape_expand(\\n\\t)
113 | QMAKE_POST_LINK += $(QTDIR)/bin/lrelease $$PWD/CbersApp.pro $$escape_expand(\\n\\t)
114 | RELEASE_TRANSLATIONS = $$TRANSLATIONS
115 | RELEASE_TRANSLATIONS ~= s,.ts,.qm,g
116 | QMAKE_POST_LINK += $$copyToDir($$RELEASE_TRANSLATIONS, $$DESTDIR/i18n/)
117 |
--------------------------------------------------------------------------------
/CbersApp/CbersApp.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | CbersApp.ico
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CbersApp/CbersApp_win32.rc:
--------------------------------------------------------------------------------
1 | #include "winver.h"
2 |
3 | IDI_ICON1 ICON "CbersApp.ico"
4 |
5 | VS_VERSION_INFO VERSIONINFO
6 | FILEVERSION 1,0,0,1
7 | PRODUCTVERSION 1,0,0,1
8 | FILEFLAGSMASK 0x3fL
9 | #ifdef _DEBUG
10 | FILEFLAGS 0x1L
11 | #else
12 | FILEFLAGS 0x0L
13 | #endif
14 | FILEOS 0x40004L
15 | FILETYPE 0x0L
16 | FILESUBTYPE 0x0L
17 | BEGIN
18 | BLOCK "StringFileInfo"
19 | BEGIN
20 | BLOCK "080404b0"
21 | BEGIN
22 | VALUE "CompanyName", "CbersApp"
23 | VALUE "FileDescription", "CbersApp"
24 | VALUE "FileVersion", "1.0.0.1"
25 | VALUE "InternalName", "CbersApp.exe"
26 | VALUE "LegalCopyright", "Copyright (C) 2018"
27 | VALUE "OriginalFilename", "CbersApp.exe"
28 | VALUE "ProductName", "CbersApp"
29 | VALUE "ProductVersion", "1.0.0.1"
30 | END
31 | END
32 | BLOCK "VarFileInfo"
33 | BEGIN
34 | VALUE "Translation", 0x804, 1200
35 | END
36 | END
--------------------------------------------------------------------------------
/CbersApp/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "mainwindow.h"
9 | #include "pluginmanager.h"
10 | #include "x3py/observer/observerimpl.h"
11 |
12 | int main(int argc, char *argv[])
13 | {
14 | QString configpath = QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath() + "/config";
15 | QSettings::setDefaultFormat( QSettings::IniFormat );
16 | QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath);
17 |
18 | QApplication a(argc, argv);
19 | a.setWindowIcon(QIcon(":/CbersApp.ico"));
20 |
21 | QCoreApplication::setOrganizationName( QObject::tr("CbersApp") );
22 | QCoreApplication::setOrganizationDomain( QObject::tr("CbersApp") );
23 | QCoreApplication::setApplicationName( QObject::tr("CbersApp") );
24 | QCoreApplication::setAttribute( Qt::AA_DontShowIconsInMenus, false );
25 |
26 | QSettings mySettings;
27 | //////////////////////////////////////////////////////////////
28 | // Load Translator
29 | QString i18nPath = QApplication::applicationDirPath() + "/i18n";
30 | QString myUserLocale = mySettings.value( "locale/userLocale", "" ).toString();
31 | bool myLocaleOverrideFlag = mySettings.value( "locale/overrideFlag", false ).toBool();
32 | QString myTranslationCode;
33 | if ( !myTranslationCode.isNull() && !myTranslationCode.isEmpty() )
34 | {
35 | mySettings.setValue( "locale/userLocale", myTranslationCode );
36 | }
37 | else
38 | {
39 | if ( !myLocaleOverrideFlag || myUserLocale.isEmpty() )
40 | {
41 | myTranslationCode = QLocale::system().name();
42 | mySettings.setValue( "locale/userLocale", myTranslationCode );
43 | }
44 | else
45 | {
46 | myTranslationCode = myUserLocale;
47 | }
48 | }
49 |
50 | QTranslator apptor( 0 );
51 | QTranslator cbersUItor( 0 );
52 | QTranslator qttor( 0 );
53 | if ( myTranslationCode != "C" )
54 | {
55 | if ( apptor.load( QString( "CbersApp_" ) + myTranslationCode, i18nPath ) )
56 | {
57 | a.installTranslator( &apptor );
58 | }
59 | else
60 | {
61 | qWarning( "loading of CbersApp translation failed [%s]", QString( "%1/CbersApp_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() );
62 | }
63 |
64 | if ( cbersUItor.load( QString( "CbersUI_" ) + myTranslationCode, i18nPath ) )
65 | {
66 | a.installTranslator( &cbersUItor );
67 | }
68 | else
69 | {
70 | qWarning( "loading of CbersUI translation failed [%s]", QString( "%1/CbersUI_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() );
71 | }
72 |
73 | if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) )
74 | {
75 | a.installTranslator( &qttor );
76 | }
77 | else
78 | {
79 | qWarning( "loading of qt translation failed [%s]", QString( "%1_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() );
80 | }
81 | }
82 | //////////////////////////////////////////////////////////////
83 |
84 | if( !CPluginManager::Initialize("CbersPlugins") )
85 | return -1;
86 |
87 | MainWindow w;
88 | w.showMaximized();
89 |
90 | return a.exec();
91 | }
92 |
--------------------------------------------------------------------------------
/CbersApp/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "ui_mainwindow.h"
3 | #include
4 | #include
5 | #include "ribbonpluginmanager.h"
6 | #include "qribbonstylesheetmanager.h"
7 |
8 | MainWindow::MainWindow(QWidget *parent) :
9 | QMainWindow(parent),
10 | ui(new Ui::MainWindow)
11 | {
12 | setObjectName("QRibbonMainWindow");
13 | setWindowFlags( Qt::FramelessWindowHint );
14 | ui->setupUi(this);
15 |
16 | mRibbonBar = new QRibbonBar(this->centralWidget());
17 |
18 | mMdiArea = new QMdiArea(this->centralWidget());
19 | //mMdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation);
20 | mMdiArea->setViewMode(QMdiArea::SubWindowView);
21 | //mMdiArea->setViewMode(QMdiArea::TabbedView);
22 | mMdiArea->setTabShape(QTabWidget::Rounded);
23 | mMdiArea->setTabPosition(QTabWidget::North);
24 | connect(mMdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow *)));
25 |
26 | CRibbonPluginManager::getInstance()->Create(this, mRibbonBar, mMdiArea);
27 | setMenuWidget(mRibbonBar);
28 | setCentralWidget(mMdiArea);
29 |
30 | QRibbonStyleSheetManager::instance()->applyStyleSheet("office2007_black");
31 | //registerHandlers();
32 | }
33 |
34 | MainWindow::~MainWindow()
35 | {
36 | CRibbonPluginManager::getInstance()->DestroyControl();
37 |
38 | if( mRibbonBar!=nullptr )
39 | delete mRibbonBar;
40 | mRibbonBar = nullptr;
41 |
42 | delete ui;
43 | }
44 |
45 | bool MainWindow::OnAnything(x3::IObject* sender, const std::string& eventKey, const QVariant& wParam, const QVariant& lParam)
46 | {
47 | //if( _stricmp(eventKey.c_str(), "scaleChanged")==0 )
48 | //{
49 | //}
50 | return true;
51 | }
52 |
53 | void MainWindow::subWindowActivated(QMdiSubWindow* pSubWindow)
54 | {
55 | if( pSubWindow==Q_NULLPTR )
56 | return;
57 |
58 | QVariant vtData = pSubWindow->property("IUIPlugin");
59 | if( !vtData.isValid() )
60 | return;
61 |
62 | x3::Object spCommon((IUIPlugin*)(vtData.toLongLong()));
63 | if( !spCommon.valid() )
64 | return;
65 |
66 | CRibbonPluginManager::getInstance()->SetViewer(spCommon.p());
67 | }
68 |
--------------------------------------------------------------------------------
/CbersApp/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include "qribbonbar.h"
14 | USING_NAMESPACE_CBERSUI
15 |
16 | #include "UIPluginsEvents.h"
17 | USING_NAMESPACE_CBERSPLUGINS
18 |
19 | namespace Ui {
20 | class MainWindow;
21 | }
22 |
23 | class MainWindow : public QMainWindow, public IAnythingEventObserver
24 | {
25 | Q_OBJECT
26 |
27 | public:
28 | explicit MainWindow(QWidget *parent = 0);
29 | ~MainWindow();
30 |
31 | public:
32 | // IAnythingEventObserver
33 | virtual bool OnAnything(x3::IObject* sender, const std::string& eventKey, const QVariant& wParam, const QVariant& lParam);
34 |
35 | protected slots:
36 | void subWindowActivated(QMdiSubWindow *);
37 |
38 | private:
39 | Ui::MainWindow *ui;
40 | QRibbonBar* mRibbonBar;
41 | QMdiArea* mMdiArea;
42 | };
43 |
44 | #endif // MAINWINDOW_H
45 |
--------------------------------------------------------------------------------
/CbersApp/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/CbersApp/pluginmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef CPLUGINMANAGER_H
2 | #define CPLUGINMANAGER_H
3 | #include "x3py/module/plugininc.h"
4 | #include "x3py/objptr.h"
5 | #include "x3py/utilfunc/lockrw.h"
6 | #include "UIPlugins.h"
7 | USING_NAMESPACE_CBERSPLUGINS
8 |
9 | #include