• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • arts
 

arts

  • arts
  • message
artsmessage.cpp
1/*
2 Copyright (C) 2001 Jeff Tranter
3 tranter@kde.org
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19
20------------------------------------------------------------------------
21
22This application displays an error, warning, or informational message
23in a dialog. It is normally used by artsd in conjunction with the -m
24option. By abstracting this out of artsd, we keep it independent of
25any particular graphics toolkit.
26
27This version uses KDE. Equivalent versions could be written using Qt,
28Gnome, etc. and used instead.
29
30*/
31
32#include <tqregexp.h>
33
34#include <tdelocale.h>
35#include <tdeglobal.h>
36#include <tdeapplication.h>
37#include <tdeaboutdata.h>
38#include <tdemessagebox.h>
39#include <tdecmdlineargs.h>
40
41// command line options
42static TDECmdLineOptions options[] =
43 {
44 { "e", 0,0 },
45 { "error", I18N_NOOP("Display error message (default)"), 0 },
46 { "w", 0, 0},
47 { "warning", I18N_NOOP("Display warning message"), 0 },
48 { "i", 0, 0 },
49 { "info", I18N_NOOP("Display informational message"), 0 },
50 { "+message", I18N_NOOP("Message string to be displayed"), 0 },
51 TDECmdLineLastOption // End of options.
52 };
53
54TDEAboutData aboutData("artsmessage", I18N_NOOP("artsmessage"), "0.1",
55 I18N_NOOP("Utility to display aRts error messages"),
56 TDEAboutData::License_GPL, "(c) 2001, Jeff Tranter", 0, 0, "tranter@kde.org");
57
58int main(int argc, char **argv) {
59 aboutData.addAuthor("Jeff Tranter", 0, "tranter@kde.org");
60 TDEGlobal::locale()->setMainCatalogue("tdelibs");
61 TDECmdLineArgs::init(argc, argv, &aboutData);
62 TDECmdLineArgs::addCmdLineOptions(options);
63 TDEApplication app;
64
65 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
66 TQString msg;
67
68 // must be at least one argument
69 if (args->count() == 0) {
70 args->usage();
71 }
72
73 // build up message string from remaining arguments
74 for (int i = 0; i < args->count(); i++) {
75 if (i == 0)
76 msg = args->arg(i);
77 else
78 msg += TQString(" ") + args->arg(i);
79 }
80
81 const int notifyOptions = 0; // never activate KNotify
82 if (args->isSet("w")) {
83 KMessageBox::sorry(0, msg, i18n("Warning"), notifyOptions);
84 } else if (args->isSet("i")) {
85 TQString id = msg;
86 id.replace(TQRegExp("[\\[\\]\\s=]"), "_");
87 KMessageBox::information(0, msg, i18n("Informational"), id, notifyOptions);
88 } else {
89 KMessageBox::error(0, msg, i18n("Error"), notifyOptions);
90 }
91
92 return 0;
93}
KMessageBox::information
static void information(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, const TQString &dontShowAgainName=TQString::null, int options=Notify)
KMessageBox::error
static void error(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, int options=Notify)
KMessageBox::sorry
static void sorry(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, int options=Notify)
TDEAboutData
TDEAboutData::addAuthor
void addAuthor(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
TDEApplication
TDECmdLineArgs
TDECmdLineArgs::isSet
bool isSet(const char *option) const
TDECmdLineArgs::parsedArgs
static TDECmdLineArgs * parsedArgs(const char *id=0)
TDECmdLineArgs::addCmdLineOptions
static void addCmdLineOptions(const TDECmdLineOptions *options, const char *name=0, const char *id=0, const char *afterId=0)
TDECmdLineArgs::init
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noTDEApp=false)
TDECmdLineArgs::arg
const char * arg(int n) const
TDECmdLineArgs::count
int count() const
TDECmdLineArgs::usage
static void usage(const char *id=0)
TDEGlobal::locale
static TDELocale * locale()
I18N_NOOP
#define I18N_NOOP(x)
TDELocale::setMainCatalogue
static void setMainCatalogue(const char *catalog)
TDECmdLineOptions
tdelocale.h

arts

Skip menu "arts"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

arts

Skip menu "arts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for arts by doxygen 1.9.4
This website is maintained by Timothy Pearson.