-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
longhuan
committed
Oct 10, 2018
1 parent
623277e
commit ed0f59c
Showing
146 changed files
with
10,946 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS = CbersUI x3py CbersPluginCore CbersApp plugins | ||
CbersApp.depends = CbersUI CbersPluginCore plugins | ||
CbersPluginCore.depends = x3py | ||
plugins.depends = CbersPluginCore |
Binary file not shown.
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,116 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2016-09-08T16:10:14 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui opengl xml | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
CONFIG += c++11 | ||
|
||
TARGET = CbersApp | ||
TEMPLATE = app | ||
|
||
{ | ||
CONFIG(debug, debug|release){ | ||
TARGET = $$join(TARGET,,,d) | ||
|
||
DESTDIR = $$PWD/../bin/debug | ||
} | ||
else{ | ||
DESTDIR = $$PWD/../bin/release | ||
} | ||
} | ||
|
||
|
||
SOURCES += main.cpp\ | ||
mainwindow.cpp \ | ||
pluginmanager.cpp \ | ||
ribbonpluginmanager.cpp | ||
|
||
HEADERS += mainwindow.h \ | ||
pluginmanager.h \ | ||
ribbonpluginmanager.h | ||
|
||
FORMS += mainwindow.ui | ||
|
||
|
||
CONFIG(release, debug|release): LIBS += -L$$PWD/../lib/release/ -lCbersUI | ||
else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../lib/debug/ -lCbersUId | ||
|
||
unix{ | ||
LIBS += -ldl | ||
} | ||
|
||
INCLUDEPATH += $$PWD/../include | ||
INCLUDEPATH += $$PWD/../include/CbersUI | ||
INCLUDEPATH += $$PWD/../include/x3py | ||
INCLUDEPATH += $$PWD/../include/PluginCore | ||
DEPENDPATH += $$PWD/../include | ||
DEPENDPATH += $$PWD/../include/CbersUI | ||
DEPENDPATH += $$PWD/../include/x3py | ||
DEPENDPATH += $$PWD/../include/PluginCore | ||
|
||
win32{ | ||
LIBS += -lDbghelp | ||
} | ||
|
||
SDK_PATH = $$PWD/../ | ||
|
||
win32{ | ||
RC_FILE= CbersApp_win32.rc | ||
} | ||
|
||
RESOURCES += \ | ||
CbersApp.qrc | ||
|
||
TRANSLATION_DIR = $$PWD/../i18n/ | ||
TRANSLATIONS = $$TRANSLATION_DIR/CbersApp_zh_CN.ts | ||
|
||
# Copies the given files to the destination directory | ||
defineReplace(copyToDir) { | ||
files = $$1 | ||
DIR = $$2 | ||
SRCDIR = $$3 | ||
LINK = | ||
|
||
win32:DIR ~= s,/,\\,g | ||
win32{ | ||
LINK += if not exist $$quote($$DIR) ( $$QMAKE_MKDIR $$quote($$DIR) ) $$escape_expand(\\n\\t) | ||
} | ||
unix{ | ||
LINK += $$QMAKE_MKDIR $$quote($$DIR) $$escape_expand(\\n\\t) | ||
} | ||
for(FILE, files) { | ||
!isEmpty(SRCDIR){ | ||
FILE = $$SRCDIR/$$FILE | ||
} | ||
win32:FILE ~= s,/,\\,g | ||
LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DIR) $$escape_expand(\\n\\t) | ||
} | ||
return($$LINK) | ||
} | ||
|
||
win32{ | ||
QMAKE_POST_LINK += cd $$quote($$PWD) $$escape_expand(\\n\\t) | ||
} | ||
unix{ | ||
QMAKE_POST_LINK += cd $$quote($$PWD) $$escape_expand(\\n\\t) | ||
} | ||
|
||
# Auto Update And Release TRANSLATIONS | ||
win32:TRANSLATION_DIR ~= s,/,\\,g | ||
win32{ | ||
QMAKE_POST_LINK += if not exist $$quote($$TRANSLATION_DIR) ( $$QMAKE_MKDIR $$quote($$TRANSLATION_DIR) ) $$escape_expand(\\n\\t) | ||
} | ||
unix{ | ||
QMAKE_POST_LINK += $$QMAKE_MKDIR -p $$quote($$TRANSLATION_DIR) $$escape_expand(\\n\\t) | ||
} | ||
|
||
QMAKE_POST_LINK += $(QTDIR)/bin/lupdate $$PWD/CbersApp.pro $$escape_expand(\\n\\t) | ||
QMAKE_POST_LINK += $(QTDIR)/bin/lrelease $$PWD/CbersApp.pro $$escape_expand(\\n\\t) | ||
RELEASE_TRANSLATIONS = $$TRANSLATIONS | ||
RELEASE_TRANSLATIONS ~= s,.ts,.qm,g | ||
QMAKE_POST_LINK += $$copyToDir($$RELEASE_TRANSLATIONS, $$DESTDIR/i18n/) |
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,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>CbersApp.ico</file> | ||
</qresource> | ||
</RCC> |
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,36 @@ | ||
#include "winver.h" | ||
|
||
IDI_ICON1 ICON "CbersApp.ico" | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION 1,0,0,1 | ||
PRODUCTVERSION 1,0,0,1 | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x0L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "080404b0" | ||
BEGIN | ||
VALUE "CompanyName", "CbersApp" | ||
VALUE "FileDescription", "CbersApp" | ||
VALUE "FileVersion", "1.0.0.1" | ||
VALUE "InternalName", "CbersApp.exe" | ||
VALUE "LegalCopyright", "Copyright (C) 2018" | ||
VALUE "OriginalFilename", "CbersApp.exe" | ||
VALUE "ProductName", "CbersApp" | ||
VALUE "ProductVersion", "1.0.0.1" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x804, 1200 | ||
END | ||
END |
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,91 @@ | ||
#include <QApplication> | ||
#include <QFile> | ||
#include <QTextStream> | ||
#include <QTranslator> | ||
#include <QSettings> | ||
#include <QFileInfo> | ||
#include <QDir> | ||
#include "mainwindow.h" | ||
#include "pluginmanager.h" | ||
#include "x3py/observer/observerimpl.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QString configpath = QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath() + "/config"; | ||
QSettings::setDefaultFormat( QSettings::IniFormat ); | ||
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath); | ||
|
||
QApplication a(argc, argv); | ||
a.setWindowIcon(QIcon(":/CbersApp.ico")); | ||
|
||
QCoreApplication::setOrganizationName( QObject::tr("CbersApp") ); | ||
QCoreApplication::setOrganizationDomain( QObject::tr("CbersApp") ); | ||
QCoreApplication::setApplicationName( QObject::tr("CbersApp") ); | ||
QCoreApplication::setAttribute( Qt::AA_DontShowIconsInMenus, false ); | ||
|
||
QSettings mySettings; | ||
////////////////////////////////////////////////////////////// | ||
// Load Translator | ||
QString i18nPath = QApplication::applicationDirPath() + "/i18n"; | ||
QString myUserLocale = mySettings.value( "locale/userLocale", "" ).toString(); | ||
bool myLocaleOverrideFlag = mySettings.value( "locale/overrideFlag", false ).toBool(); | ||
QString myTranslationCode; | ||
if ( !myTranslationCode.isNull() && !myTranslationCode.isEmpty() ) | ||
{ | ||
mySettings.setValue( "locale/userLocale", myTranslationCode ); | ||
} | ||
else | ||
{ | ||
if ( !myLocaleOverrideFlag || myUserLocale.isEmpty() ) | ||
{ | ||
myTranslationCode = QLocale::system().name(); | ||
mySettings.setValue( "locale/userLocale", myTranslationCode ); | ||
} | ||
else | ||
{ | ||
myTranslationCode = myUserLocale; | ||
} | ||
} | ||
|
||
QTranslator apptor( 0 ); | ||
QTranslator cbersUItor( 0 ); | ||
QTranslator qttor( 0 ); | ||
if ( myTranslationCode != "C" ) | ||
{ | ||
if ( apptor.load( QString( "CbersApp_" ) + myTranslationCode, i18nPath ) ) | ||
{ | ||
a.installTranslator( &apptor ); | ||
} | ||
else | ||
{ | ||
qWarning( "loading of CbersApp translation failed [%s]", QString( "%1/CbersApp_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() ); | ||
} | ||
|
||
if ( cbersUItor.load( QString( "CbersUI_" ) + myTranslationCode, i18nPath ) ) | ||
{ | ||
a.installTranslator( &cbersUItor ); | ||
} | ||
else | ||
{ | ||
qWarning( "loading of CbersUI translation failed [%s]", QString( "%1/CbersUI_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() ); | ||
} | ||
|
||
if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) ) | ||
{ | ||
a.installTranslator( &qttor ); | ||
} | ||
else | ||
{ | ||
qWarning( "loading of qt translation failed [%s]", QString( "%1_%2" ).arg( i18nPath ).arg( myTranslationCode ).toLocal8Bit().constData() ); | ||
} | ||
} | ||
////////////////////////////////////////////////////////////// | ||
|
||
if( !CPluginManager::Initialize("CbersPlugins") ) | ||
return -1; | ||
|
||
MainWindow w; | ||
w.showMaximized(); | ||
|
||
return a.exec(); | ||
} |
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,67 @@ | ||
#include "mainwindow.h" | ||
#include "ui_mainwindow.h" | ||
#include <QLayout> | ||
#include <QStatusBar> | ||
#include "ribbonpluginmanager.h" | ||
#include "qribbonstylesheetmanager.h" | ||
|
||
MainWindow::MainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::MainWindow) | ||
{ | ||
setObjectName("QRibbonMainWindow"); | ||
setWindowFlags( Qt::FramelessWindowHint ); | ||
ui->setupUi(this); | ||
|
||
mRibbonBar = new QRibbonBar(this->centralWidget()); | ||
|
||
mMdiArea = new QMdiArea(this->centralWidget()); | ||
//mMdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation); | ||
mMdiArea->setViewMode(QMdiArea::SubWindowView); | ||
//mMdiArea->setViewMode(QMdiArea::TabbedView); | ||
mMdiArea->setTabShape(QTabWidget::Rounded); | ||
mMdiArea->setTabPosition(QTabWidget::North); | ||
connect(mMdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow *))); | ||
|
||
CRibbonPluginManager::getInstance()->Create(this, mRibbonBar, mMdiArea); | ||
setMenuWidget(mRibbonBar); | ||
setCentralWidget(mMdiArea); | ||
|
||
QRibbonStyleSheetManager::instance()->applyStyleSheet("office2007_black"); | ||
//registerHandlers(); | ||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
CRibbonPluginManager::getInstance()->DestroyControl(); | ||
|
||
if( mRibbonBar!=nullptr ) | ||
delete mRibbonBar; | ||
mRibbonBar = nullptr; | ||
|
||
delete ui; | ||
} | ||
|
||
bool MainWindow::OnAnything(x3::IObject* sender, const std::string& eventKey, const QVariant& wParam, const QVariant& lParam) | ||
{ | ||
//if( _stricmp(eventKey.c_str(), "scaleChanged")==0 ) | ||
//{ | ||
//} | ||
return true; | ||
} | ||
|
||
void MainWindow::subWindowActivated(QMdiSubWindow* pSubWindow) | ||
{ | ||
if( pSubWindow==Q_NULLPTR ) | ||
return; | ||
|
||
QVariant vtData = pSubWindow->property("IUIPlugin"); | ||
if( !vtData.isValid() ) | ||
return; | ||
|
||
x3::Object<IUIPlugin> spCommon((IUIPlugin*)(vtData.toLongLong())); | ||
if( !spCommon.valid() ) | ||
return; | ||
|
||
CRibbonPluginManager::getInstance()->SetViewer(spCommon.p()); | ||
} |
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,44 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
|
||
#include <QMainWindow> | ||
#include <QMdiArea> | ||
#include <QLineEdit> | ||
#include <QLabel> | ||
#include <QComboBox> | ||
#include <QProgressBar> | ||
#include <QValidator> | ||
#include <QToolButton> | ||
#include <QMdiSubWindow> | ||
#include "qribbonbar.h" | ||
USING_NAMESPACE_CBERSUI | ||
|
||
#include "UIPluginsEvents.h" | ||
USING_NAMESPACE_CBERSPLUGINS | ||
|
||
namespace Ui { | ||
class MainWindow; | ||
} | ||
|
||
class MainWindow : public QMainWindow, public IAnythingEventObserver | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = 0); | ||
~MainWindow(); | ||
|
||
public: | ||
// IAnythingEventObserver | ||
virtual bool OnAnything(x3::IObject* sender, const std::string& eventKey, const QVariant& wParam, const QVariant& lParam); | ||
|
||
protected slots: | ||
void subWindowActivated(QMdiSubWindow *); | ||
|
||
private: | ||
Ui::MainWindow *ui; | ||
QRibbonBar* mRibbonBar; | ||
QMdiArea* mMdiArea; | ||
}; | ||
|
||
#endif // MAINWINDOW_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>MainWindow</class> | ||
<widget class="QMainWindow" name="MainWindow"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralWidget"/> | ||
<widget class="QStatusBar" name="statusBar"/> | ||
</widget> | ||
<layoutdefault spacing="6" margin="11"/> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.