本文整理汇总了C++中IApplication类的典型用法代码示例。如果您正苦于以下问题:C++ IApplication类的具体用法?C++ IApplication怎么用?C++ IApplication使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
VOID WINAPI CCommands::XApplicationEvents::ManualCallBackProc( PMANUALCALLBACK lpManuallCallBack )
{
CString strError;
switch(lpManuallCallBack->dwError)
{
case HR_ERROR_NOERROR: // 无错误发生
if (lpManuallCallBack->IsFinished != 1 ||
0 == _tcslen(lpManuallCallBack->szFileName))
{
return;
}
strError = "无错误发生";
break;
case HR_ERROR_CANTCONNECT_SERVER: // 无法连接到文件服务器
strError = "无法连接到文件服务器";
break;
case HR_ERROR_OVERLIMITSIZE: // 单个文件超过限制大小
strError = "单个文件超过限制大小";
break;
case HR_ERROR_GETSIZEFAIL: // 得到文件大小失败
strError = "得到文件大小失败";
break;
case HR_ERROR_CANTACCESS: // 文件无法访问
strError = "文件无法访问";
break;
case HR_ERROR_CANTALLOCMEMORY: // 堆分配空间错误
strError = "堆分配空间错误";
break;
}
SYSTEMTIME sysTime;
CString strTime;
GetLocalTime(&sysTime);
strTime.Format("%d/%d/%d %d:%d:%d.%d", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);
LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL);
CString strFileName;
strFileName.Format("FileName: %s\tSendSize: %d\tFinish: %d\tError: %s\tApiLastError: %s\t%s",
lpManuallCallBack->szFileName,
lpManuallCallBack->dwSendSize,
lpManuallCallBack->IsFinished,
strError,
lpMsgBuf,
strTime);
LocalFree( lpMsgBuf );
#ifdef _DEBUG
CCommands* pCommands = (CCommands*)lpManuallCallBack->dwUserData;
IApplication *pApplication = pCommands->GetApplicationObject();
CComBSTR bsFileName(strFileName);
pApplication->PrintToOutputWindow(bsFileName);
#else
OutputDebugString(strFileName);
#endif // _DEBUG
}
示例2: wxAuiToolBar
wxGISToolBar::wxGISToolBar(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& sName, const wxString& sCaption, wxGISEnumCommandBars type ) : wxAuiToolBar(parent, id, position, size, style), wxGISCommandBar(sName, sCaption, type), m_pStatusBar(NULL)
{
IApplication* pApp = dynamic_cast<IApplication*>(parent);
if(pApp)
{
m_pStatusBar = pApp->GetStatusBar();
}
}
示例3: main
int main()
{
SDeviceContextSettings settings;
settings.MultiSamplingCount = 4;
settings.MultiSamplingQuality = 32;
IApplication* device = createDevice(EDT_DIRECT3D11, 800, 600, EWS_NONE, true, settings);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->createSceneManager();
IMeshManager* meshManager = driver->getMeshManager();
IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
resourceGroupManager->init("Resources.cfg");
//resourceGroupManager->loadResourceGroup("General");
XMFLOAT3 vertices[4];
vertices[0] = XMFLOAT3(-10.0f, 0.0f, 10.0f);
vertices[1] = XMFLOAT3(10.0f, 0.0f, 10.0f);
vertices[2] = XMFLOAT3(-10.0f, 0.0f, -10.0f);
vertices[3] = XMFLOAT3(10.0f, 0.0f, -10.0f);
ISimpleMesh* mesh = meshManager->createSimpleMesh("pointlist", EVF_POSITION,
vertices, NULL, 4, sizeof(XMFLOAT3), 0, math::SAxisAlignedBox(), false);
IMeshNode* meshNode = smgr->addMeshNode(mesh, nullptr, nullptr);
meshNode->setMaterialName("test/ts_material");
meshNode->setNeedCulling(false);
ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 1.0f, -4.0f), XMFLOAT3(0, 1.0f, 0.0f));
char caption[200];
ITimer* timer = device->getTimer();
timer->reset();
while (device->run())
{
const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
driver->beginScene(true, true, clearColor);
float dt = timer->tick() * 0.001f;
updateCamera(camera, dt);
smgr->update(dt);
smgr->drawAll();
driver->endScene();
sprintf(caption, "FPS:%f", getFps(dt));
device->setWindowCaption(caption);
}
device->drop();
return 0;
}
示例4:
QJsonObject Application2Json::from(const IApplication& app)
{
QJsonObject json;
json["id"] = app.id();
json["version"] = app.meta()->version();
json["application_id"] = app.meta()->applicationId();
json["name"] = app.meta()->name();
json["description"] = app.meta()->description();
json["catalog_image"] = app.meta()->catalogImageFilePath();
json["status"] = app.stateString();
json["is_free"] = app.meta()->isFree();
return json;
}
示例5: TMyRecommendations
void
TProfile::TreeItemProfile_DisplayApplicationsWithinNavigationTree()
{
if (!m_arraypaAccountsXmpp.FIsEmpty())
new TMyRecommendations(this); // Dislay the recommendations if there is at least one account
// new TTreeItemDemo(this, "My Reputation", eMenuIconReputation, "Display my reputation according to other organizations", "Search Reputation Feedback Comments");
IApplication ** ppApplicationStop;
IApplication ** ppApplication = m_arraypaApplications.PrgpGetApplicationsStop(OUT &ppApplicationStop);
while (ppApplication != ppApplicationStop)
{
IApplication * pApplication = *ppApplication++;
pApplication->TreeItemApplication_DisplayWithinNavigationTree();
}
TBrowser ** ppBrowserStop;
TBrowser ** ppBrowser = m_arraypaBrowsers.PrgpGetBrowsersStop(OUT &ppBrowserStop);
while (ppBrowser != ppBrowserStop)
{
TBrowser * pBrowser = *ppBrowser++;
Assert(pBrowser->EGetRuntimeClass() == RTI(TBrowser));
pBrowser->TreeItemBrowser_DisplayWithinNavigationTree();
}
TBrowserTabs ** ppBrowserTabsStop;
TBrowserTabs ** ppBrowserTabs = m_arraypaBrowsersTabbed.PrgpGetBrowsersStop(&ppBrowserTabsStop);
while(ppBrowserTabs != ppBrowserTabsStop)
{
TBrowserTabs * pBrowserTabs = *ppBrowserTabs++;
Assert(pBrowserTabs->EGetRuntimeClass() == RTI(TBrowserTabs));
pBrowserTabs->TreeItemBrowser_DisplayWithinNavigationTree();
}
TreeItemW_ExpandAccordingToSavedState();
}
示例6: AFX_MANAGE_STATE
// Dieser Code wird beim ersten Laden des Add-Ins und beim Starten der Anwendung aufgerufen
// jeder nachfolgenden Developer Studio-Sitzung
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
long dwCookie, VARIANT_BOOL* OnConnection)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// An uns übergebene Info speichern
IApplication* pApplication = NULL;
if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
|| pApplication == NULL)
{
*OnConnection = VARIANT_FALSE;
return S_OK;
}
m_dwCookie = dwCookie;
// Befehlsverteilung erzeugen, Rückmeldung an DevStudio
CCommandsObj::CreateInstance(&m_pCommands);
m_pCommands->AddRef();
// Das obige QueryInterface hat AddRef auf das Objekt Application angewendet. Es
// wird im Destruktor von CCommand freigegeben.
m_pCommands->SetApplicationObject(pApplication);
// (siehe Definition von VERIFY_OK in stdafx.h)
VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));
// DevStudio über die implementierten Befehle informieren
VARIANT_BOOL bRet;
CString strCmdString;
LPCTSTR szNewQtProject = _T("New Qt Project");
strCmdString.LoadString(IDS_NEWQTPROJECT_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtProject + strCmdString), CComBSTR(_T("QMsDevNewQtProject")), 0, m_dwCookie, &bRet));
#if 1
LPCTSTR szGenerateQtProject = _T("Generate Qt Project");
strCmdString.LoadString(IDS_GENERATEQTPROJECT_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szGenerateQtProject + strCmdString), CComBSTR(_T("QMsDevGenerateQtProject")), 1, m_dwCookie, &bRet));
#endif
LPCTSTR szNewQtDialog = _T("New Qt Dialog");
strCmdString.LoadString(IDS_NEWQTDIALOG_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtDialog + strCmdString), CComBSTR(_T("QMsDevNewQtDialog")), 2, m_dwCookie, &bRet));
LPCTSTR szOpenDesigner = _T("Open Qt GUI Designer");
strCmdString.LoadString(IDS_OPENDESIGNER_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szOpenDesigner + strCmdString), CComBSTR(_T("QMsDevStartDesigner")), 3, m_dwCookie, &bRet));
LPCTSTR szUseQt = _T("Use Qt");
strCmdString.LoadString(IDS_USEQT_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szUseQt + strCmdString), CComBSTR(_T("QMsDevUseQt")), 4, m_dwCookie, &bRet));
LPCTSTR szAddMOCStep = _T("Add MOC step");
strCmdString.LoadString(IDS_ADDMOCSTEP_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddMOCStep + strCmdString), CComBSTR(_T("QMsDevAddMOCStep")), 5, m_dwCookie, &bRet));
LPCTSTR szAddUICStep = _T("Add UIC step");
strCmdString.LoadString(IDS_ADDUICSTEP_STRING);
VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddUICStep + strCmdString), CComBSTR(_T("QMsDevAddUICStep")), 6, m_dwCookie, &bRet));
if (bRet == VARIANT_FALSE)
{
*OnConnection = VARIANT_FALSE;
return S_OK;
}
if (bFirstTime == VARIANT_TRUE)
{
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szNewQtProject), m_dwCookie));
#if 1
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szGenerateQtProject), m_dwCookie));
#endif
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szNewQtDialog), m_dwCookie));
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szOpenDesigner), m_dwCookie));
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szUseQt), m_dwCookie));
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szAddMOCStep), m_dwCookie));
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, CComBSTR(szAddUICStep), m_dwCookie));
}
*OnConnection = VARIANT_TRUE;
return S_OK;
}
示例7: Shutdown
//------------------------------------------------------------------------------
void CRole::Shutdown( IApplication& Application )
{
__QCS_FCONTEXT( "CRole::Shutdown" );
Application.Shutdown();
m_Impl->Shutdown( Application );
}
示例8: AFX_MANAGE_STATE
// This is called when the user first loads the add-in, and on start-up
// of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection (IApplication * pApp, VARIANT_BOOL bFirstTime,
long dwCookie, VARIANT_BOOL * OnConnection)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
*OnConnection = VARIANT_FALSE;
// Store info passed to us
IApplication *pApplication = NULL;
HRESULT hr;
hr = pApp->QueryInterface (IID_IApplication, (void **) &pApplication);
if (FAILED (hr))
{
ReportLastError (hr);
return E_UNEXPECTED;
}
if (pApplication == NULL)
{
ReportInternalError ("IApplication::QueryInterface");
return E_UNEXPECTED;
}
m_dwCookie = dwCookie;
// Create command dispatch, send info back to DevStudio
CCommandsObj::CreateInstance (&m_pCommands);
if (! m_pCommands)
{
ReportInternalError ("CCommandsObj::CreateInstance");
return E_UNEXPECTED;
}
m_pCommands->AddRef ();
// The QueryInterface above AddRef'd the Application object. It will
// be Release'd in CCommand's destructor.
m_pCommands->SetApplicationObject (pApplication);
hr = pApplication->SetAddInInfo ((long) AfxGetInstanceHandle (),
(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE,
m_dwCookie);
if (FAILED (hr))
{
ReportLastError (hr);
return E_UNEXPECTED;
}
// Inform DevStudio of the commands we implement
if (! AddCommand (pApplication, "VisVimDialog", "VisVimDialogCmd",
IDS_CMD_DIALOG, 0, bFirstTime))
return E_UNEXPECTED;
if (! AddCommand (pApplication, "VisVimEnable", "VisVimEnableCmd",
IDS_CMD_ENABLE, 1, bFirstTime))
return E_UNEXPECTED;
if (! AddCommand (pApplication, "VisVimDisable", "VisVimDisableCmd",
IDS_CMD_DISABLE, 2, bFirstTime))
return E_UNEXPECTED;
if (! AddCommand (pApplication, "VisVimToggle", "VisVimToggleCmd",
IDS_CMD_TOGGLE, 3, bFirstTime))
return E_UNEXPECTED;
if (! AddCommand (pApplication, "VisVimLoad", "VisVimLoadCmd",
IDS_CMD_LOAD, 4, bFirstTime))
return E_UNEXPECTED;
*OnConnection = VARIANT_TRUE;
return S_OK;
}
示例9: Setup
//------------------------------------------------------------------------------
void CRole::Setup( IApplication& Application )
{
__QCS_FCONTEXT( "CRole::Setup" );
m_Impl->Setup( Application );
Application.Setup();
}
示例10: AFX_MANAGE_STATE
// This is called when the user first loads the add-in, and on start-up
// of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
long dwCookie, VARIANT_BOOL* OnConnection)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Store info passed to us
IApplication* pApplication = NULL;
if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
|| pApplication == NULL)
{
*OnConnection = VARIANT_FALSE;
return S_OK;
}
m_dwCookie = dwCookie;
// Create command dispatch, send info back to DevStudio
CCommandsObj::CreateInstance(&m_pCommands);
m_pCommands->AddRef();
// The QueryInterface above AddRef'd the Application object. It will
// be Release'd in CCommand's destructor.
m_pCommands->SetApplicationObject(pApplication);
// (see stdafx.h for the definition of VERIFY_OK)
VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));
// Inform DevStudio of the commands we implement
// TODO: Replace the AddCommand call below with a series of calls,
// one for each command your add-in will add.
// The command name should not be localized to other languages. The
// tooltip, command description, and other strings related to this
// command are stored in the string table (IDS_CMD_STRING) and should
// be localized.
LPCTSTR szCommand = _T("ShowGroupsAddinCommand");
VARIANT_BOOL bRet;
CString strCmdString;
strCmdString.LoadString(IDS_CMD_STRING);
strCmdString = szCommand + strCmdString;
CComBSTR bszCmdString(strCmdString);
CComBSTR bszMethod(_T("ShowGroupsAddinCommandMethod"));
CComBSTR bszCmdName(szCommand);
VERIFY_OK(pApplication->AddCommand(bszCmdString, bszMethod, 0, m_dwCookie, &bRet));
if (bRet == VARIANT_FALSE)
{
// AddCommand failed because a command with this name already
// exists. You may try adding your command under a different name.
// Or, you can fail to load as we will do here.
*OnConnection = VARIANT_FALSE;
return S_OK;
}
// Add toolbar buttons only if this is the first time the add-in
// is being loaded. Toolbar buttons are automatically remembered
// by Developer Studio from session to session, so we should only
// add the toolbar buttons once.
if (bFirstTime == VARIANT_TRUE)
{
VERIFY_OK(pApplication->
AddCommandBarButton(dsGlyph, bszCmdName, m_dwCookie));
}
// Create the WWhizInterface.
g_wwhizInterface = WWhizInterface2Create(AfxGetInstanceHandle(), pApplication);
*OnConnection = VARIANT_TRUE;
return S_OK;
}
示例11: AFX_MANAGE_STATE
HRESULT CCommands::XApplicationEvents::BeforeBuildStart()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
IApplication* pApplication;
pApplication = m_pCommands->GetApplicationObject();
CComPtr<IProjects> pIProjects = NULL;
pApplication->get_Projects((IDispatch **)&pIProjects);
long lProjects = 0;
CComVariant varProject ;
VERIFY_OK( pIProjects->get_Count( &lProjects ) );
for ( long lProject = 1 ; lProject < lProjects + 1 ; lProject++ )
{
varProject = lProject;
CComPtr< IGenericProject > pIGenericProject;
VERIFY_OK( pIProjects->Item(varProject, &pIGenericProject));
if (pIGenericProject)
{
CComBSTR bType;
CString strType;
pIGenericProject->get_Type(&bType);
strType = bType;
if (strType.CompareNoCase(DS_BUILD_PROJECT) != 0) continue;
CComBSTR bStr;
pIGenericProject->get_FullName(&bStr);
CString strProjectName = bStr;
CString strProjectPath, strRcName, strConfigName;
UINT uSvnVersion = 0;
TCHAR sDrive[_MAX_DRIVE] = {0};
TCHAR sDir[_MAX_DIR] = {0};
TCHAR sFname[_MAX_FNAME] = {0};
TCHAR sExt[_MAX_EXT] = {0};
_tsplitpath(strProjectName, sDrive, sDir, sFname, sExt);
strProjectPath = CString(sDrive) + CString(sDir);
strConfigName = CString(sDrive) + CString(sDir) + CString(sFname) + CString(_T(".ini"));
// 得到配置信息
CONFIG config;
COptionDlg::GetConfig(config, strConfigName);
if (config.bCheckSvn && !config.bCheckSelfUpdata)
{
// const svn_version_t *ver = svn_wc_version();
uSvnVersion = GetWorkSvnVersion(strProjectPath, config.iSvnVersionPath);
if (uSvnVersion == 0)
{
return S_OK;
}
}
CString Data;
GetFileData(strProjectName, Data);
if (Data.IsEmpty())
{
return S_OK;
}
strRcName = GetRegexpData(Data, _T("SOURCE=(?<SCR>.+\\.rc)$|SOURCE=\"(?<SCR>.+\\.rc)\""), MULTILINE | IGNORECASE, "SCR");
if (strRcName.IsEmpty())
{
return S_OK;
}
CString strFileVersion, strFileVersionDescribe, strVersion, strVersionDescribe, RcData;
UINT uFileVer[4], uFileVerDesc[4];
BOOL bUpdata = FALSE;
GetFileData(strProjectPath + strRcName, RcData);
if (RcData.IsEmpty())
{
return S_OK;
}
// 进行 版本信息 更新
strVersion = GetRegexpData(RcData, _T(".+VALUE.+\"FileVersion\",.+\"(.+)\""), MULTILINE | IGNORECASE);
if (!strVersion.IsEmpty())
{
sscanf(strVersion, "%d, %d, %d, %d", &uFileVer[0], &uFileVer[1], &uFileVer[2], &uFileVer[3]);
UpdataVersionInfo(uFileVer, config, uSvnVersion);
strFileVersion.Format(_T("$1%d, %d, %d, %d\\0$2"),
uFileVer[0], uFileVer[1], uFileVer[2], uFileVer[3]);
if (-1 == strFileVersion.Find(strVersion))
//.........这里部分代码省略.........
示例12: main
int main(int argc, char *argv[])
#endif
{
#ifndef LITEAPP_LIBRARY
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif
#endif
QApplication app(argc, argv);
#if QT_VERSION >= 0x050100
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
//QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
QTranslator translator;
QTranslator qtTranslator;
QString resPath = LiteApp::getResoucePath();
QString locale = QLocale::system().name();
QString qss;
QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
if (storeLocal) {
const QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
} else {
const QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
}
if (!locale.isEmpty()) {
const QString &liteideTrPath = resPath+"/translations";
if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
// Binary installer puts Qt tr files into creatorTrPath
app.installTranslator(&translator);
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
app.installTranslator(&qtTranslator);
}
app.setProperty("liteide_locale", locale);
}
}
if (!qss.isEmpty()) {
QFile f(resPath+"/liteapp/qss/"+qss);
if (f.open(QFile::ReadOnly)) {
QString styleSheet = QLatin1String(f.readAll());
app.setStyleSheet(styleSheet);
}
}
QDir::addSearchPath("icon",resPath);
QDir::addSearchPath("icon",resPath+"/liteapp");
QDir::addSearchPath("icon",":/");
#if QT_VERSION >= 0x050000
QString storage = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
QString storage = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
QDir dir(storage);
dir.mkdir("liteide");
QStringList argList;
QStringList fileList;
if (argc >= 2) {
for (int i = 1; i < argc; i++) {
QString arg = argv[i];
if (arg.startsWith("-")) {
argList.append(arg);
continue;
} else {
fileList.append(arg);
}
}
}
IApplication *liteApp = LiteApp::NewApplication(true,0);
if (fileList.size() == 1) {
QString file = fileList.at(0);
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->addFolderList(f.path());
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
} else {
foreach(QString file, fileList) {
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
}
}
示例13: main
//.........这里部分代码省略.........
for(int i = 1; i < arguments.size(); i++) {
QString arg = arguments[i];
if (arg.startsWith("-")) {
if (arg.indexOf(flagSelectEnv+"=") == 0) {
argSelectEnv = arg.mid(flagSelectEnv.length()+1);
} else if (arg == flagSelectEnv) {
i++;
if (i < arguments.size()) {
argSelectEnv = arguments[i];
}
} else if (arg == flagResetSetting) {
argResetSetting = true;
} else if (arg == flagLocalSetting) {
argLocalSetting = true;
} else if (arg == flagUserSetting) {
argUserSetting = true;
}
continue;
}
fileList.append(arg);
}
//save to global
if (!argSelectEnv.isEmpty()) {
LiteApp::s_cookie.insert(flagSelectEnv,argSelectEnv);
}
if (argLocalSetting) {
LiteApp::s_cookie.insert(flagLocalSetting,true);
}
if (argUserSetting) {
LiteApp::s_cookie.insert(flagUserSetting,true);
}
#if QT_VERSION >= 0x050100
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
//QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
QTranslator translator;
QTranslator qtTranslator;
QString resPath = LiteApp::getResoucePath();
QString locale = QLocale::system().name();
QString qss;
QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
if (argUserSetting) {
storeLocal = false;
} else if (argLocalSetting) {
storeLocal = true;
}
if (storeLocal) {
QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
if (argResetSetting) {
settings.clear();
}
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
} else {
QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
if (argResetSetting) {
settings.clear();
}
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
}
if (!locale.isEmpty()) {
const QString &liteideTrPath = resPath+"/translations";
if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
// Binary installer puts Qt tr files into creatorTrPath
app.installTranslator(&translator);
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
app.installTranslator(&qtTranslator);
}
app.setProperty("liteide_locale", locale);
}
}
if (!qss.isEmpty()) {
QFile f(resPath+"/liteapp/qss/"+qss);
if (f.open(QFile::ReadOnly)) {
QString styleSheet = QLatin1String(f.readAll());
app.setStyleSheet(styleSheet);
}
}
IApplication *liteApp = LiteApp::NewApplication("default",0);
foreach(QString file, fileList) {
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
}
示例14: rand
//.........这里部分代码省略.........
"/out:" + pPath + "\\" + pName + "." + pExt + " " +
//sdk libs
" comctl32.lib " + GetPluginLibs(pExt) +
//maxsdk libpath
" /LIBPATH:" + sPath + "\\lib " + " /DLL /base:" + base_address;
// General Settings
sG = CString("0"); //To specify Not Using MFC
BSTR bszComp = CString("cl.exe").AllocSysString();
BSTR bszLink = CString("link.exe").AllocSysString();
BSTR bszMfc = CString("mfc").AllocSysString();
// Compiler settings
BSTR bszSettingsC[] = {
("/MDd /G6 /LD " + sInc).AllocSysString(), // Debug
("/MD /G6 /LD " + sInc).AllocSysString(), // Hybrid
("/MD /G6 /LD " + sInc).AllocSysString() // Release
};
BSTR bszRemSettingsC = CString(_T("/GX /D_MBCS /GZ")).AllocSysString();
BSTR bszHyb = CString("Hybrid").AllocSysString();
BSTR bszSettingsL = sL.AllocSysString();
BSTR bszSettingsG = sG.AllocSysString();
COleVariant res;
pProject->AddConfiguration(bszHyb, res);
pProject->get_Configurations(&pConfigs);
pConfigs->get_Count(&count);
for (long i = 1; i <= count; i++)
{
COleVariant varInd(i);
pConfigs->Item(varInd , &pConfig);
COleVariant var(0L,VT_ERROR);
var.scode=DISP_E_PARAMNOTFOUND;
pConfig->AddToolSettings(bszMfc, bszSettingsG, var);
pConfig->AddToolSettings(bszLink, bszSettingsL, var);
COleVariant varStr;
pConfig->get_Name(&V_BSTR(&varStr));
varStr.vt = VT_BSTR;
if (varStr == COleVariant(pName + " - Win32 Debug"))
{
pConfig->AddToolSettings(bszComp, bszSettingsC[0], var);
SysFreeString(bszSettingsC[0]);
}
else if (varStr == COleVariant(pName + " - Win32 Hybrid"))
{
pConfig->AddToolSettings(bszComp, bszSettingsC[1], var);
SysFreeString(bszSettingsC[1]);
}
else // release
{
pConfig->AddToolSettings(bszComp, bszSettingsC[2], var);
SysFreeString(bszSettingsC[2]);
// For release config add "/release" flag to linker settings
BSTR rel = CString(_T("/release")).AllocSysString();
pConfig->AddToolSettings(bszLink, rel, var);
SysFreeString(rel);
}
pConfig->RemoveToolSettings(bszComp, bszRemSettingsC, var);
pConfig->Release();
}
SysFreeString(bszComp);
SysFreeString(bszLink);
SysFreeString(bszMfc);
SysFreeString(bszRemSettingsC);
SysFreeString(bszHyb);
SysFreeString(bszSettingsL);
SysFreeString(bszSettingsG);
pConfigs->Release();
#if (1)
//The following opens the Root.cpp document in the DevStudio
IApplication *pApp;
IDocuments *pDocs;
IDocuments *pDoc;
BSTR bszRoot = (pName + CString(_T(".cpp"))).AllocSysString();
COleVariant varOpenAs(CString(_T("Text")));
COleVariant varReadOnly(0L, VT_BOOL);
pProject->get_Application((IDispatch **)&pApp);
pApp->get_Documents((IDispatch **)&pDocs);
pDocs->Open(bszRoot, varOpenAs, varReadOnly, (IDispatch **)&pDoc);
SysFreeString(bszRoot);
pApp->Release();
pDocs->Release();
pDoc->Release();
#endif
}
示例15: extensions
int Starter::Run(int& argc, char** argv,
Poco::Util::AbstractConfiguration* config)
{
// The CTK PluginFramework needs a QCoreApplication
if (!qApp)
{
BERRY_FATAL << "No QCoreApplication instance found. You need to create one prior to calling Starter::Run()";
}
InternalPlatform* platform = InternalPlatform::GetInstance();
int returnCode = 0;
// startup the internal platform
platform->Initialize(argc, argv, config);
platform->Launch();
bool consoleLog = platform->ConsoleLog();
// run the application
IExtensionPointService::Pointer service =
platform->GetExtensionPointService();
if (service == 0)
{
platform->GetLogger()->log(
Poco::Message(
"Starter",
"The extension point service could not be retrieved. This usually indicates that the BlueBerry OSGi plug-in could not be loaded.",
Poco::Message::PRIO_FATAL));
std::unexpected();
returnCode = 1;
}
else
{
IConfigurationElement::vector extensions(
service->GetConfigurationElementsFor(Starter::XP_APPLICATIONS));
IConfigurationElement::vector::iterator iter;
for (iter = extensions.begin(); iter != extensions.end();)
{
if ((*iter)->GetName() != "application")
iter = extensions.erase(iter);
else
++iter;
}
std::string argApplication = Platform::GetConfiguration().getString(
Platform::ARG_APPLICATION, "");
IApplication* app = 0;
if (extensions.size() == 0)
{
BERRY_FATAL
<< "No extensions configured into extension-point '" << Starter::XP_APPLICATIONS << "' found. Aborting.\n";
returnCode = 0;
}
else if (extensions.size() == 1)
{
if (!argApplication.empty())
BERRY_INFO(consoleLog)
<< "One '" << Starter::XP_APPLICATIONS << "' extension found, ignoring "
<< Platform::ARG_APPLICATION << " argument.\n";
std::vector<IConfigurationElement::Pointer> runs(
extensions[0]->GetChildren("run"));
app = runs.front()->CreateExecutableExtension<IApplication> ("class");
if (app == 0)
{
// support legacy BlueBerry extensions
app = runs.front()->CreateExecutableExtension<IApplication> ("class", IApplication::GetManifestName());
}
}
else
{
if (argApplication.empty())
{
BERRY_WARN << "You must provide an application id via \""
<< Platform::ARG_APPLICATION << "=<id>\"";
BERRY_INFO << "Possible application ids are:";
for (iter = extensions.begin(); iter != extensions.end(); ++iter)
{
std::string appid;
if ((*iter)->GetAttribute("id", appid) && !appid.empty())
{
BERRY_INFO << appid;
}
}
returnCode = 0;
}
else
{
for (iter = extensions.begin(); iter != extensions.end(); ++iter)
{
BERRY_INFO(consoleLog) << "Checking applications extension from: "
<< (*iter)->GetContributor() << std::endl;
std::string appid;
if ((*iter)->GetAttribute("id", appid))
{
BERRY_INFO(consoleLog) << "Found id: " << appid << std::endl;
//.........这里部分代码省略.........