diff options
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/CMakeLists.txt | 29 | ||||
-rw-r--r-- | src/config/main.cpp | 69 | ||||
-rw-r--r-- | src/config/mplayer-thumbnailer-config.cpp | 64 | ||||
-rw-r--r-- | src/config/mplayer-thumbnailer-config.h | 38 |
4 files changed, 200 insertions, 0 deletions
diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt new file mode 100644 index 0000000..f4a8b2d --- /dev/null +++ b/src/config/CMakeLists.txt @@ -0,0 +1,29 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/src +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### mplayer-thumbnailer-config (executable) + +tde_add_executable( ${PROJECT_NAME}-config AUTOMOC + + SOURCES + main.cpp + ${PROJECT_NAME}-config.cpp + LINK + tdecore-shared + tdeui-shared + ${PROJECT_NAME}-cfg-static + + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/src/config/main.cpp b/src/config/main.cpp new file mode 100644 index 0000000..6f637c5 --- /dev/null +++ b/src/config/main.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2006 by Marco Gulino * + * marco@kmobiletools.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include <tdeapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdelocale.h> + +#include "mplayer-thumbnailer-cfg.h" +#include "mplayer-thumbnailer-config.h" + +static const char description[] = + I18N_NOOP("MPlayerThumbnailer Configuration Utility"); + +static const char version[] = "0.1"; + +static TDECmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char **argv) +{ + TDEAboutData about("MPlayerThumbnailerConfig", I18N_NOOP("MPlayerThumbnailerConfig"), version, description, + TDEAboutData::License_GPL, "(C) 2006 Marco Gulino", 0, 0, "marco@kmobiletools.org"); + about.addAuthor( "Marco Gulino", 0, "marco@kmobiletools.org" ); + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions( options ); + TDEApplication app; + MPlayerThumbnailerConfig *mainWin = 0; + +// if (app.isRestored()) +// { +// RESTORE(MPlayerThumbnailerConfig); +// } +// else +// { + // no session.. just start up normally + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + /// @todo do something with the command line args here + + mainWin = new MPlayerThumbnailerConfig(0, "configDialog", new MPlayerThumbnailerCfg(), KDialogBase::Swallow ); + app.setMainWidget( mainWin ); + mainWin->show(); + + args->clear(); +// } + + // mainWin has WDestructiveClose flag by default, so it will delete itself. + return app.exec(); +} diff --git a/src/config/mplayer-thumbnailer-config.cpp b/src/config/mplayer-thumbnailer-config.cpp new file mode 100644 index 0000000..ee15917 --- /dev/null +++ b/src/config/mplayer-thumbnailer-config.cpp @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2006 by Marco Gulino * + * marco@kmobiletools.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "mplayer-thumbnailer-config.h" +#include <tqvbox.h> +#include <klineedit.h> +#include <kpushbutton.h> +#include <tqlabel.h> +#include <tdelocale.h> +#include <kstandarddirs.h> +#include <kdebug.h> +#include <tqtimer.h> +#include <keditlistbox.h> + +MPlayerThumbnailerConfig::MPlayerThumbnailerConfig(TQWidget *parent, const char *name, MPlayerThumbnailerCfg *config, DialogType dialogType, int dialogButtons, ButtonCode defaultButton, bool modal) + : TDEConfigDialog(parent, name, config, dialogType, dialogButtons, defaultButton, modal) +{ + TQVBox *vbox=new TQVBox(0); + vbox->setSpacing( 5); + new TQLabel(i18n("Enter here the path for mplayer executable file."), vbox); + kcfg_mplayerbin=new KLineEdit( vbox, "kcfg_mplayerbin"); + new TQLabel(i18n("Custom arguments for mplayer."), vbox); + new KLineEdit( vbox, "kcfg_customargs"); + new KEditListBox( i18n("Blacklisted File Extensions"), + vbox, "kcfg_noextensions", true, KEditListBox::Add | KEditListBox::Remove); + addPage( vbox, i18n("General"), "mplayer" ); + kdDebug() << "config->mplayerbin().isNull()::" << config->mplayerbin().length() << endl; + if(!config->mplayerbin().length() ) + TQTimer::singleShot( 100, this, SLOT(autoFindPath())); +} + +MPlayerThumbnailerConfig::~MPlayerThumbnailerConfig() +{ +} + +/*! + \fn MPlayerThumbnailerConfig::autoFindPath() + */ +void MPlayerThumbnailerConfig::autoFindPath() +{ + TQString playerPath=TDEStandardDirs::findExe("mplayer-bin"); + if(playerPath.isNull() ) playerPath=TDEStandardDirs::findExe("mplayer"); + kdDebug() << "Trying to set player path to " << playerPath << endl; + kcfg_mplayerbin->setText( playerPath ); +} + +#include "mplayer-thumbnailer-config.moc" diff --git a/src/config/mplayer-thumbnailer-config.h b/src/config/mplayer-thumbnailer-config.h new file mode 100644 index 0000000..ae786ad --- /dev/null +++ b/src/config/mplayer-thumbnailer-config.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2006 by Marco Gulino * + * marco@kmobiletools.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef _MPLAYER_THUMBNAILER_CONFIG_ +#define _MPLAYER_THUMBNAILER_CONFIG_ +#include <tdeconfigdialog.h> +#include "mplayer-thumbnailer-cfg.h" + +class KLineEdit; +class MPlayerThumbnailerConfig : public TDEConfigDialog +{ + Q_OBJECT + public: + MPlayerThumbnailerConfig(TQWidget *parent, const char *name, MPlayerThumbnailerCfg *config, DialogType dialogType=IconList, int dialogButtons=Default|Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool modal=false); + ~MPlayerThumbnailerConfig(); + private: + KLineEdit *kcfg_mplayerbin; +public slots: + void autoFindPath(); +}; + +#endif |