[Jahshaka-cvs] SF.net SVN: editopia: [97] cinesuite/cineplay-cinecode/trunk/src/widgets
Status: Beta
Brought to you by:
jahshaka
From: <tim...@us...> - 2008-03-26 16:31:30
|
Revision: 97 http://editopia.svn.sourceforge.net/editopia/?rev=97&view=rev Author: timdewhirst Date: 2008-03-26 09:31:22 -0700 (Wed, 26 Mar 2008) Log Message: ----------- cinesuite - allow .ui files to be edited in designer by providing widget plugin Modified Paths: -------------- cinesuite/cineplay-cinecode/trunk/src/widgets/combobox.cpp Added Paths: ----------- cinesuite/cineplay-cinecode/trunk/src/widgets/jahicon.xpm cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.cpp cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.h cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.pro Modified: cinesuite/cineplay-cinecode/trunk/src/widgets/combobox.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/widgets/combobox.cpp 2008-03-25 17:23:09 UTC (rev 96) +++ cinesuite/cineplay-cinecode/trunk/src/widgets/combobox.cpp 2008-03-26 16:31:22 UTC (rev 97) @@ -11,10 +11,6 @@ #include <qapplication.h> #endif -#include "utils/string_utils.hpp" - -using namespace olib::openpluginlib; - namespace jahwidgets { namespace qt3 { ComboBox::ComboBox( QWidget* parent, const char* name ) Added: cinesuite/cineplay-cinecode/trunk/src/widgets/jahicon.xpm =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/widgets/jahicon.xpm (rev 0) +++ cinesuite/cineplay-cinecode/trunk/src/widgets/jahicon.xpm 2008-03-26 16:31:22 UTC (rev 97) @@ -0,0 +1,63 @@ +/* XPM */ +const char* jahicon[] = { +/* width height num_colors chars_per_pixel */ +" 32 32 24 1", +/* colors */ +". c #020202", +"# c #0c0c0c", +"a c #141414", +"b c #1a1a1a", +"c c #222222", +"d c #2b2b2b", +"e c #343434", +"f c #3e3e3e", +"g c #505050", +"h c #525252", +"i c #5b5b5b", +"j c #656565", +"k c #6c6c6c", +"l c #747474", +"m c #7c7c7c", +"n c #848484", +"o c #8c8c8c", +"p c #949494", +"q c #9c9c9c", +"r c #a4a4a4", +"s c #acacac", +"t c #b4b4b4", +"u c #bcbcbc", +"v c #c4c4c4", +/* pixels */ +"................................", +".......hhhhhhhhhhhhhhh..........", +"..hhhhhvuuuuuushuuuuuvhhh.......", +".hvuuuuuuuuuuv.vuuuuuuuuvhh.....", +"hhhvuuuuuuuuv#suuuuuuuuuuuuh....", +"...hhjhuuuuukauuuuuuuuuuuuuuh...", +".......huuuv.suuuuuuuuuuuuuuuh..", +".....hhhhpue.vuuuuuuuuuuuuuuuuh.", +"...hhvvuvuv.duuuuuuuuuuuuuuuuuh.", +"...hhvuuuuh.avuuuuuuuuuuuuuuuuuh", +".....hhuuv...luuuuuuuuuuuuuuuuuh", +".......hhu....quuuuuvokmtvuuuuuh", +"......hhqo....#uuuul......puuuuh", +".....hvvvu.....vuuu........huvah", +"......htuu....auuuu.........vk.#", +".......huu....nuuuuf........vf.b", +"........hub..cvuuuuum......kut.h", +".........hugouuuuuuuuvrkinvuuuvh", +".........huuuuuuuuuuuuuuuuuuuuuh", +"..........huuuuuuuuuuuuuuuuuuuuh", +"..........huuuuuuuuuuuuuuuuuuuth", +"..........huuuuuuuuuuuuuuuuuuuh.", +"...........huuuuuuuuuuuuuuuuuuh.", +"...........huuuuuuuuuuuuuuuuuh..", +"............huuuuuuuuuuuuuuuuh..", +".............hhuuuuuuuuuuuuuh...", +"...............huuuuuuuuuuuuh...", +"................hhuuuuuuuuuh....", +"..................hhhvuuuuh.....", +".....................hhhhh......", +"................................", +"................................" +}; Added: cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.cpp (rev 0) +++ cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.cpp 2008-03-26 16:31:22 UTC (rev 97) @@ -0,0 +1,230 @@ +/* -*- mode: C++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */ +// jahwidgets - A widget library representation. + +// Copyright (C) 2006 Editopia Inc. +// Released under the GPL. +// For more information, see http://www.jahshaka.org. + +// Custom geometry classes, with minimal interfaces. + +#include "widgets.h" + +#include "jahicon.xpm" + +// qt +#include <qstringlist.h> +#include <qstring.h> +#include <qpixmap.h> +#include <qiconset.h> + +// widgets; add more here +#include "scrollview.hpp" +#include "timelineSlider.h" +#include "pushbutton.h" +#include "slider.h" +#include "progress.h" +#include "combobox.h" +#include "label.h" +#include "widgetStack.h" +#include "sdl_store.hpp" +#include "opengl_store.hpp" + +/// \todo move widget keys to widgets themselves... +static const QString SCROLLVIEW_KEY( "jahwidgets::qt3::ScrollView" ); +static const QString TIMELINE_SLIDER_KEY( "jahwidgets::qt3::TimelineSlider" ); +static const QString PUSHBUTTON_KEY( "jahwidgets::qt3::Pushbutton" ); +static const QString SLIDER_KEY( "jahwidgets::qt3::Slider" ); +static const QString PROGRESS_KEY( "jahwidgets::qt3::Progress" ); +static const QString COMBOBOX_KEY( "jahwidgets::qt3::ComboBox" ); +static const QString LABEL_KEY( "jahwidgets::qt3::Label" ); +static const QString WIDGETSTACK_KEY( "jahwidgets::qt3::WidgetStack" ); +static const QString SDL_STORE_KEY( "jahwidgets::qt3::sdl_store" ); +static const QString OPENGL_STORE_KEY( "jahwidgets::qt3::opengl_store" ); +static const QString JAHSHAKA_GROUP_KEY( "Jahshaka" ); + +namespace jahwidgets { namespace qt3 { + +Widgets::Widgets() +{} + +QStringList Widgets::keys() const +{ + QStringList keys_; + keys_ << SCROLLVIEW_KEY; + keys_ << TIMELINE_SLIDER_KEY; + keys_ << PUSHBUTTON_KEY; + keys_ << SLIDER_KEY; + keys_ << PROGRESS_KEY; + keys_ << COMBOBOX_KEY; + keys_ << LABEL_KEY; + keys_ << WIDGETSTACK_KEY; + keys_ << SDL_STORE_KEY; + keys_ << OPENGL_STORE_KEY; + return keys_; +} + +QWidget* Widgets::create( const QString& classname, QWidget* parent, const char* name ) +{ + if ( classname == SCROLLVIEW_KEY ) + { + return new ScrollView( parent, name ); + } + if ( classname == TIMELINE_SLIDER_KEY ) + { + return new TimelineSlider( parent, name ); + } + if ( classname == PUSHBUTTON_KEY ) + { + return new Pushbutton( parent, name ); + } + if ( classname == SLIDER_KEY ) + { + return new Slider( parent, name ); + } + if ( classname == PROGRESS_KEY ) + { + return new Progress( parent, name ); + } + if ( classname == COMBOBOX_KEY ) + { + return new ComboBox( parent, name ); + } + if ( classname == LABEL_KEY ) + { + return new Label( parent, name ); + } + if ( classname == WIDGETSTACK_KEY ) + { + return new WidgetStack( parent, name ); + } + if ( classname == SDL_STORE_KEY ) + { + return new sdl_store( parent, name ); + } + if ( classname == OPENGL_STORE_KEY ) + { + return new opengl_store( parent, name ); + } + + return NULL; +} + +QString Widgets::group( const QString& ) const +{ + return JAHSHAKA_GROUP_KEY; +} + +QIconSet Widgets::iconSet( const QString& ) const +{ + return QIconSet( QPixmap( jahicon ) ); +} + +QString Widgets::includeFile( const QString& key ) const +{ + if ( key == SCROLLVIEW_KEY ) + { + return "scrollview.hpp"; + } + if ( key == TIMELINE_SLIDER_KEY ) + { + return "timelineSlider.h"; + } + if ( key == PUSHBUTTON_KEY ) + { + return "pushbutton.h"; + } + if ( key == SLIDER_KEY ) + { + return "slider.h"; + } + if ( key == PROGRESS_KEY ) + { + return "progress.h"; + } + if ( key == COMBOBOX_KEY ) + { + return "combobox.h"; + } + if ( key == LABEL_KEY ) + { + return "label.h"; + } + if ( key == WIDGETSTACK_KEY ) + { + return "widgetStack.h"; + } + if ( key == SDL_STORE_KEY ) + { + return "sdl_store.hpp"; + } + if ( key == OPENGL_STORE_KEY ) + { + return "opengl_store.hpp"; + } + + return QString(); +} + +QString Widgets::toolTip( const QString& key ) const +{ + if ( key == SCROLLVIEW_KEY ) + { + return tr( "a scrollview" ); + } + if ( key == TIMELINE_SLIDER_KEY ) + { + return tr( "a basic timeline slider" ); + } + if ( key == PUSHBUTTON_KEY ) + { + return tr( "a pushbutton" ); + } + if ( key == SLIDER_KEY ) + { + return tr( "a slider" ); + } + if ( key == PROGRESS_KEY ) + { + return tr( "a progresss bar capable of handling doubles" ); + } + if ( key == COMBOBOX_KEY ) + { + return tr( "a combobox" ); + } + if ( key == LABEL_KEY ) + { + return tr( "a label" ); + } + if ( key == WIDGETSTACK_KEY ) + { + return tr( "a widget stack" ); + } + if ( key == SDL_STORE_KEY ) + { + return tr( "a widget acting as a oml store using SDL" ); + } + if ( key == OPENGL_STORE_KEY ) + { + return tr( "a widget acting as a oml store using OpenGL" ); + } + + return QString(); +} + +QString Widgets::whatsThis( const QString& ) const +{ + return QString(); +} + +bool Widgets::isContainer( const QString& key ) const +{ + if ( key == WIDGETSTACK_KEY ) { + return true; + } else { + return false; + } +} + +Q_EXPORT_PLUGIN( Widgets ) + +} } Added: cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.h =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.h (rev 0) +++ cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.h 2008-03-26 16:31:22 UTC (rev 97) @@ -0,0 +1,36 @@ +// jahwidgets - A widget library representation. + +// Copyright (C) 2006 Editopia Inc. +// Released under the GPL. +// For more information, see http://www.jahshaka.org. + +// Custom geometry classes, with minimal interfaces. + +#ifndef WIDGETS_H +#define WIDGETS_H + +// qt +#include <qwidgetplugin.h> + +namespace jahwidgets { namespace qt3 { + +/// container for our custom widgets so that they may +/// be used in designer +class Widgets : public QWidgetPlugin +{ +public: + Widgets(); + + QStringList keys() const; + QWidget* create( const QString &classname, QWidget* parent = 0, const char* name = 0 ); + QString group( const QString& ) const; + QIconSet iconSet( const QString& ) const; + QString includeFile( const QString& ) const; + QString toolTip( const QString& ) const; + QString whatsThis( const QString& ) const; + bool isContainer( const QString& ) const; +}; + +} } + +#endif // WIDGETS_H Added: cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.pro =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.pro (rev 0) +++ cinesuite/cineplay-cinecode/trunk/src/widgets/widgets.pro 2008-03-26 16:31:22 UTC (rev 97) @@ -0,0 +1,45 @@ +# This project file is only used when compiling the widget designer plugin +TEMPLATE = lib +TARGET = widgets +CONFIG += plugin + +include(../config.pri) +include(../olibs.pri) + +win32: DEFINES += WIDGETS_EXPORTS +mac: LIBS += -framework Carbon + +SOURCES += widgets.cpp \ + timelineSlider.cpp \ + valueFormatters.cpp \ + shader_state.cpp \ + pushbutton.cpp \ + media.cpp \ + mediaPtr.cpp \ + slider.cpp \ + histogram.cpp \ + combobox.cpp \ + widgetStack.cpp \ + sdl_store.cpp \ + opengl_store.cpp + +HEADERS += widgets.h \ + config.h \ + media.h \ + mediaPtr.h \ + timelineSlider.h \ + valueFormatters.h \ + shader_state.h \ + texture.h \ + pushbutton.h \ + slider.h \ + progress.h \ + combobox.h \ + histogram.h \ + label.h \ + widgetStack.h \ + widget_store.hpp \ + sdl_store.hpp \ + opengl_store.hpp \ + scrollview.hpp + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |