Permalink
Browse files

Change to BSD license

Remove ifdef's for KDE
general cleanup
  • Loading branch information...
1 parent 22f5568 commit 68b6ef5eed95c01a48ff7271d9f25e84d1f24653 @icefox committed Jul 6, 2009
View
@@ -0,0 +1,7 @@
+*.o
+ui_*
+moc_*
+qrc_*
+*.moc
+*.app
+Makefile
View
@@ -1,3 +1,9 @@
+3.0
+--
+Change the license to BSD
+Remove all references to KDE
+Cleanup code style and project
+
2.0
---
Project was renamed to QAutoConfig
View
@@ -0,0 +1 @@
+/** * Copyright (c) 2006-2009, Benjamin C. Meyer <ben@meyerhome.net> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */
View
82 README
@@ -1,73 +1,25 @@
-QAutoConfig 2.0 README
-Homepage: http://www.csh.rit.edu/~benjamin/programs/program.php?program=QAutoConfig
+QAutoConfig lets you add a full configure dialog to your Qt application by only writing one, twenty line function and any ui files for the dialog itself.
-Thanks for checking out QAutoConfig
+It automatically syncs GUI widgets values with values in the configuration file. It does this by matching keys and widgets that have the same name. The default values is obtained from the initial values of the widgets.
-The example application is from the Qt source example/mainwindow/application. It has been modified and been given a configure dialog. The configure dialog only "configures" itself the next time it is loaded allowing you to see a few of the gui orianted options of QAutoConfig.
-
-Check out the description.html file for a complete overview of QAutoConfig, tutorial, and API docs.
-
--Benjamin Meyer <ben at meyerhome dot net>
-
-
-To compile for Qt only on Unix
-------------
-cd lib
-qmake -o Makefile kautoconfig.pro
-make
-cd ../application
-export LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH
-qmake -o Makefile application.pro
-make
-------------
-
-To compile for Qt-Mac
-------------
-cd lib
-qmake -o Makefile kautoconfig.pro
-make
-cd ../application
-export DYLD_LIBRARY_PATH=../lib:$DYLD_LIBRARY_PATH
-qmake -o Makefile application.pro
-make
-
-To run from the finder we need to put the library in the bundle and change its linking by doing the following:
-
-mkdir application.app/Contents/Frameworks
-cp ../lib/libkautoconfig* application.app/Contents/Frameworks/
+QAutoConfigDialog handles all of the following for you:
+ - Loading the widgets with their setting values.
+ - Store the widget values when the OK or Apply buttons are pressed.
+ - Reseting the widgets when the Default button is pressed using the global defaults first and binary defaults second.
+ - Enable/Disable the Apply and Default buttons depending on if they actually do anything. (When you first pull up the dialog the Apply button is disabled because nothing has changed.)
+ - Only stores settings if the value is different from the default (binary, or global if it exists) value. Thus cleaning up the cluttered config directories.
-install_name_tool -id @executable_path/../Frameworks/libkautoconfig.1.dylib application.app/Contents/Frameworks/libkautoconfig.1.dylib
+In contrast to all of the home grown configure dialog, every application that use QAutoConfigDialog will present a constant look and feel for users:
+ - The dialog can be open without blocking the rest of the application.
+ - The caption is uniform across every application.
+ - They all have the same look (currently using KJanusWidget when compiled for KDE).
+ - All of the features from the first list help to further present a constant look and feel for the user.
-install_name_tool -change libkautoconfig.1.dylib @executable_path/../Frameworks/libkautoconfig.1.dylib application.app/Contents/MacOS/application
-
-You can now either run it via:
-application.app/Contents/MacOS/application
-or by clicking on the app in the Finder
-
-------------
+The example application is from the Qt source example/mainwindow/application. It has been modified and been given a configure dialog. The configure dialog only "configures" itself the next time it is loaded allowing you to see a few of the gui orianted options of QAutoConfig.
-To compile for KDE on Unix
+To compile the example application:
------------
-cd lib
-# These next two are renamed so that they make system wont use them over the
-# real ones
-mv kconfig.h qt_kconfig.h
-mv kdialogbase.h qt_kdialogbase.h
-qmake -o Makefile kautoconfig_kde.pro
-make
-cd ../application
-export LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH
-qmake -o Makefile application.pro
+cd example
+qmake
make
-------------
-
-To compile for Win32
-------------
-cd lib
-qmake -o Makefile kautoconfig.pro
-nmake
-cd ../application
-qmake -o Makefile application.pro
-nmake
-------------
View
@@ -0,0 +1 @@
+tst_qautoconfig
View
@@ -1,6 +1,9 @@
CONFIG += qtestlib
-QT += qt3support
include(../src/qautoconfig.pri)
INCLUDEPATH += ../src
SOURCES += tst_qautoconfig.cpp
TARGET = tst_qautoconfig
+
+win32: CONFIG += console
+mac:CONFIG -= app_bundle
+
@@ -25,28 +25,28 @@
class TestWidget : public QWidget {
Q_OBJECT
-public:
+public:
TestWidget(QWidget *parent=0);
QCheckBox *checkBox;
QSpinBox *spinBox;
- QComboBox *comboBox;
+ QComboBox *comboBox;
};
TestWidget::TestWidget(QWidget *parent) : QWidget(parent) {
checkBox = new QCheckBox(this);
checkBox->setObjectName("checkBox");
checkBox->setChecked(false);
-
- spinBox = new QSpinBox(this);
+
+ spinBox = new QSpinBox(this);
spinBox->setObjectName("spinbox");
spinBox->setRange(0,10);
spinBox->setValue(0);
-
- comboBox = new QComboBox(this);
- comboBox->setObjectName("combobox");
- comboBox->addItem("Number 1");
- comboBox->addItem("Number 2");
- comboBox->setCurrentIndex(0);
+
+ comboBox = new QComboBox(this);
+ comboBox->setObjectName("combobox");
+ comboBox->addItem("Number 1");
+ comboBox->addItem("Number 2");
+ comboBox->setCurrentIndex(0);
}
class tst_QAutoConfig : public QObject {
@@ -67,7 +67,7 @@ private slots:
void resetSettings();
void reloadSettings();
void customWidgetSignal();
- void customUserProperty();
+ void customUserProperty();
};
tst_QAutoConfig::tst_QAutoConfig()
@@ -100,28 +100,28 @@ void tst_QAutoConfig::addWidget()
QAutoConfig qautoconfig;
// don't crash
qautoconfig.addWidget(0, "General");
-
+
TestWidget testWidget;
qautoconfig.addWidget(&testWidget, "General");
// This will assert
- //qautoconfig.addWidget(&testWidget, "General");
+ //qautoconfig.addWidget(&testWidget, "General");
}
void tst_QAutoConfig::ignoreSubWidget()
{
QAutoConfig qautoconfig;
TestWidget testWidget;
// Adding the same widget should
- qautoconfig.addWidget(&testWidget, "General");
+ qautoconfig.addWidget(&testWidget, "General");
qautoconfig.ignoreSubWidget(testWidget.checkBox);
-
+
QCOMPARE(qautoconfig.retrieveSettings(), false);
QSignalSpy spy(&qautoconfig, SIGNAL(settingsChanged()));
qautoconfig.resetSettings();
testWidget.checkBox->setChecked(true);
QCOMPARE(qautoconfig.saveSettings(), false);
QCOMPARE(spy.count(), 0);
-
+
// reload and reset
}
@@ -149,20 +149,20 @@ void tst_QAutoConfig::saveSettings()
qautoconfig.addWidget(&testWidget, "General");
QCOMPARE(qautoconfig.retrieveSettings(true), false);
QCOMPARE(qautoconfig.isDefault(), true);
-
+
QSignalSpy spy(&qautoconfig, SIGNAL(settingsChanged()));
QSignalSpy spyWidget(&qautoconfig, SIGNAL(settingsChanged()));
QSignalSpy spyModified(&qautoconfig, SIGNAL(widgetModified()));
-
+
QCOMPARE(qautoconfig.saveSettings(), false);
QCOMPARE(qautoconfig.hasChanged(), false);
testWidget.checkBox->setChecked(true);
QCOMPARE(qautoconfig.hasChanged(), true);
QCOMPARE(qautoconfig.saveSettings(), true);
-
+
QCOMPARE(spy.count(), 1);
QCOMPARE(spyWidget.count(), 1);
- QCOMPARE(spyModified.count(), 1);
+ QCOMPARE(spyModified.count(), 1);
QCOMPARE(qautoconfig.hasChanged(), false);
QCOMPARE(qautoconfig.isDefault(), false);
}
@@ -175,10 +175,10 @@ void tst_QAutoConfig::resetSettings()
qautoconfig.addWidget(&testWidget, "General");
QCOMPARE(qautoconfig.retrieveSettings(), false);
QSignalSpy spyModified(&qautoconfig, SIGNAL(widgetModified()));
-
- QCOMPARE(qautoconfig.isDefault(), true);
+
+ QCOMPARE(qautoconfig.isDefault(), true);
testWidget.checkBox->setChecked(true);
- QCOMPARE(spyModified.count(), 0);
+ QCOMPARE(spyModified.count(), 0);
QCOMPARE(qautoconfig.isDefault(), false);
qautoconfig.resetSettings();
QCOMPARE(qautoconfig.isDefault(), true);
@@ -191,7 +191,7 @@ void tst_QAutoConfig::reloadSettings()
TestWidget testWidget;
qautoconfig.addWidget(&testWidget, "General");
QCOMPARE(qautoconfig.retrieveSettings(), false);
-
+
testWidget.checkBox->setChecked(true);
QCOMPARE(qautoconfig.isDefault(), false);
QCOMPARE(qautoconfig.hasChanged(), true);
@@ -207,13 +207,13 @@ void tst_QAutoConfig::customWidgetSignal()
QAutoConfig qautoconfig(&qsettings);
TestWidget testWidget;
qautoconfig.addWidget(&testWidget, "General");
- qautoconfig.addWidgetChangedSignal("QComboBox", SIGNAL(destroyed(QObject *)));
+ qautoconfig.addWidgetChangedSignal("QComboBox", SIGNAL(destroyed(QObject *)));
QSignalSpy spyModified(&qautoconfig, SIGNAL(widgetModified()));
QCOMPARE(qautoconfig.retrieveSettings(), false);
- testWidget.comboBox->setCurrentIndex(1);
- testWidget.comboBox->setItemText(0, "changed!");
- QCOMPARE(spyModified.count(), 0);
+ testWidget.comboBox->setCurrentIndex(1);
+ testWidget.comboBox->setItemText(0, "changed!");
+ QCOMPARE(spyModified.count(), 0);
}
void tst_QAutoConfig::customUserProperty()
@@ -222,14 +222,15 @@ void tst_QAutoConfig::customUserProperty()
QAutoConfig qautoconfig(&qsettings);
TestWidget testWidget;
qautoconfig.addWidget(&testWidget, "General");
- qautoconfig.setUserProperty( "QComboBox", "currentText" );
+ qautoconfig.setUserProperty( "QComboBox", "currentText" );
QCOMPARE(qautoconfig.retrieveSettings(), false);
- testWidget.comboBox->setCurrentIndex(1);
- QCOMPARE(qautoconfig.saveSettings(), true);
+ testWidget.comboBox->setCurrentIndex(1);
+ QCOMPARE(qautoconfig.saveSettings(), true);
QSettings settings;
- settings.beginGroup("General");
- QCOMPARE(settings.value("combobox").toString(), QString("Number 2"));
+ settings.beginGroup("General");
+ QCOMPARE(settings.value("combobox").toString(), QString("Number 2"));
}
+
QTEST_MAIN(tst_QAutoConfig)
#include "tst_qautoconfig.moc"
View
@@ -1,43 +0,0 @@
-Do you want to add a full fledged configure dialog to your Qt application by only writing one, twenty line function? If so than the QAutoConfig library is what you want.
-<!-- End Intro -->
-<p class="text">QAutoConfig is several classes that enables a developer to easily create a configure dialog for their applications. It automatically syncs GUI widgets values with values in the configuration file. It does this by looking for keys and widgets that have the same name. It obtains the default values from the initial values of the widgets. QAutoConfigDialog also manages all of the buttons in a normal configure dialog.
-
-<p>
-<b>Why do you want it?</b>
-<p class="text">Because QAutoConfigDialog does this, developers don't have to write any of the following code:
-<ul>
- <li>Loading the widgets with their setting values.
- <li>Store the widget values when the OK or Apply buttons are pressed.
- <li>Reseting the widgets when the Default button is pressed using the global defaults first and binary defaults second.
- <li>Disable widgets that are set immutable in the configuration.
- <li>Enable/Disable the Apply and Default buttons depending on if they actually do anything. (When you first pull up the dialog the Apply button is disabled because nothing has changed.)
- <li>Only stores settings if the value is different from the default (binary, or global if it exists) value. Thus cleaning up the cluttered config directories.
-</ul>
-In fact as far as most developers are concerned the only work they have to do to utilize the QAutoConfigDialog configure dialog is to make some QtDesigner files. You can of course use hand generated widgets with layouts also. Either way QAutoConfigDialog provides a fantastic savings in time and effort. (For some applications I have converted the binary size dropped in half!)
-<p>
-In contrast to all of the home grown configure dialog, every application that use QAutoConfigDialog will present a constant look and feel for users:
-<ul>
- <li>The dialog can be open without blocking the rest of the application.
- <li>The caption is uniform across every application.
- <li>They all have the same look (currently using KJanusWidget when compiled for KDE).
- <li>All of the features from the first list help to further present a constant look and feel for the user.
-</ul>
-
-<p>
-<b>What about KConfig_XT?</b>
-<p class="text">KConfig_XT which is part of KDE actually uses some of the same source from QAutoConfig. But KConfig_XT is much larger and without a lot of work will force you application to require KDE. KConfigXT provides the same functionality as QAutoConfig, but QAutoConfig is cross platform. If you are writing an application for KDE 3.2 or beyond and you only plan on having to work with KDE then QAutoConfig is not what you want, but for everyone else...
-
-<p>
-<b>Does QAutoConfig require KDE?</b>
-<p class="text">Nope, QAutoConfig comes in two forms. The first form takes advantage of everything in KDE. QAutoConfig will automaticly recognize all of KDE's widgets, set the caption, icon, and uses the KConfig engine. The second form of QAutoConfig links only against Qt and uses QSettings on the back end. This is done by compiling in two replacement classes which extend QSettings and QDialog and provides the needed features that are in KDE while giving the developer source compatibility. Best of all the Qt only library can be used in Windows or Mac development. Compiling the library with or without KDE support is as simple as using the different Makefiles when compiling the library.
-
-<p>
-<b>Can I use QAutoConfig in my commercial application?</b>
-<p class="text">The QAutoConfig library is licensed under the LGPL and so it can be linked to by commercial applications. GPL'd applications can link or compile in KAutoconfig. If you want to compile the classes directly into a commercial application contact me to acquire a non gpl licensed version for a small fee (support your friendly KDE developer :) ).
-
-<p>
-<b>Is there an example, tutorial or docs?</b><br>
-An example application (and source) is included with the source code. Screenshots of the configure dialog from the example application are included in the screenshots section.<br>
-A tutorial can be found <a href="tutorial/index.html">here</a><br>
-The API documentation is <a href="lib/html/index.html">here</a>.
-
View
@@ -1,15 +1,12 @@
-TEMPLATE = app
-DEPENDPATH += .
+TEMPLATE = app
+DEPENDPATH += .
INCLUDEPATH += .
-CONFIG += debug
-RESOURCES = application.qrc
+CONFIG += debug
+RESOURCES = application.qrc
include(../src/qautoconfig.pri)
# Input
SOURCES += main.cpp mainwindow.cpp
FORMS += general.ui other.ui
HEADERS += mainwindow.h
-
-DEFINES += QT_ONLY
-#QT += qt3support
Oops, something went wrong.

0 comments on commit 68b6ef5

Please sign in to comment.