TDE core libraries
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

94 lines
2.4KB

  1. /*
  2. This file is part of KDE.
  3. Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include <iostream>
  18. #include <tqlayout.h>
  19. #include <tqfile.h>
  20. #include <tqtextstream.h>
  21. #include <tqlabel.h>
  22. #include <tdeaboutdata.h>
  23. #include <tdeapplication.h>
  24. #include <kdebug.h>
  25. #include <tdelocale.h>
  26. #include <tdecmdlineargs.h>
  27. #include <kprocess.h>
  28. #include <kdialog.h>
  29. #include "knewstuffgeneric.h"
  30. #include "ghns.h"
  31. using namespace std;
  32. GhnsWidget::GhnsWidget()
  33. {
  34. mWallpapers = new TDENewStuffGeneric( "kdesktop/wallpaper", this );
  35. TQBoxLayout *topLayout = new TQVBoxLayout( this );
  36. topLayout->setMargin( KDialog::marginHint() );
  37. topLayout->setSpacing( KDialog::spacingHint() );
  38. topLayout->addWidget( new TQLabel( i18n("Get hot new stuff:"), this ) );
  39. TQPushButton *button = new TQPushButton( "Wallpapers", this );
  40. topLayout->addWidget( button );
  41. connect( button, TQT_SIGNAL( clicked() ), TQT_SLOT( downloadWallpapers() ) );
  42. topLayout->addSpacing( 5 );
  43. TQBoxLayout *buttonLayout = new TQHBoxLayout( topLayout );
  44. buttonLayout->addStretch();
  45. TQPushButton *closeButton = new TQPushButton( "Close", this );
  46. buttonLayout->addWidget( closeButton );
  47. connect( closeButton, TQT_SIGNAL( clicked() ), kapp, TQT_SLOT( quit() ) );
  48. }
  49. GhnsWidget::~GhnsWidget()
  50. {
  51. delete mWallpapers;
  52. }
  53. void GhnsWidget::downloadWallpapers()
  54. {
  55. kdDebug() << "downloadWallpapers()" << endl;
  56. mWallpapers->download();
  57. }
  58. int main(int argc,char **argv)
  59. {
  60. TDEAboutData aboutData("ghns","Get Hot New Stuff","0.1");
  61. TDECmdLineArgs::init(argc,argv,&aboutData);
  62. TDEApplication app;
  63. GhnsWidget wid;
  64. app.setMainWidget( &wid );
  65. wid.show();
  66. app.exec();
  67. }
  68. #include "ghns.moc"