[PC-BSD Commits] r736 - pcbsd/trunk/PBReg

svn at pcbsd.org svn at pcbsd.org
Mon Sep 17 03:04:26 PDT 2007


Author: tim
Date: 2007-09-17 03:04:26 -0700 (Mon, 17 Sep 2007)
New Revision: 736

Modified:
   pcbsd/trunk/PBReg/Makefile
   pcbsd/trunk/PBReg/main.cpp
Log:
Added ability to remove registry entries in PBReg.

Modified: pcbsd/trunk/PBReg/Makefile
===================================================================
--- pcbsd/trunk/PBReg/Makefile	2007-09-17 09:25:47 UTC (rev 735)
+++ pcbsd/trunk/PBReg/Makefile	2007-09-17 10:04:26 UTC (rev 736)
@@ -1,6 +1,6 @@
 #############################################################################
-# Makefile for building: PBReg
-# Generated by qmake (1.07a) (Qt 3.3.4) on: Tue Oct 18 11:12:58 2005
+# Makefile for building: /PCBSD/bin/PBReg
+# Generated by qmake (1.07a) (Qt 3.3.6) on: Mon Sep 17 10:45:26 2007
 # Project:  PBReg.pro
 # Template: app
 # Command: $(QMAKE) -o Makefile PBReg.pro
@@ -12,11 +12,11 @@
 CXX      = c++
 LEX      = flex
 YACC     = yacc
-CFLAGS   = -pipe -Wall -W -O -pipe  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
-CXXFLAGS = -pipe -Wall -W -O -pipe  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
+CFLAGS   = -pipe -Wall -W -O2 -fno-strict-aliasing -pipe  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
+CXXFLAGS = -pipe -Wall -W -O2 -fno-strict-aliasing -pipe  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
 LEXFLAGS = 
 YACCFLAGS= -d
-INCPATH  = -I/usr/local/share/qt/mkspecs/freebsd-g++ -I. -I../../../local/include -I$(QTDIR)/include -I.ui/ -I. -I.moc/
+INCPATH  = -I/usr/local/share/qt/mkspecs/freebsd-g++ -I. -I../../../../../../../../local/include -I$(QTDIR)/include -I.ui/ -I. -I.moc/
 LINK     = c++
 LFLAGS   =  -Wl,-rpath,/usr/local/lib  -Wl,-rpath,$(QTDIR)/lib -pthread
 LIBS     = $(SUBLIBS) -L/usr/local/lib -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
@@ -56,8 +56,8 @@
 OBJMOC = .obj/moc_pbreg.o
 DIST	   = PBReg.pro
 QMAKE_TARGET = PBReg
-DESTDIR  = 
-TARGET   = PBReg
+DESTDIR  = /PCBSD/bin/
+TARGET   = /PCBSD/bin/PBReg
 
 first: all
 ####### Implicit rules
@@ -84,6 +84,7 @@
 all: Makefile $(TARGET)
 
 $(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)  
+	test -d /PCBSD/bin/ || mkdir -p /PCBSD/bin/
 	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
 
 mocables: $(SRCMOC)
@@ -92,7 +93,7 @@
 $(MOC): 
 	( cd $(QTDIR)/src/moc && $(MAKE) )
 
-Makefile: PBReg.pro  /usr/local/share/qt/mkspecs/freebsd-g++/qmake.conf ../../../X11R6/lib/libqt-mt.prl
+Makefile: PBReg.pro  /usr/local/share/qt/mkspecs/freebsd-g++/qmake.conf ../../../../../../../../X11R6/lib/libqt-mt.prl
 	$(QMAKE) -o Makefile PBReg.pro
 qmake: 
 	@$(QMAKE) -o Makefile PBReg.pro
@@ -117,7 +118,7 @@
 ####### Sub-libraries
 
 distclean: clean
-	-$(DEL_FILE) $(TARGET) $(TARGET)
+	-$(DEL_FILE) /PCBSD/bin/$(TARGET) $(TARGET)
 
 
 FORCE:

Modified: pcbsd/trunk/PBReg/main.cpp
===================================================================
--- pcbsd/trunk/PBReg/main.cpp	2007-09-17 09:25:47 UTC (rev 735)
+++ pcbsd/trunk/PBReg/main.cpp	2007-09-17 10:04:26 UTC (rev 736)
@@ -1,13 +1,18 @@
-#include <iostream.h>
+#include <iostream>
 #include <qapplication.h>
 #include <qstring.h>
 #include <qsettings.h>
 #include "pbreg.h"
 
+using namespace std;
+
 void show_opts(void);
 int get_setting(QString key);
 int save_setting(QString key, QString value);
+bool removeSetting(QString key);
 
+QSettings settings;
+
 // Where to open the reg files
 //QString SettingsFile="/PCBSD/conf/Registry";
 
@@ -18,31 +23,31 @@
     QString Tmp = a.argv()[1];
   
     // Read a setting 
-    if ( Tmp == "set") {
-       if ( a.argc() != 4) {
-         return 1;
-       } else {
-         return save_setting(a.argv()[2], a.argv()[3]);
-       }
-    } else if (Tmp == "get" ) {
-       if ( a.argc() != 3) {
-         return 1;
-       } else {
-         return get_setting(a.argv()[2]);
-       }
-    } else {
+    if ( Tmp == "set")
+    {
+       if ( a.argc() != 4) return 1;
+       return save_setting(a.argv()[2], a.argv()[3]);
+    }
+    else if (Tmp == "get" )
+    {
+       if ( a.argc() != 3) return 1;
+       return get_setting(a.argv()[2]);
+    }
+    else if(Tmp == "rem")
+    {
+       if ( a.argc() != 3) return 1;
+       return removeSetting(a.argv()[2]);
+    }
+    else
+    {
       show_opts();
       return 1;
     }
-
-    return 0;
 }
 
 // Find the value for <key> and return it
 int get_setting(QString key)
 {
-
- QSettings settings;
  QString value;
  bool check = TRUE;
 
@@ -65,8 +70,6 @@
 // Set the value for <key>
 int save_setting(QString key, QString value)
 {
-
- QSettings settings;
  bool check = TRUE;
 
  //settings.insertSearchPath( QSettings::Unix, SettingsFile );
@@ -83,12 +86,18 @@
  return 0;
 }
 
+bool removeSetting(QString key)
+{
+  return settings.removeEntry(key);
+}
+
 void show_opts(void)
 {
-  cout << "PCReg Version 0.9\n--------\n" << "PBReg <command> <key> <value>\n\n"; 
+  cout << "PBReg Version 1.0\n--------\n" << "PBReg <command> <key> <value>\n\n"; 
   cout << "Commands:\n" << "  get - Gets a variable from the registry\n";
-  cout << "  set - Sets a variable specified by <value> in the registry\n\n";
+  cout << "  set - Sets a variable specified by <value> in the registry\n";
+  cout << "  rem - Removes a variable from the registry\n\n";
   cout << "Examples:\n\n" << " # PBReg get /PC-BSD/Version\n";
   cout << " # PBReg set /PC-BSD/Version 1.0\n"; 
-
+  cout << " # PBReg rem /PC-BSD/Version\n";
 }



More information about the Commits mailing list