Interface modifications to KCmdLineArgs, KAboutData and KComponentData; BIC, SIC. Most of the depending code has been auto-converted to new API.

svn path=/trunk/KDE/kdebase/workspace/; revision=682259
This commit is contained in:
Chusslove Illich 2007-07-02 08:49:20 +00:00
parent 4497741460
commit bdb46a1769
9 changed files with 67 additions and 86 deletions

View file

@ -11,12 +11,6 @@
static const char description[] = static const char description[] =
I18N_NOOP("Installs a KWM theme"); I18N_NOOP("Installs a KWM theme");
static KCmdLineOptions options[] =
{
{ "+[file]", I18N_NOOP("Path to a theme config file"), 0 },
KCmdLineLastOption
};
void copy(const QString &src, const QString &dest) void copy(const QString &src, const QString &dest)
{ {
QFile copyInput(src); QFile copyInput(src);
@ -40,6 +34,9 @@ void copy(const QString &src, const QString &dest)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
KCmdLineArgs::init(argc, argv, "kwmtheme", description, "0.1"); KCmdLineArgs::init(argc, argv, "kwmtheme", description, "0.1");
KCmdLineOptions options;
options.add("+[file]", ki18n("Path to a theme config file"));
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KApplication app(argc, argv); KApplication app(argc, argv);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
@ -48,7 +45,7 @@ int main(int argc, char **argv)
return(1); return(1);
} }
QString srcStr = QString(QFile::decodeName(args->arg(0))); QString srcStr = QString(args->arg(0));
QFile f(srcStr); QFile f(srcStr);
QString tmpStr; QString tmpStr;

View file

@ -194,11 +194,11 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QStringList &)
// connect( cbUseMiniWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) ); // connect( cbUseMiniWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
KAboutData *about = KAboutData *about =
new KAboutData(I18N_NOOP("kcmkwindecoration"), new KAboutData(I18N_NOOP("kcmkwindecoration"), 0,
I18N_NOOP("Window Decoration Control Module"), ki18n("Window Decoration Control Module"),
0, 0, KAboutData::License_GPL, 0, KLocalizedString(), KAboutData::License_GPL,
I18N_NOOP("(c) 2001 Karol Szwed")); ki18n("(c) 2001 Karol Szwed"));
about->addAuthor("Karol Szwed", 0, "gallium@kde.org"); about->addAuthor(ki18n("Karol Szwed"), KLocalizedString(), "gallium@kde.org");
setAboutData(about); setAboutData(about);
} }

View file

@ -62,10 +62,10 @@ KWinEffectsConfig::KWinEffectsConfig(QWidget *parent, const QStringList &)
// Load config // Load config
load(); load();
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwineffects"), KAboutData *about = new KAboutData(I18N_NOOP("kcmkwineffects"), 0,
I18N_NOOP("Window Effects Configuration Module"), ki18n("Window Effects Configuration Module"),
0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 2007 Rivo Laks")); 0, KLocalizedString(), KAboutData::License_GPL, ki18n("(c) 2007 Rivo Laks"));
about->addAuthor("Rivo Laks", 0, "rivolaks@hot.ee"); about->addAuthor(ki18n("Rivo Laks"), KLocalizedString(), "rivolaks@hot.ee");
setAboutData(about); setAboutData(about);
} }

View file

@ -134,19 +134,19 @@ KWinOptions::KWinOptions(QWidget *parent, const QStringList &)
connect(mTranslucency, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool))); connect(mTranslucency, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
KAboutData *about = KAboutData *about =
new KAboutData(I18N_NOOP("kcmkwinoptions"), I18N_NOOP("Window Behavior Configuration Module"), new KAboutData(I18N_NOOP("kcmkwinoptions"), 0, ki18n("Window Behavior Configuration Module"),
0, 0, KAboutData::License_GPL, 0, KLocalizedString(), KAboutData::License_GPL,
I18N_NOOP("(c) 1997 - 2002 KWin and KControl Authors")); ki18n("(c) 1997 - 2002 KWin and KControl Authors"));
about->addAuthor("Matthias Ettrich",0,"ettrich@kde.org"); about->addAuthor(ki18n("Matthias Ettrich"),KLocalizedString(),"ettrich@kde.org");
about->addAuthor("Waldo Bastian",0,"bastian@kde.org"); about->addAuthor(ki18n("Waldo Bastian"),KLocalizedString(),"bastian@kde.org");
about->addAuthor("Cristian Tibirna",0,"tibirna@kde.org"); about->addAuthor(ki18n("Cristian Tibirna"),KLocalizedString(),"tibirna@kde.org");
about->addAuthor("Matthias Kalle Dalheimer",0,"kalle@kde.org"); about->addAuthor(ki18n("Matthias Kalle Dalheimer"),KLocalizedString(),"kalle@kde.org");
about->addAuthor("Daniel Molkentin",0,"molkentin@kde.org"); about->addAuthor(ki18n("Daniel Molkentin"),KLocalizedString(),"molkentin@kde.org");
about->addAuthor("Wynn Wilkes",0,"wynnw@caldera.com"); about->addAuthor(ki18n("Wynn Wilkes"),KLocalizedString(),"wynnw@caldera.com");
about->addAuthor("Pat Dowler",0,"dowler@pt1B1106.FSH.UVic.CA"); about->addAuthor(ki18n("Pat Dowler"),KLocalizedString(),"dowler@pt1B1106.FSH.UVic.CA");
about->addAuthor("Bernd Wuebben",0,"wuebben@kde.org"); about->addAuthor(ki18n("Bernd Wuebben"),KLocalizedString(),"wuebben@kde.org");
about->addAuthor("Matthias Hoelzer-Kluepfel",0,"hoelzer@kde.org"); about->addAuthor(ki18n("Matthias Hoelzer-Kluepfel"),KLocalizedString(),"hoelzer@kde.org");
setAboutData(about); setAboutData(about);
} }

View file

@ -46,10 +46,10 @@ KCMRules::KCMRules( QWidget *parent, const QStringList & )
widget = new KCMRulesList( this ); widget = new KCMRulesList( this );
layout->addWidget( widget ); layout->addWidget( widget );
connect( widget, SIGNAL( changed( bool )), SLOT( moduleChanged( bool ))); connect( widget, SIGNAL( changed( bool )), SLOT( moduleChanged( bool )));
KAboutData *about = new KAboutData(I18N_NOOP( "kcmkwinrules" ), KAboutData *about = new KAboutData(I18N_NOOP( "kcmkwinrules" ), 0,
I18N_NOOP( "Window-Specific Settings Configuration Module" ), ki18n( "Window-Specific Settings Configuration Module" ),
0, 0, KAboutData::License_GPL, I18N_NOOP( "(c) 2004 KWin and KControl Authors" )); 0, KLocalizedString(), KAboutData::License_GPL, ki18n( "(c) 2004 KWin and KControl Authors" ));
about->addAuthor("Lubos Lunak",0,"l.lunak@kde.org"); about->addAuthor(ki18n("Lubos Lunak"),KLocalizedString(),"l.lunak@kde.org");
setAboutData(about); setAboutData(about);
} }

View file

@ -264,20 +264,15 @@ static int edit( Window wid, bool whole_app )
} // namespace } // namespace
static const KCmdLineOptions options[] =
{
// no need for I18N_NOOP(), this is not supposed to be used directly
{ "wid <wid>", "WId of the window for special window settings.", 0 },
{ "whole-app", "Whether the settings should affect all windows of the application.", 0 },
KCmdLineLastOption
};
extern "C" extern "C"
KDE_EXPORT int kdemain( int argc, char* argv[] ) KDE_EXPORT int kdemain( int argc, char* argv[] )
{ {
KLocale::setMainCatalog( "kcmkwinrules" ); KCmdLineArgs::init( argc, argv, "kwin_rules_dialog", "kcmkwinrules", ki18n( "KWin" ), "1.0" ,
KCmdLineArgs::init( argc, argv, "kwin_rules_dialog", I18N_NOOP( "KWin" ), ki18n( "KWin helper utility" ));
I18N_NOOP( "KWin helper utility" ), "1.0" );
KCmdLineOptions options;
options.add("wid <wid>", ki18n("WId of the window for special window settings."));
options.add("whole-app", ki18n("Whether the settings should affect all windows of the application."));
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KApplication app; KApplication app;
KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
@ -287,7 +282,7 @@ KDE_EXPORT int kdemain( int argc, char* argv[] )
args->clear(); args->clear();
if( !id_ok || id == None ) if( !id_ok || id == None )
{ {
KCmdLineArgs::usage( i18n( "This helper utility is not supposed to be called directly." )); KCmdLineArgs::usageError( i18n( "This helper utility is not supposed to be called directly." ));
return 1; return 1;
} }
return KWin::edit( id, whole_app ); return KWin::edit( id, whole_app );

View file

@ -32,31 +32,26 @@ DEALINGS IN THE SOFTWARE.
#include <QProcess> #include <QProcess>
#include <signal.h> #include <signal.h>
static const KCmdLineOptions options[] =
{
// no need for I18N_NOOP(), this is not supposed to be used directly
{ "pid <pid>", "PID of the application to terminate.", 0 },
{ "hostname <hostname>", "Hostname on which the application is running.", 0 },
{ "windowname <caption>", "Caption of the window to be terminated.", 0 },
{ "applicationname <name>", "Name of the application to be terminated.", 0 },
{ "wid <id>", "ID of resource belonging to the application.", 0 },
{ "timestamp <time>", "Time of user action causing killing.", 0 },
KCmdLineLastOption
};
int main( int argc, char* argv[] ) int main( int argc, char* argv[] )
{ {
KLocale::setMainCatalog( "kwin" ); // the messages are in kwin's .po file KCmdLineArgs::init( argc, argv, "kwin_killer_helper", "kwin", ki18n( "KWin" ), "1.0" ,
KCmdLineArgs::init( argc, argv, "kwin_killer_helper", I18N_NOOP( "KWin" ), ki18n( "KWin helper utility" ));
I18N_NOOP( "KWin helper utility" ), "1.0" );
KCmdLineOptions options;
options.add("pid <pid>", ki18n("PID of the application to terminate."));
options.add("hostname <hostname>", ki18n("Hostname on which the application is running."));
options.add("windowname <caption>", ki18n("Caption of the window to be terminated."));
options.add("applicationname <name>", ki18n("Name of the application to be terminated."));
options.add("wid <id>", ki18n("ID of resource belonging to the application."));
options.add("timestamp <time>", ki18n("Time of user action causing killing."));
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KApplication app; KApplication app;
KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QByteArray hostname = args->getOption( "hostname" ); QString hostname = args->getOption( "hostname" );
bool pid_ok = false; bool pid_ok = false;
pid_t pid = QString( args->getOption( "pid" ) ).toULong( &pid_ok ); pid_t pid = QString( args->getOption( "pid" ) ).toULong( &pid_ok );
QString caption = QString::fromUtf8( args->getOption( "windowname" )); QString caption = args->getOption( "windowname" );
QString appname = QString::fromLatin1( args->getOption( "applicationname" )); QString appname = args->getOption( "applicationname" );
bool id_ok = false; bool id_ok = false;
Window id = QString( args->getOption( "wid" ) ).toULong( &id_ok ); Window id = QString( args->getOption( "wid" ) ).toULong( &id_ok );
bool time_ok = false; bool time_ok = false;
@ -65,7 +60,7 @@ int main( int argc, char* argv[] )
if( !pid_ok || pid == 0 || !id_ok || id == None || !time_ok || timestamp == CurrentTime if( !pid_ok || pid == 0 || !id_ok || id == None || !time_ok || timestamp == CurrentTime
|| hostname.isEmpty() || caption.isEmpty() || appname.isEmpty()) || hostname.isEmpty() || caption.isEmpty() || appname.isEmpty())
{ {
KCmdLineArgs::usage( i18n( "This helper utility is not supposed to be called directly." )); KCmdLineArgs::usageError( i18n( "This helper utility is not supposed to be called directly." ));
return 1; return 1;
} }
QString question = i18n( QString question = i18n(

View file

@ -185,13 +185,6 @@ static void sighandler(int)
static const char version[] = "3.0"; static const char version[] = "3.0";
static const char description[] = I18N_NOOP( "KDE window manager" ); static const char description[] = I18N_NOOP( "KDE window manager" );
static KCmdLineOptions args[] =
{
{ "lock", I18N_NOOP("Disable configuration options"), 0 },
{ "replace", I18N_NOOP("Replace already-running ICCCM2.0-compliant window manager"), 0 },
KCmdLineLastOption
};
extern "C" extern "C"
KDE_EXPORT int kdemain( int argc, char * argv[] ) KDE_EXPORT int kdemain( int argc, char * argv[] )
{ {
@ -262,15 +255,19 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
} }
} }
KAboutData aboutData( "kwin", I18N_NOOP("KWin"), KAboutData aboutData( "kwin", 0, ki18n("KWin"),
version, description, KAboutData::License_GPL, version, ki18n(description), KAboutData::License_GPL,
I18N_NOOP("(c) 1999-2005, The KDE Developers")); ki18n("(c) 1999-2005, The KDE Developers"));
aboutData.addAuthor("Matthias Ettrich",0, "ettrich@kde.org"); aboutData.addAuthor(ki18n("Matthias Ettrich"),KLocalizedString(), "ettrich@kde.org");
aboutData.addAuthor("Cristian Tibirna",0, "tibirna@kde.org"); aboutData.addAuthor(ki18n("Cristian Tibirna"),KLocalizedString(), "tibirna@kde.org");
aboutData.addAuthor("Daniel M. Duley",0, "mosfet@kde.org"); aboutData.addAuthor(ki18n("Daniel M. Duley"),KLocalizedString(), "mosfet@kde.org");
aboutData.addAuthor("Luboš Luňák", I18N_NOOP( "Maintainer" ), "l.lunak@kde.org"); aboutData.addAuthor(ki18n("Luboš Luňák"), ki18n( "Maintainer" ), "l.lunak@kde.org");
KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions args;
args.add("lock", ki18n("Disable configuration options"));
args.add("replace", ki18n("Replace already-running ICCCM2.0-compliant window manager"));
KCmdLineArgs::addCmdLineOptions( args ); KCmdLineArgs::addCmdLineOptions( args );
if (signal(SIGTERM, KWin::sighandler) == SIG_IGN) if (signal(SIGTERM, KWin::sighandler) == SIG_IGN)

View file

@ -37,14 +37,6 @@
#include "preview.h" #include "preview.h"
#include "main.h" #include "main.h"
static KCmdLineOptions options[] =
{
{ "+decoration", "Decoration library to use, such as kwin3_plastik.", 0 },
{ "+tests", "Which test should be executed ('all', 'repaint', 'caption', 'resize', 'recreation')", 0 },
{ "+repetitions", "Number of test repetitions.", 0 },
{ 0, 0, 0 }
};
DecoBenchApplication::DecoBenchApplication(const QString &library, Tests tests, int count) : DecoBenchApplication::DecoBenchApplication(const QString &library, Tests tests, int count) :
m_tests(tests), m_tests(tests),
m_count(count) m_count(count)
@ -101,8 +93,13 @@ int main(int argc, char** argv)
{ {
QString style = "keramik"; QString style = "keramik";
// KApplication app(argc, argv); // KApplication app(argc, argv);
KAboutData about("decobenchmark", "DecoBenchmark", "0.1", "kwin decoration performance tester...", KAboutData::License_LGPL, "(C) 2005 Sandro Giessl"); KAboutData about("decobenchmark", 0, ki18n("DecoBenchmark"), "0.1", ki18n("kwin decoration performance tester..."), KAboutData::License_LGPL, ki18n("(C) 2005 Sandro Giessl"));
KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+decoration", ki18n("Decoration library to use, such as kwin3_plastik."));
options.add("+tests", ki18n("Which test should be executed ('all', 'repaint', 'caption', 'resize', 'recreation')"));
options.add("+repetitions", ki18n("Number of test repetitions."));
KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs();