forked from Ivasoft/DSView
Set a new log file path
This commit is contained in:
@@ -74,9 +74,9 @@ bool AppControl::Init()
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetAppDataDir:\"%s\"", cs.c_str());
|
||||
|
||||
qs = GetResourceDir();
|
||||
qs = GetFirmwareDir();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetResourceDir:\"%s\"", cs.c_str());
|
||||
dsv_info("GetFirmwareDir:\"%s\"", cs.c_str());
|
||||
|
||||
qs = GetUserDataDir();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
|
||||
@@ -358,7 +358,8 @@ QString GetAppDataDir()
|
||||
#endif
|
||||
}
|
||||
|
||||
QString GetResourceDir(){
|
||||
QString GetFirmwareDir()
|
||||
{
|
||||
QDir dir1 = GetAppDataDir() + "/res";
|
||||
// ./res
|
||||
if (dir1.exists()){
|
||||
@@ -404,3 +405,12 @@ QString GetDecodeScriptDir()
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
QString GetProfileDir()
|
||||
{
|
||||
#if QT_VERSION >= 0x050400
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
#else
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,9 +37,10 @@
|
||||
//--------------------api---
|
||||
QString GetIconPath();
|
||||
QString GetAppDataDir();
|
||||
QString GetResourceDir();
|
||||
QString GetFirmwareDir();
|
||||
QString GetUserDataDir();
|
||||
QString GetDecodeScriptDir();
|
||||
QString GetProfileDir();
|
||||
|
||||
//------------------class
|
||||
|
||||
|
||||
@@ -103,8 +103,14 @@ QString get_dsv_log_path()
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
lf = QDir::homePath() + "/DSView.log";
|
||||
#else
|
||||
lf = GetAppDataDir() + "/DSView.log";
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
lf = GetUserDataDir() + "/DSView.log";
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
lf = GetUserDataDir() + "/DSView.log";
|
||||
#endif
|
||||
|
||||
return lf;
|
||||
|
||||
@@ -420,15 +420,10 @@ namespace pv
|
||||
}
|
||||
|
||||
QString MainWindow::genSessionFileName(bool isNewFormat)
|
||||
{
|
||||
#if QT_VERSION >= 0x050400
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
#else
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#endif
|
||||
|
||||
{
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
|
||||
QString path = GetProfileDir();
|
||||
QDir dir(path);
|
||||
if (dir.exists() == false){
|
||||
dir.mkpath(path);
|
||||
@@ -1625,7 +1620,7 @@ namespace pv
|
||||
}
|
||||
else if (_device_agent->is_demo())
|
||||
{
|
||||
QDir dir(GetResourceDir());
|
||||
QDir dir(GetFirmwareDir());
|
||||
if (dir.exists())
|
||||
{
|
||||
QString ses_name = dir.absolutePath() + "/"
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace pv
|
||||
ds_set_datafeed_callback(data_feed_callback);
|
||||
|
||||
// firmware resource directory
|
||||
QString resdir = GetResourceDir();
|
||||
QString resdir = GetFirmwareDir();
|
||||
std::string res_path = pv::path::ToUnicodePath(resdir);
|
||||
ds_set_firmware_resource_dir(res_path.c_str());
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ void FileBar::on_actionLoad_triggered()
|
||||
|
||||
void FileBar::on_actionDefault_triggered()
|
||||
{
|
||||
QDir dir(GetResourceDir());
|
||||
QDir dir(GetFirmwareDir());
|
||||
if (!dir.exists()) {
|
||||
MsgBox::Show(NULL, L_S(STR_PAGE_MSG, S_ID(IDS_MSG_NOT_FOND_DEFAULT_PROFILE),
|
||||
"Cannot find default profile for this device!"), this);
|
||||
@@ -202,7 +202,7 @@ void FileBar::on_actionDefault_triggered()
|
||||
|
||||
QString FileBar::genDefaultSessionFile()
|
||||
{
|
||||
QDir dir(GetResourceDir());
|
||||
QDir dir(GetFirmwareDir());
|
||||
|
||||
QString driver_name = _session->get_device()->driver_name();
|
||||
QString mode_name = QString::number(_session->get_device()->get_work_mode());
|
||||
|
||||
@@ -259,11 +259,6 @@ void LogoBar::on_action_setting_log()
|
||||
ckRebuild->setChecked(app._appOptions.appendLogMode);
|
||||
lay->addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_APPEND_MODE), "Append mode"), ckRebuild);
|
||||
|
||||
QLineEdit *etPath = new QLineEdit();
|
||||
etPath->setReadOnly(true);
|
||||
etPath->setText(get_dsv_log_path());
|
||||
lay->addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_LOG_PATH), "File Path"), etPath);
|
||||
|
||||
QPushButton *btOpen = new QPushButton();
|
||||
btOpen->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_OPEN), "Open"));
|
||||
connect(btOpen, SIGNAL(released()), this, SLOT(on_open_log_file()));
|
||||
|
||||
Reference in New Issue
Block a user