|
From: <sv...@va...> - 2010-02-13 01:06:20
|
Author: cerion
Date: 2010-02-13 00:27:22 +0000 (Sat, 13 Feb 2010)
New Revision: 476
Log:
straightened out vkConfig.
Modified:
branches/valkyrie_qt4port/help/help_handbook.cpp
branches/valkyrie_qt4port/main.cpp
branches/valkyrie_qt4port/mainwindow.cpp
branches/valkyrie_qt4port/objects/memcheck_object.cpp
branches/valkyrie_qt4port/objects/valgrind_object.cpp
branches/valkyrie_qt4port/objects/valgrind_object.h
branches/valkyrie_qt4port/objects/valkyrie_object.cpp
branches/valkyrie_qt4port/objects/valkyrie_object.h
branches/valkyrie_qt4port/utils/vk_config.cpp
branches/valkyrie_qt4port/utils/vk_config.h
branches/valkyrie_qt4port/utils/vk_utils.cpp
branches/valkyrie_qt4port/utils/vk_utils.h
Modified: branches/valkyrie_qt4port/help/help_handbook.cpp
===================================================================
--- branches/valkyrie_qt4port/help/help_handbook.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/help/help_handbook.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -494,8 +494,8 @@
void HandBook::readHistory()
{
bool ok = false;
- max_history = vkConfig->value( "handbook/max_history", 20 ).toInt( &ok );
- if (!ok) cerr << "Error: bad value for config::handbook/max_history" << endl;
+ max_history = vkConfig->value( "valkyrie_handbook/max_history", 20 ).toInt( &ok );
+ if (!ok) cerr << "Error: bad value for config::valkyrie_handbook/max_history" << endl;
// TODO: do this via vkConfig!
#if 0
@@ -537,8 +537,8 @@
void HandBook::readBookmarks()
{
bool ok = false;
- max_bookmarks = vkConfig->value( "handbook/max_bookmarks", 20 ).toInt(&ok);
- if (!ok) cerr << "Error: bad value for config::handbook/max_bookmarks" << endl;
+ max_bookmarks = vkConfig->value( "valkyrie_handbook/max_bookmarks", 20 ).toInt(&ok);
+ if (!ok) cerr << "Error: bad value for config::valkyrie_handbook/max_bookmarks" << endl;
// TODO: do this via vkConfig!
#if 0
Modified: branches/valkyrie_qt4port/main.cpp
===================================================================
--- branches/valkyrie_qt4port/main.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/main.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - the program entry point
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -21,15 +21,15 @@
#include <QApplication>
+#include "mainwindow.h"
#include "objects/valkyrie_object.h"
+#include "options/vk_parse_cmdline.h"
#include "toolview/toolview.h"
-#include "mainwindow.h"
-
+#include "utils/vk_utils.h"
#include "utils/vk_config.h"
-#include "options/vk_parse_cmdline.h"
-VkConfig* vkConfig = 0;
+VkConfig* vkConfig = NULL;
@@ -58,17 +58,12 @@
QCoreApplication::setOrganizationName("OpenWorks");
QCoreApplication::setOrganizationDomain("openworks.co.uk");
QCoreApplication::setApplicationName("Valkyrie");
- QString tmp_cfg = VkConfig::vkCfgMakeTempFilename();
- if ( tmp_cfg.isNull() ) {
- // TODO: workout what really happens to QSettings.
- cerr << "Error: no tmpfile for working config. No guarantees from here!" << endl;
+
+ VkConfig::createConfig( &valkyrie, &vkConfig );
+ if ( vkConfig == NULL ) {
+ VK_DEBUG("Failed to initialise config properly: Aborting" );
+ goto cleanup_and_exit;
}
- vkConfig = new VkConfig( tmp_cfg );
- bool ok = vkConfig->initCfg( &valkyrie );
- if ( !ok ) {
- // TODO: deal with this nicely.
- cerr << "Error: config not initialised properly: No guarantees from here!" << endl;
- }
// ------------------------------------------------------------
Modified: branches/valkyrie_qt4port/mainwindow.cpp
===================================================================
--- branches/valkyrie_qt4port/mainwindow.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/mainwindow.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - the top-level application window
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -101,8 +101,8 @@
delete toolViewStack;
// Save window position to config.
- vkConfig->setValue( "mainwindow/size", size() );
- vkConfig->setValue( "mainwindow/pos", pos() );
+ vkConfig->setValue( "valkyrie_mainwindow/size", size() );
+ vkConfig->setValue( "valkyrie_mainwindow/pos", pos() );
vkConfig->sync();
// handbook has no parent, so have to delete it.
@@ -142,8 +142,8 @@
*/
void MainWindow::setupLayout()
{
- resize( vkConfig->value( "mainwindow/size", QSize(600, 600)).toSize());
- move( vkConfig->value( "mainwindow/pos", QPoint(400, 0)).toPoint());
+ resize( vkConfig->value( "valkyrie_mainwindow/size", QSize(600, 600)).toSize());
+ move( vkConfig->value( "valkyrie_mainwindow/pos", QPoint(400, 0)).toPoint());
toolViewStack = new ToolViewStack( this );
setCentralWidget( toolViewStack );
Modified: branches/valkyrie_qt4port/objects/memcheck_object.cpp
===================================================================
--- branches/valkyrie_qt4port/objects/memcheck_object.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/objects/memcheck_object.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -454,8 +454,7 @@
*/
bool Memcheck::runValgrind( QStringList vgflags )
{
-//TODO: saveFname = vk_mkstemp( QString( get_VK_LOGS_DIR() ) + "mc_log", "xml" );
- saveFname = "./mc_log.xml";
+ saveFname = vk_mkstemp( QString( VkConfig::vkTmpDir() ) + "mc_log", "xml" );
vk_assert( !saveFname.isEmpty() );
vgflags.insert( ++(vgflags.begin()), ("--log-file=" + saveFname) );
@@ -548,7 +547,7 @@
QString fname_logList = vkConfig->rdEntry( "merge", "valkyrie" );
statusMsg( "Merging logs in file-list", fname_logList );
- saveFname = vk_mkstemp( QString( get_VK_LOGS_DIR() )
+ saveFname = vk_mkstemp( QString( VkConfig::vkTmpDir() )
+ "mc_merged", "xml" );
vk_assert( !saveFname.isEmpty() );
Modified: branches/valkyrie_qt4port/objects/valgrind_object.cpp
===================================================================
--- branches/valkyrie_qt4port/objects/valgrind_object.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/objects/valgrind_object.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Valgrind-specific: options / flags / functionality
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -384,8 +384,6 @@
// ------------------------------------------------------------
- // Can't access vkConfig->suppDir(): config created after us!
- QString defSuppDir = QDir::homePath() + "/" + QString(VK_CFG_GLBL_DIR) + VK_SUPPS_DIR;
/* list of dirs holding suppression files */
options.addOpt(
VALGRIND::SUPPS_DIRS,
@@ -394,7 +392,7 @@
'\0',
"",
"",
- defSuppDir,
+ VkConfig::vkSuppsDir(),
"Suppression Dirs:",
"",
urlValkyrie::suppsTab,
Modified: branches/valkyrie_qt4port/objects/valgrind_object.h
===================================================================
--- branches/valkyrie_qt4port/objects/valgrind_object.h 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/objects/valgrind_object.h 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Valgrind-specific: options / flags / functionality
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
Modified: branches/valkyrie_qt4port/objects/valkyrie_object.cpp
===================================================================
--- branches/valkyrie_qt4port/objects/valkyrie_object.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/objects/valkyrie_object.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Valkyrie-specific: options / flags / functionality
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -256,7 +256,7 @@
'\0',
"",
"",
- get_VK_LOGS_DIR(),
+ VkConfig::vkTmpDir(),
"Log Dir:",
"",
urlValkyrie::logDir,
@@ -361,6 +361,30 @@
}
vkConfig->endGroup();
+
+
+ // Colour Defaults
+ vkConfig->beginGroup( this->objectName() + "_colours" );
+ vkConfig->setValue( "background", QColor(214,205,187) );
+ vkConfig->setValue( "base", QColor(255,255,255) );
+ vkConfig->setValue( "dkgray", QColor(128,128,128) );
+ vkConfig->setValue( "editColor", QColor(254,222,190) );
+ vkConfig->setValue( "highlight", QColor(147, 40, 40) );
+ vkConfig->setValue( "nullColor", QColor(239,227,211) );
+ vkConfig->setValue( "text", QColor(0, 0, 0) );
+ vkConfig->endGroup();
+
+ // MainWindow Defaults
+ vkConfig->beginGroup( this->objectName() + "_mainwindow" );
+ vkConfig->setValue( "size", QSize(600, 600) );
+ vkConfig->setValue( "pos", QPoint(400, 0) );
+ vkConfig->endGroup();
+
+ // Handbook defaults
+ vkConfig->beginGroup( this->objectName() + "_handbook" );
+ vkConfig->setValue( "max_bookmarks", "20" );
+ vkConfig->setValue( "max_history", "20" );
+ vkConfig->endGroup();
}
Modified: branches/valkyrie_qt4port/objects/valkyrie_object.h
===================================================================
--- branches/valkyrie_qt4port/objects/valkyrie_object.h 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/objects/valkyrie_object.h 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Valkyrie-specific: options / flags / functionality
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
Modified: branches/valkyrie_qt4port/utils/vk_config.cpp
===================================================================
--- branches/valkyrie_qt4port/utils/vk_config.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/utils/vk_config.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Configuration
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -34,6 +34,8 @@
#include <qstylefactory.h> /* vkStyle() */
#endif
+#include <pwd.h> // getpwuid
+
#include <iostream>
using namespace std;
@@ -89,16 +91,45 @@
}
-bool VkConfig::initCfg( Valkyrie* vk )
+/*!
+ Create yourself: kazam!
+*/
+void VkConfig::createConfig( Valkyrie* vk /*in*/,
+ VkConfig** new_vkConfig /*out*/ )
{
+ *new_vkConfig = NULL;
+
+ // ------------------------------------------------------------
+ // setup file
+ QString cfgTmpDir = VkConfig::vkTmpDir();
+ QDir dir;
+ if ( ! dir.exists( cfgTmpDir ) ) {
+ if ( ! dir.mkpath( cfgTmpDir ) ) {
+ VK_DEBUG( "Failed to create tmpdir: '%s'.", qPrintable( cfgTmpDir ) );
+ return;
+ }
+ }
+ QString cfgTmpPath = cfgTmpDir + "/" + VK_CFG_TEMP;
+ QString working_cfgfile = vk_mkstemp( cfgTmpPath, VK_CFG_EXT );
+
+ if ( working_cfgfile.isNull() ) {
+ VK_DEBUG( "failed to create tempfile for working cfg: '%s'",
+ qPrintable( working_cfgfile ) );
+ return;
+ }
+
+ // ------------------------------------------------------------
+ // Create new config:
+ *new_vkConfig = new VkConfig( working_cfgfile );
+
// 1) Check Global config file exists: if not, create one from compiled defailts.
if ( ! QFile::exists( vkCfgGlblFilename() ) ) {
- writeConfigDefaults( vk );
+ (*new_vkConfig)->writeConfigDefaults( vk );
}
// 2) Read global config file into RUNTIME settings
// check at least owner read/write perms ok
- QFile::Permissions perms = QFile::permissions( vkCfgGlblFilename() );
+ QFile::Permissions perms = QFile::permissions( VkConfig::vkCfgGlblFilename() );
if ( ( perms & QFile::WriteOwner ) != QFile::WriteOwner ||
( perms & QFile::ReadOwner ) != QFile::ReadOwner ) {
//TODO
@@ -106,8 +137,8 @@
} else {
// first clear all current settings, then read in global
- this->clear();
- readFromGlblConfigFile();
+ (*new_vkConfig)->clear();
+ (*new_vkConfig)->readFromGlblConfigFile();
}
// 3) If given a Project file on the command line, read and update 'working' config
@@ -123,7 +154,6 @@
"config dir '%s', and its files/sub-directories.</p>",
m_rcPath.latin1() );
*/
- return true;
}
@@ -429,25 +459,10 @@
/* Create the default global configuration file. -----------------------------
The first time valkyrie is started, vkConfig looks to see if this
file is present in the user's home dir. If not, it writes the
- relevant data to ~/.PACKAGE/PACKAGErc */
+ relevant data to the (user) global configuration file */
void VkConfig::writeConfigDefaults( Valkyrie* vk )
{
- // TODO: GET THESE DEFAULTS FROM VK OPTS
-
- // Colour Defaults
- setValue( "colors/background", "214,205,187" );
- setValue( "colors/base", "255,255,255" );
- setValue( "colors/dkgray", "128,128,128" );
- setValue( "colors/editColor", "254,222,190" );
- setValue( "colors/highlight", "147, 40, 40" );
- setValue( "colors/nullColor", "239,227,211" );
- setValue( "colors/text", "0, 0, 0" );
-
- // MainWindow Defaults
- setValue( "mainwindow/size", QSize(600, 600) );
- setValue( "mainwindow/pos", QPoint(400, 0) );
-
- /* Call each object and have it set its config defaults. */
+ // Call each object and have it set its config defaults.
VkObjectList vkObjectList = vk->vkObjList();
for ( int i = 0; i < vkObjectList.size(); ++i ) {
VkObject* obj = vkObjectList.at(i);
@@ -461,11 +476,6 @@
// setValue( "valgrind/supps-dirs", suppDir() );
- // Handbook defaults
- setValue( "handbook/max_bookmarks", "20" );
- setValue( "handbook/max_history", "20" );
-
-
// Working config is now the installation default.
// Save to GLBL config file
saveToGlblConfigFile();
@@ -473,46 +483,8 @@
#if 0
-/* Create the default global configuration file. -----------------------------
- The first time valkyrie is started, vkConfig looks to see if this
- file is present in the user's home dir. If not, it writes the
- relevant data to ~/.PACKAGE/PACKAGErc */
-bool VkConfig::writeConfigDefaults( Valkyrie* vk )
-{
- QString default_config = mkConfigDefaults( vk );
- QTextStream strm( &default_config, IO_ReadOnly );
- EntryMap rcMap = parseConfigToMap( strm );
-
- /* Set valkyrie version: used for rc upgrading */
- rcMap[ EntryKey( "valkyrie", "version" ) ].mValue
- = PACKAGE_VERSION;
-
- /* Set our 'configured' valgrind paths, if we have them */
- {
- rcMap[ EntryKey( "valkyrie", "merge-exec" ) ].mValue
- = BIN_LOGMERGE;
-
- rcMap[ EntryKey( "valkyrie", "vg-exec" ) ].mValue
- = BIN_VALGRIND;
-
- rcMap[ EntryKey( "valgrind", "suppressions" )].mValue
- = "";
-
- rcMap[ EntryKey( "valgrind", "supps-dirs" ) ].mValue
- = suppDir();
- }
-
- /* write out new config */
- if ( !writeConfig( rcMap, true ) ) {
- VK_DEBUG( "failed to write default config file" );
- return false;
- }
- return true;
-}
-
-
/* check rc file or dir exists, is read & writeable */
-bool VkConfig::checkRCEntry( QString path, Valkyrie* vk)
+bool VkConfig::checkRCEntry( QString path, Valkyrie* vk )
{
QFileInfo fi( path );
if ( !fi.exists() ) {
@@ -600,15 +572,15 @@
/* run through rc entries, checking existence/permissions and
creating them if necessary */
for ( it = entries.begin(); it != entries.end(); ++it) {
- if (!checkRCEntry(*it, vk)) {
+ if ( !checkRCEntry(*it, vk) ) {
return false;
}
}
- /* Further, check for temporary log dir (VK_LOGS_DIRP + username),
+ /* Further, check for temporary log dir (VK_TMP_DIR + username),
make if !exists */
- if ( !QFile::exists( get_VK_LOGS_DIR() ) ) {
- if ( !checkRCEntry( get_VK_LOGS_DIR(), vk) ) {
+ if ( !QFile::exists( VkConfig::vkTmpDir() ) ) {
+ if ( !checkRCEntry( VkConfig::vkTmpDir(), vk) ) {
return false;
}
}
@@ -629,24 +601,39 @@
}
-// static util functions
-QString VkConfig::vkCfgTempFilenameBegin()
+
+/*!
+ Get the log directory associated with this user
+ Just do this once, and cache the results.
+*/
+QString VkConfig::vkTmpDir()
{
- return QString(VK_CFG_TMP_DIR) + "/" + QString(VK_CFG_TEMP);
+ static QString res = QString::null;
+ if ( res.isNull() ) {
+ pid_t me = getuid();
+ struct passwd* pw = getpwuid( me );
+ vk_assert( pw );
+
+ res = QString( VK_TMP_DIR ) + QString( pw->pw_name ) + "/";
+ vk_assert( !res.isNull() );
+ }
+ return res;
}
+
+
+
+
+// static util functions
QString VkConfig::vkCfgGlblFilename()
{
- return QDir::homePath() + "/" + QString(VK_CFG_GLBL_DIR) + "/" +
- QString(VK_CFG_GLBL) + "." + QString(VK_CFG_EXT);
+ return QDir::homePath() + "/" + VK_CFG_GLBL_DIR
+ + "/" + QString(VK_CFG_GLBL) + "." + QString(VK_CFG_EXT);
}
-QString VkConfig::vkCfgMakeTempFilename()
-{
- return vk_mkstemp( VK_CFG_TEMP, VK_CFG_EXT );
-}
-
QString VkConfig::vkSuppsDir()
{
- return QString(VK_CFG_GLBL_DIR) + "/" + VK_SUPPS_DIR;
+ return QDir::homePath() + "/" + VK_CFG_GLBL_DIR
+ + "/" + QString(VK_SUPPS_DIR);
}
+
Modified: branches/valkyrie_qt4port/utils/vk_config.h
===================================================================
--- branches/valkyrie_qt4port/utils/vk_config.h 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/utils/vk_config.h 2010-02-13 00:27:22 UTC (rev 476)
@@ -3,7 +3,7 @@
** - Configuration
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -39,13 +39,19 @@
// ============================================================
-#define VK_CFG_TMP_DIR "."
-#define VK_CFG_TEMP "cfg_valkyrie_TEMP" // temporary location for 'working' config
-#define VK_CFG_GLBL_DIR ".valkyrie"
-#define VK_CFG_GLBL "cfg_valkyrie_GLBL" // static location per user
-#define VK_CFG_EXT "vk" // valkyrie configuration extension
+// Globally available object
+class VkConfig;
+extern VkConfig* vkConfig;
+// ============================================================
+#define VK_TMP_DIR "/tmp/valkyrie_" // temp vk directory. Completed by vkTmpDir()
+
+#define VK_CFG_TEMP "valkyrie_temp" // temp cfg fname (for the 'working' config)
+#define VK_CFG_GLBL_DIR ".valkyrie" // global (user) cfg/data directory
+#define VK_CFG_GLBL "valkyrie_global" // global (user) cfg fname
+#define VK_CFG_EXT "conf" // valkyrie config file extension
+
#define PACKAGE "valkyrie"
#define PACKAGE_VERSION "2.0.0-SVN"
#define PACKAGE_STRING "Valkyrie 1.4.0"
@@ -55,7 +61,6 @@
#define VK_DOC_PATH "/doc/"
#define VK_DBASE_DIR "dbase/"
#define VK_SUPPS_DIR "suppressions/"
-#define VK_LOGS_DIRP "/tmp/valkyrie_logs_"
#define VK_BIN_VALGRIND "valgrind"
#define VK_BIN_EDITOR "vi"
#define VK_COPYRIGHT "(c) 2003-2010"
@@ -73,7 +78,7 @@
VkConfig( QString& tmp_cfg );
~VkConfig();
- bool initCfg( Valkyrie* vk );
+ static void createConfig( Valkyrie* vk, VkConfig** cfg );
void createNewProject( QString& dir, QString& proj_name );
void createNewProject( QString proj_filename );
@@ -96,10 +101,9 @@
public:
// util functions
static bool strToBool( QString str );
- static QString vkCfgTempFilenameBegin();
static QString vkCfgGlblFilename();
- static QString vkCfgMakeTempFilename();
static QString vkSuppsDir();
+ static QString vkTmpDir();
#if 0
QColor rdColor( const QString &pKey );
@@ -128,7 +132,6 @@
QString vkDocPath; // path to valkyrie docs dir
// QString vgCopyright;
-
#if 0 // valkyrie cfg options -> PUT IN VK OBJECT!
QString vkCfgTempPath; // path to run-specific config dir
QString vkCfgTempFilePath; // filename for run-specific config
@@ -138,12 +141,9 @@
QString vkCfgGlobalFilePath; // filename for global config
#endif
QString vkCfgProjectFilename; // hold active project filename (may be empty)
+
+private:
+ QString vkCfgTmpDir;
};
-
-
-// ============================================================
-/* Globally available object ------------------------------------------- */
-extern VkConfig* vkConfig;
-
#endif
Modified: branches/valkyrie_qt4port/utils/vk_utils.cpp
===================================================================
--- branches/valkyrie_qt4port/utils/vk_utils.cpp 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/utils/vk_utils.cpp 2010-02-13 00:27:22 UTC (rev 476)
@@ -2,7 +2,7 @@
** Various utility functions
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -21,7 +21,6 @@
#include "utils/vk_config.h" // vkname()
#include <cstdlib> // exit, mkstemp, free/malloc, etc
-#include <pwd.h> // getpwuid
#include <QDateTime>
#include <QFile>
@@ -128,9 +127,9 @@
/* Create a unique filename, with an optional extension ---------------- */
QString vk_mkstemp( QString filepath, QString ext/*=QString::null*/ )
{
- /* create tempfiles with datetime, so can sort easily if they stay around */
+ // create tempfiles with datetime, so can sort easily if they stay around
- QString datetime = QDateTime::currentDateTime().toString( "-yyyy.MM.dd-hh.mm.ss");
+ QString datetime = QDateTime::currentDateTime().toString( "_yyyy.MM.dd_hh:mm:ss");
QString unique = filepath + datetime;
if (!ext.isNull()) unique += "." + ext;
@@ -152,24 +151,6 @@
}
-/* Get the log directory associated with this user --------------------- */
-// Just do this once, and cache the results.
-QString get_VK_LOGS_DIR ()
-{
- static QString res = QString::null;
- if ( res.isNull() ) {
- pid_t me = getuid();
- struct passwd* pw = getpwuid( me );
- /* This should never fail. Is it worth trying to continue if it
- does? I don't think so. */
- vk_assert( pw );
- res = QString( VK_LOGS_DIRP ) + QString( pw->pw_name ) + "/";
- vk_assert( !res.isNull() );
- }
- return res;
-}
-
-
/* Version check -------------------------------------------------------
Given version string of "major.minor.patch" (e.g. 3.3.0),
hex version = (major << 16) + (minor << 8) + patch
Modified: branches/valkyrie_qt4port/utils/vk_utils.h
===================================================================
--- branches/valkyrie_qt4port/utils/vk_utils.h 2010-02-13 00:03:03 UTC (rev 475)
+++ branches/valkyrie_qt4port/utils/vk_utils.h 2010-02-13 00:27:22 UTC (rev 476)
@@ -2,7 +2,7 @@
** Various utility functions
** --------------------------------------------------------------------------
**
-** Copyright (C) 2000-2009, OpenWorks LLP. All rights reserved.
+** Copyright (C) 2000-2010, OpenWorks LLP. All rights reserved.
** <in...@op...>
**
** This file is part of Valkyrie, a front-end for Valgrind.
@@ -99,9 +99,6 @@
/* create a unique filename -------------------------------------------- */
QString vk_mkstemp( QString filepath, QString ext=QString::null );
-/* Get the log directory associated with this user --------------------- */
-QString get_VK_LOGS_DIR ();
-
/* "valgrind 3.0.5" --> 0x030005 --------------------------------------- */
int strVersion2hex( QString ver_str );
|