/** * Opens the screenshot directory if the user has enabled saving local screenshots. * @brief Systray::openSaveDirectory */ void Systray::openSaveDirectory() { QString path = getSaveDirectory(); bool response = QDesktopServices::openUrl(QUrl::fromLocalFile(path)); if (!response) { trayIcon->showMessage(tr("Error!"), tr("Error opening save directory"), QSystemTrayIcon::Warning); } }
/** * Initiate the upload process when the screenshot has been taken. * @brief Systray::screenshotDone * @param returnCode * @param fileName * @param output */ void Systray::screenshotDone(int returnCode, QString fileName, QString output) { if (returnCode != 0) { trayIcon->showMessage(tr("Error!"), output, QSystemTrayIcon::Warning); return; } Upload *u = new Upload(fileName); connect(u, SIGNAL(started()), this, SLOT(puushStarted())); connect(u, SIGNAL(finished(QString)), this, SLOT(puushDone(QString))); if (s.value(Settings::LOCAL_SAVE_ENABLED).toBool()) { QDir root = QDir::root(); root.mkpath(getSaveDirectory()); QFile::copy(fileName, getSavePath()); } }
bool FileSystem::awake(pugi::xml_node &node) { bool ret = true; for (pugi::xml_node path = node.child("path"); path ; path = path.next_sibling("path")) addSearchPath(path.child_value()); char *write_dir = SDL_GetPrefPath("Carlos", "Game_development"); if (PHYSFS_setWriteDir(write_dir) == 0) { LOG("%s,%s","Error on setting Write Dir. Error:", PHYSFS_getLastError()); ret = false; } else { LOG("%s %s", "Write directory is ", write_dir); addSearchPath(write_dir, getSaveDirectory()); } SDL_free(write_dir); return ret; }
/** * Generates the screenshot name based on the current settings. * @brief Systray::getSavePath * @return */ QString Systray::getSavePath() { return getSaveDirectory() + "/" + getFileName(); }