colorwheel.cpp
Go to the documentation of this file.00001 /* 00002 For general Scribus (>=1.3.2) copyright and licensing information please refer 00003 to the COPYING file provided with the program. Following this notice may exist 00004 a copyright and/or license notice that predates the release of Scribus 1.3.2 00005 for which a new license (GPL+exception) is in place. 00006 */ 00007 00008 #include "colorwheel.h" 00009 #include "cwdialog.h" 00010 #include "scribuscore.h" 00011 00012 int colorwheel_getPluginAPIVersion() 00013 { 00014 return PLUGIN_API_VERSION; 00015 } 00016 00017 ScPlugin* colorwheel_getPlugin() 00018 { 00019 ColorWheelPlugin* plug = new ColorWheelPlugin(); 00020 Q_CHECK_PTR(plug); 00021 return plug; 00022 } 00023 00024 void colorwheel_freePlugin(ScPlugin* plugin) 00025 { 00026 ColorWheelPlugin* plug = dynamic_cast<ColorWheelPlugin*>(plugin); 00027 Q_ASSERT(plug); 00028 delete plug; 00029 } 00030 00031 ColorWheelPlugin::ColorWheelPlugin() : ScActionPlugin() 00032 { 00033 // Set action info in languageChange, so we only have to do 00034 // it in one place. 00035 languageChange(); 00036 } 00037 00038 ColorWheelPlugin::~ColorWheelPlugin() {}; 00039 00040 void ColorWheelPlugin::languageChange() 00041 { 00042 // Note that we leave the unused members unset. They'll be initialised 00043 // with their default ctors during construction. 00044 // Action name 00045 m_actionInfo.name = "ColorWheel"; 00046 // Action text for menu, including accel 00047 m_actionInfo.text = tr("&Color Wheel..."); 00048 // Menu 00049 m_actionInfo.menu = "Extras"; 00050 m_actionInfo.enabledOnStartup = false; 00051 m_actionInfo.needsNumObjects = -1; 00052 } 00053 00054 const QString ColorWheelPlugin::fullTrName() const 00055 { 00056 return QObject::tr("Color Wheel"); 00057 } 00058 00059 const ScActionPlugin::AboutData* ColorWheelPlugin::getAboutData() const 00060 { 00061 AboutData* about = new AboutData; 00062 Q_CHECK_PTR(about); 00063 about->authors = QString::fromUtf8("Petr Van\xc4\x9bk <petr@scribus.info>"); 00064 about->shortDescription = tr("Color setting helper"); 00065 about->description = tr("Color selector with color theory included."); 00066 // about->version 00067 // about->releaseDate 00068 // about->copyright 00069 about->license = "GPL"; 00070 return about; 00071 } 00072 00073 void ColorWheelPlugin::deleteAboutData(const AboutData* about) const 00074 { 00075 Q_ASSERT(about); 00076 delete about; 00077 } 00078 00080 bool ColorWheelPlugin::run(ScribusDoc* doc, QString target) 00081 { 00082 Q_ASSERT(target.isNull()); 00083 ScribusDoc* currDoc=doc; 00084 if (currDoc==0) 00085 currDoc=ScCore->primaryMainWindow()->doc; 00086 if (currDoc==0) 00087 return false; 00088 CWDialog *dlg = new CWDialog(currDoc->scMW(), currDoc, "dlg", true, 0); 00089 if (dlg) 00090 { 00091 dlg->exec(); 00092 delete dlg; 00093 return true; 00094 } 00095 else 00096 return false; 00097 }
