本文整理汇总了C++中Global::getProgramDirPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Global::getProgramDirPath方法的具体用法?C++ Global::getProgramDirPath怎么用?C++ Global::getProgramDirPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Global
的用法示例。
在下文中一共展示了Global::getProgramDirPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initUserStore
bool CommunicationManager::initUserStore() {
QLOG_DEBUG() << "Inside CommunicationManager::initUserStore()";
try {
shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
QString pgmDir = global.getProgramDirPath() + "/certs/PCA-3G2.pem";
sslSocketFactory->loadTrustedCertificates(pgmDir.toStdString().c_str());
sslSocketFactory->authenticate(true);
sslSocketUserStore = sslSocketFactory->createSocket(evernoteHost, 443);
shared_ptr<TBufferedTransport> bufferedTransport(new TBufferedTransport(sslSocketUserStore));
userStoreHttpClient = shared_ptr<TTransport>(new THttpClient(bufferedTransport, evernoteHost, userStorePath));
userStoreHttpClient->open();
shared_ptr<TProtocol> iprot(new TBinaryProtocol(userStoreHttpClient));
userStoreClient = shared_ptr<UserStoreClient>(new UserStoreClient(iprot));
// authenticationResult = shared_ptr<AuthenticationResult>(new AuthenticationResult());
// QLOG_DEBUG() << "authenticating";
// userStoreClient->authenticate(
// *authenticationResult,
// "<userid>",
// "<password>",
// EDAM_CONSUMER_KEY,
// EDAM_CONSUMER_SECRET);
} catch (EDAMUserException e) {
QLOG_ERROR() << "EDAMUserException:" << e.errorCode << endl;
return false;
} catch (EDAMSystemException e) {
QLOG_ERROR() << "EDAMSystemException:" << QString::fromStdString(e.message) << endl;
return false;
} catch (TTransportException e) {
QLOG_ERROR() << "TTransportException:" << e.what() << endl;
return false;
}
QLOG_DEBUG() << "Leaving CommunicationManager::initUserStore()";
return true;
}
示例2: initNoteStore
bool CommunicationManager::initNoteStore() {
QLOG_DEBUG() << "Inside CommunicationManager::initNoteStore()";
try {
shared_ptr<TSSLSocketFactory> sslSocketFactory(new TSSLSocketFactory());
QString pgmDir = global.getProgramDirPath() + "/certs/PCA-3G2.pem";
sslSocketFactory->loadTrustedCertificates(pgmDir.toStdString().c_str());
sslSocketFactory->authenticate(true);
sslSocketNoteStore = sslSocketFactory->createSocket(evernoteHost, 443);
shared_ptr<TBufferedTransport> bufferedTransport(new TBufferedTransport(sslSocketNoteStore));
User user;
userStoreClient->getUser(user, authToken);
noteStorePath = "/edam/note/" +user.shardId;
noteStoreHttpClient = shared_ptr<TTransport>(new THttpClient(bufferedTransport, evernoteHost, noteStorePath));
noteStoreHttpClient->open();
shared_ptr<TProtocol> noteStoreProtocol(new TBinaryProtocol(noteStoreHttpClient));
noteStoreClient = shared_ptr<NoteStoreClient>(new NoteStoreClient(noteStoreProtocol));
SyncState syncState;
noteStoreClient->getSyncState(syncState, authToken);
} catch (EDAMUserException e) {
QLOG_ERROR() << "EDAMUserException:" << e.errorCode << endl;
return false;
} catch (EDAMSystemException e) {
QLOG_ERROR() << "EDAMSystemException:" << QString::fromStdString(e.message) << endl;
return false;
} catch (TTransportException e) {
QLOG_ERROR() << "TTransportException:" << e.what() << endl;
return false;
}
QLOG_DEBUG() << "Leaving CommunicationManager::initNoteStore()";
return true;
}
示例3: main
//using namespace cv;
//*********************************************************************
//* Main entry point to the program.
//*********************************************************************
int main(int argc, char *argv[])
{
signal(SIGSEGV, fault_handler); // install our handler
// Setup the QApplication so we can begin
Application *a = new Application(argc, argv);
global.application = a;
// Setup the QLOG functions for debugging & messages
QsLogging::Logger& logger = QsLogging::Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
// const QString sLogPath(a->applicationDirPath());
QsLogging::DestinationPtr debugDestination(
QsLogging::DestinationFactory::MakeDebugOutputDestination() );
logger.addDestination(debugDestination.get());
// Begin setting up the environment
StartupConfig startupConfig;
global.argc = argc;
global.argv = argv;
startupConfig.accountId = -1;
for (int i=1; i<=argc; i++) {
QString parm(argv[i]);
if (parm == "--help" || parm == "-?") {
printf("\n\n");
printf("NixNote command line options:\n");
printf(" --help or -? Show this message\n");
printf(" --accountId=<id> Start with specified user account\n");
printf(" --dontStartMinimized Override option to start minimized\n");
printf(" --disableEditing Disable note editing\n");
printf(" --enableIndexing Enable background Indexing (can cause problems)\n");
printf(" --openNote=<lid> Open a specific note on startup\n");
printf(" --forceSystemTrayAvailable Force the program to accept that\n");
printf(" the desktop supports tray icons.\n");
printf(" --startMinimized Force a startup with NixNote minimized\n");
printf(" --syncAndExit Synchronize and exit the program.\n");
printf("\n\n");
return 0;
}
if (parm.startsWith("--accountId=", Qt::CaseSensitive)) {
parm = parm.mid(12);
startupConfig.accountId = parm.toInt();
}
if (parm.startsWith("--openNote=", Qt::CaseSensitive)) {
parm = parm.mid(11);
startupConfig.startupNoteLid = parm.toInt();
}
if (parm == "--disableEditing") {
startupConfig.disableEditing = true;
}
if (parm == "--dontStartMinimized") {
startupConfig.forceNoStartMinimized = true;
}
if (parm == "--startMinimized") {
startupConfig.forceStartMinimized = true;
}
if (parm == "--newNote") {
startupConfig.startupNewNote = true;
}
if (parm == "--syncAndExit") {
startupConfig.syncAndExit = true;
}
if (parm == "--enableIndexing") {
startupConfig.enableIndexing = true;
}
if (parm == "--forceSystemTrayAvailable") {
startupConfig.forceSystemTrayAvailable = true;
}
}
startupConfig.programDirPath = global.getProgramDirPath() + QDir().separator();
startupConfig.name = "NixNote";
global.setup(startupConfig);
QString logPath = global.fileManager.getLogsDirPath("")+"messages.log";
QsLogging::DestinationPtr fileDestination(
QsLogging::DestinationFactory::MakeFileDestination(logPath) ) ;
logger.addDestination(fileDestination.get());
// Show Qt version. This is useful for debugging
QLOG_DEBUG() << "Program Home: " << global.fileManager.getProgramDirPath("");
QLOG_INFO() << "Built on " << __DATE__ << " at " << __TIME__;
QLOG_INFO() << "Built with Qt" << QT_VERSION_STR << "running on" << qVersion();
//QLOG_INFO() << "Thrift version: " << PACKAGE_VERSION;
// Create a shared memory region. We use this to communicate
// with any other instance that may be running. If another instance
// is found we need to either show that one or kill this one.
bool memInitNeeded = true;
if( !global.sharedMemory->create( 512*1024, QSharedMemory::ReadWrite) ) {
//.........这里部分代码省略.........
示例4: main
int main(int argc, char *argv[])
{
Botan::LibraryInitializer botanInit;
// Setup the QApplication so we can begin
Application a(argc, argv);
global.application = &a;
// Setup the QLOG functions for debugging & messages
QsLogging::Logger& logger = QsLogging::Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
const QString sLogPath(a.applicationDirPath());
QsLogging::DestinationPtr fileDestination(
QsLogging::DestinationFactory::MakeFileDestination(sLogPath) );
QsLogging::DestinationPtr debugDestination(
QsLogging::DestinationFactory::MakeDebugOutputDestination() );
logger.addDestination(debugDestination.get());
logger.addDestination(fileDestination.get());
// Begin setting up the environment
global.argc = argc;
global.argv = argv;
// Show Qt version. This is useful for debugging
QLOG_INFO() << "Built with Qt" << QT_VERSION_STR << "running on" << qVersion();
StartupConfig startupConfig;
startupConfig.programDirPath = global.getProgramDirPath() + QDir().separator();
startupConfig.name = "NixNote";
startupConfig.accountId = 1;
global.setup(startupConfig);
// Create a shared memory region. We use this to communicate
// with any other instance that may be running. If another instance
// is found we need to either show that one or kill this one.
bool memInitNeeded = true;
if( !global.sharedMemory->create( 512, QSharedMemory::ReadWrite) ) {
// Attach to it and detach. This is done in case it crashed.
global.sharedMemory->attach();
global.sharedMemory->detach();
if( !global.sharedMemory->create( 512, QSharedMemory::ReadWrite) ) {
global.settings->beginGroup("Debugging");
QString startup = global.settings->value("onMultipleInstances", "SHOW_OTHER").toString();
global.settings->endGroup();
global.sharedMemory->attach();
global.sharedMemory->lock();
void *dataptr = global.sharedMemory->data();
if (startup == "SHOW_OTHER") {
memcpy(dataptr, "SHOW_WINDOW", 11); // Tell the other guy to show himself
QLOG_INFO() << "Another NixNote was found. Stopping this instance";
exit(0); // Exit this one
}
if (startup == "STOP_OTHER") {
memcpy(dataptr, "IMMEDIATE_SHUTDOWN", 18); // Tell the other guy to shut down
memInitNeeded = false;
}
global.sharedMemory->unlock();
}
}
if (memInitNeeded) {
global.sharedMemory->lock();
memset(global.sharedMemory->data(), 0, global.sharedMemory->size());
global.sharedMemory->unlock();
}
// Save the clipboard
global.clipboard = QApplication::clipboard();
NixNote w;
w.show();
return a.exec();
}