Ejemplo n.º 1
0
#include <kaudioplayer.h>
#endif
#endif

#include "xpm/sound.xpm"
#include "xpm/nosound.xpm"

Plugin *createSoundPlugin(unsigned base, bool bFirst, const char *config)
{
    Plugin *plugin = new SoundPlugin(base, bFirst, config);
    return plugin;
}

static PluginInfo info =
    {
        I18N_NOOP("Sound"),
        I18N_NOOP("Plugin provides sounds on any events"),
        VERSION,
        createSoundPlugin,
        PLUGIN_DEFAULT
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}

/*
typedef struct SoundData
{
#ifndef WIN32
Ejemplo n.º 2
0
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#include <kuniqueapplication.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <stdlib.h>

#include "secpolicywin.h"

static const char description[] = 
	I18N_NOOP("Display PAM security policies");

static const char version[] = "v0.0.1";


int main(int argc, char **argv)
{
  KCmdLineArgs::init(argc, argv, "secpolicy", description, version);

  if (!KUniqueApplication::start())
     exit(0);

  KUniqueApplication app;
  SecPolicyWin *spWin = new SecPolicyWin();

  app.setMainWidget(spWin);
Ejemplo n.º 3
0

#include "soundkonverterapp.h"
#include "soundkonverter.h"
#include "global.h"

#include <kdeui_export.h>
#include <KMainWindow>
#include <KUniqueApplication>
#include <KAboutData>
#include <KCmdLineArgs>
#include <KLocale>


static const char description[] =
    I18N_NOOP("soundKonverter is a frontend to various audio converters, Replay Gain tools and CD rippers.\n\nPlease file bug reports at https://github.com/dfaust/soundkonverter/issues");

static const char version[] = SOUNDKONVERTER_VERSION_STRING;

int main(int argc, char **argv)
{
    KAboutData about("soundkonverter", 0, ki18n("soundKonverter"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2005-2016 Daniel Faust"), KLocalizedString(), 0, "*****@*****.**");
    about.addAuthor( ki18n("Daniel Faust"), KLocalizedString(), "*****@*****.**" );
    about.addCredit( ki18n("David Vignoni"), ki18n("Nuvola icon theme"), 0, "http://www.icon-king.com" );
    about.addCredit( ki18n("Scott Wheeler"), ki18n("TagLib"), "*****@*****.**", "http://ktown.kde.org/~wheeler" );
    about.addCredit( ki18n("Marco Nelles"), ki18n("Audex"), 0, "http://opensource.maniatek.de/audex" );
    about.addCredit( ki18n("Amarok developers"), ki18n("Amarok"), 0, "http://amarok.kde.org" );
    about.addCredit( ki18n("All programmers of audio converters"), ki18n("Backends") );
    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    addStrategy( new BarnDoorWipeStrategy( Vertical, "vertical", false ) );
    addStrategy( new BarnDoorWipeStrategy( VerticalReverse, "vertical", true ) );
    addStrategy( new BarnDoorWipeStrategy( Horizontal, "horizontal", false ) );
    addStrategy( new BarnDoorWipeStrategy( HorizontalReverse, "horizontal", true ) );
    addStrategy( new BarnDoorWipeStrategy( DiagonalBottomLeft, "diagonalBottomLeft", false ) );
    addStrategy( new BarnDoorWipeStrategy( DiagonalBottomLeftReverse, "diagonalBottomLeft", true ) );
    addStrategy( new BarnDoorWipeStrategy( DiagonalTopLeft, "diagonalTopLeft", false ) );
    addStrategy( new BarnDoorWipeStrategy( DiagonalTopLeftReverse, "diagonalTopLeft", true ) );
}

BarnDoorWipeEffectFactory::~BarnDoorWipeEffectFactory()
{
}

static const char* s_subTypes[] = {
    I18N_NOOP( "Vertical" ),
    I18N_NOOP( "Vertical Reverse" ),
    I18N_NOOP( "Horizontal" ),
    I18N_NOOP( "Horizontal Reverse" ),
    I18N_NOOP( "Diagonal Bottom Left" ),
    I18N_NOOP( "Diagonal Bottom Left Reverse" ),
    I18N_NOOP( "Diagonal Top Left" ),
    I18N_NOOP( "Diagonal Top Left Reverse" )
};

QString BarnDoorWipeEffectFactory::subTypeName(int subType) const
{
    if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
        return i18n( s_subTypes[subType] );
    } else {
        return i18n( "Unknown subtype" );
Ejemplo n.º 5
0
namespace SIM
{

static const ext_info Countries[] =
{
    {I18N_NOOP("Afghanistan"), 93 },
    {I18N_NOOP("Albania"), 355 },
    {I18N_NOOP("Algeria"), 213 },
    {I18N_NOOP("American Samoa"), 684 },
    {I18N_NOOP("Andorra"), 376 },
    {I18N_NOOP("Angola"), 244 },
    {I18N_NOOP("Anguilla"), 101 },
    {I18N_NOOP("Antigua"), 102 },
    {I18N_NOOP("Argentina"), 54 },
    {I18N_NOOP("Armenia"), 374 },
    {I18N_NOOP("Aruba"), 297 },
    {I18N_NOOP("Ascension Island"), 247 },
    {I18N_NOOP("Australia"), 61 },
    {I18N_NOOP("Australian Antarctic Territory"), 6721 },
    {I18N_NOOP("Austria"), 43 },
    {I18N_NOOP("Azerbaijan"), 994 },
    {I18N_NOOP("Bahamas"), 103 },
    {I18N_NOOP("Bahrain"), 973 },
    {I18N_NOOP("Bangladesh"), 880 },
    {I18N_NOOP("Barbados"), 104 },
    {I18N_NOOP("Barbuda"), 120 },
    {I18N_NOOP("Belarus"), 375 },
    {I18N_NOOP("Belgium"), 32 },
    {I18N_NOOP("Belize"), 501 },
    {I18N_NOOP("Benin"), 229 },
    {I18N_NOOP("Bermuda"), 105 },
    {I18N_NOOP("Bhutan"), 975 },
    {I18N_NOOP("Bolivia"), 591 },
    {I18N_NOOP("Bosnia and Herzegovina"), 387 },
    {I18N_NOOP("Botswana"), 267 },
    {I18N_NOOP("Brazil"), 55 },
    {I18N_NOOP("British Virgin Islands"), 106 },
    {I18N_NOOP("Brunei"), 673 },
    {I18N_NOOP("Bulgaria"), 359 },
    {I18N_NOOP("Burkina Faso"), 226 },
    {I18N_NOOP("Burundi"), 257 },
    {I18N_NOOP("Cambodia"), 855 },
    {I18N_NOOP("Cameroon"), 237 },
    {I18N_NOOP("Canada"), 107 },
    {I18N_NOOP("Cape Verde Islands"), 238 },
    {I18N_NOOP("Cayman Islands"), 108 },
    {I18N_NOOP("Central African Republic"), 236 },
    {I18N_NOOP("Chad"), 235 },
    {I18N_NOOP("Chile"), 56 },
    {I18N_NOOP("China"), 86 },
    {I18N_NOOP("Christmas Island"), 672 },
    {I18N_NOOP("Cocos-Keeling Islands"), 6101 },
    {I18N_NOOP("Colombia"), 57 },
    {I18N_NOOP("Comoros"), 2691 },
    {I18N_NOOP("Congo"), 242 },
    {I18N_NOOP("Cook Islands"), 682 },
    {I18N_NOOP("Costa Rica"), 506 },
    {I18N_NOOP("Croatia"), 385 },
    {I18N_NOOP("Cuba"), 53 },
    {I18N_NOOP("Cyprus"), 357 },
    {I18N_NOOP("Czech Republic"), 420 },
    {I18N_NOOP("Denmark"), 45 },
    {I18N_NOOP("Diego Garcia"), 246 },
    {I18N_NOOP("Djibouti"), 253 },
    {I18N_NOOP("Dominica"), 109 },
    {I18N_NOOP("Dominican Republic"), 110 },
    {I18N_NOOP("Ecuador"), 593 },
    {I18N_NOOP("Egypt"), 20 },
    {I18N_NOOP("El Salvador"), 503 },
    {I18N_NOOP("Equatorial Guinea"), 240 },
    {I18N_NOOP("Eritrea"), 291 },
    {I18N_NOOP("Estonia"), 372 },
    {I18N_NOOP("Ethiopia"), 251 },
    {I18N_NOOP("Faeroe Islands"), 298 },
    {I18N_NOOP("Falkland Islands"), 500 },
    {I18N_NOOP("Fiji Islands"), 679 },
    {I18N_NOOP("Finland"), 358 },
    {I18N_NOOP("France"), 33 },
    {I18N_NOOP("French Antilles"), 5901 },
    {I18N_NOOP("French Guiana"), 594 },
    {I18N_NOOP("French Polynesia"), 689 },
    {I18N_NOOP("Gabon"), 241 },
    {I18N_NOOP("Gambia"), 220 },
    {I18N_NOOP("Georgia"), 995 },
    {I18N_NOOP("Germany"), 49 },
    {I18N_NOOP("Ghana"), 233 },
    {I18N_NOOP("Gibraltar"), 350 },
    {I18N_NOOP("Greece"), 30 },
    {I18N_NOOP("Greenland"), 299 },
    {I18N_NOOP("Grenada"), 111 },
    {I18N_NOOP("Guadeloupe"), 590 },
    {I18N_NOOP("Guam"), 671 },
    {I18N_NOOP("Guantanamo Bay"), 5399 },
    {I18N_NOOP("Guatemala"), 502 },
    {I18N_NOOP("Guinea"), 224 },
    {I18N_NOOP("Guinea-Bissau"), 245 },
    {I18N_NOOP("Guyana"), 592 },
    {I18N_NOOP("Haiti"), 509 },
    {I18N_NOOP("Honduras"), 504 },
    {I18N_NOOP("Hong Kong"), 852 },
    {I18N_NOOP("Hungary"), 36 },
    {I18N_NOOP("INMARSAT (Atlantic-East)"), 871 },
    {I18N_NOOP("INMARSAT (Atlantic-West)"), 874 },
    {I18N_NOOP("INMARSAT (Indian)"), 873 },
    {I18N_NOOP("INMARSAT (Pacific)"), 872 },
    {I18N_NOOP("INMARSAT"), 870 },
    {I18N_NOOP("Iceland"), 354 },
    {I18N_NOOP("India"), 91 },
    {I18N_NOOP("Indonesia"), 62 },
    {I18N_NOOP("International Freephone Service"), 800 },
    {I18N_NOOP("Iran"), 98 },
    {I18N_NOOP("Iraq"), 964 },
    {I18N_NOOP("Ireland"), 353 },
    {I18N_NOOP("Israel"), 972 },
    {I18N_NOOP("Italy"), 39 },
    {I18N_NOOP("Ivory Coast"), 225 },
    {I18N_NOOP("Jamaica"), 112 },
    {I18N_NOOP("Japan"), 81 },
    {I18N_NOOP("Jordan"), 962 },
    {I18N_NOOP("Kazakhstan"), 705 },
    {I18N_NOOP("Kenya"), 254 },
    {I18N_NOOP("Kiribati Republic"), 686 },
    {I18N_NOOP("Korea (North)"), 850 },
    {I18N_NOOP("Korea (Republic of)"), 82 },
    {I18N_NOOP("Kuwait"), 965 },
    {I18N_NOOP("Kyrgyz Republic"), 706 },
    {I18N_NOOP("Laos"), 856 },
    {I18N_NOOP("Latvia"), 371 },
    {I18N_NOOP("Lebanon"), 961 },
    {I18N_NOOP("Lesotho"), 266 },
    {I18N_NOOP("Liberia"), 231 },
    {I18N_NOOP("Libya"), 218 },
    {I18N_NOOP("Liechtenstein"), 4101 },
    {I18N_NOOP("Lithuania"), 370 },
    {I18N_NOOP("Luxembourg"), 352 },
    {I18N_NOOP("Macau"), 853 },
    {I18N_NOOP("Madagascar"), 261 },
    {I18N_NOOP("Malawi"), 265 },
    {I18N_NOOP("Malaysia"), 60 },
    {I18N_NOOP("Maldives"), 960 },
    {I18N_NOOP("Mali"), 223 },
    {I18N_NOOP("Malta"), 356 },
    {I18N_NOOP("Marshall Islands"), 692 },
    {I18N_NOOP("Martinique"), 596 },
    {I18N_NOOP("Mauritania"), 222 },
    {I18N_NOOP("Mauritius"), 230 },
    {I18N_NOOP("Mayotte Island"), 269 },
    {I18N_NOOP("Mexico"), 52 },
    {I18N_NOOP("Micronesia, Federated States of"), 691 },
    {I18N_NOOP("Moldova"), 373 },
    {I18N_NOOP("Monaco"), 377 },
    {I18N_NOOP("Mongolia"), 976 },
    {I18N_NOOP("Montserrat"), 113 },
    {I18N_NOOP("Morocco"), 212 },
    {I18N_NOOP("Mozambique"), 258 },
    {I18N_NOOP("Myanmar"), 95 },
    {I18N_NOOP("Namibia"), 264 },
    {I18N_NOOP("Nauru"), 674 },
    {I18N_NOOP("Nepal"), 977 },
    {I18N_NOOP("Netherlands Antilles"), 599 },
    {I18N_NOOP("Netherlands"), 31 },
    {I18N_NOOP("Nevis"), 114 },
    {I18N_NOOP("New Caledonia"), 687 },
    {I18N_NOOP("New Zealand"), 64 },
    {I18N_NOOP("Nicaragua"), 505 },
    {I18N_NOOP("Niger"), 227 },
    {I18N_NOOP("Nigeria"), 234 },
    {I18N_NOOP("Niue"), 683 },
    {I18N_NOOP("Norfolk Island"), 6722 },
    {I18N_NOOP("Norway"), 47 },
    {I18N_NOOP("Oman"), 968 },
    {I18N_NOOP("Pakistan"), 92 },
    {I18N_NOOP("Palau"), 680 },
    {I18N_NOOP("Panama"), 507 },
    {I18N_NOOP("Papua New Guinea"), 675 },
    {I18N_NOOP("Paraguay"), 595 },
    {I18N_NOOP("Peru"), 51 },
    {I18N_NOOP("Philippines"), 63 },
    {I18N_NOOP("Poland"), 48 },
    {I18N_NOOP("Portugal"), 351 },
    {I18N_NOOP("Puerto Rico"), 121 },
    {I18N_NOOP("Qatar"), 974 },
    {I18N_NOOP("Republic of Macedonia"), 389 },
    {I18N_NOOP("Reunion Island"), 262 },
    {I18N_NOOP("Romania"), 40 },
    {I18N_NOOP("Rota Island"), 6701 },
    {I18N_NOOP("Russia"), 7 },
    {I18N_NOOP("Rwanda"), 250 },
    {I18N_NOOP("Saint Lucia"), 122 },
    {I18N_NOOP("Saipan Island"), 670 },
    {I18N_NOOP("San Marino"), 378 },
    {I18N_NOOP("Sao Tome and Principe"), 239 },
    {I18N_NOOP("Saudi Arabia"), 966 },
    {I18N_NOOP("Senegal Republic"), 221 },
    {I18N_NOOP("Seychelle Islands"), 248 },
    {I18N_NOOP("Sierra Leone"), 232 },
    {I18N_NOOP("Singapore"), 65 },
    {I18N_NOOP("Slovak Republic"), 421 },
    {I18N_NOOP("Slovenia"), 386 },
    {I18N_NOOP("Solomon Islands"), 677 },
    {I18N_NOOP("Somalia"), 252 },
    {I18N_NOOP("South Africa"), 27 },
    {I18N_NOOP("Spain"), 34 },
    {I18N_NOOP("Sri Lanka"), 94 },
    {I18N_NOOP("St. Helena"), 290 },
    {I18N_NOOP("St. Kitts"), 115 },
    {I18N_NOOP("St. Pierre and Miquelon"), 508 },
    {I18N_NOOP("St. Vincent and the Grenadines"), 116 },
    {I18N_NOOP("Sudan"), 249 },
    {I18N_NOOP("Suriname"), 597 },
    {I18N_NOOP("Swaziland"), 268 },
    {I18N_NOOP("Sweden"), 46 },
    {I18N_NOOP("Switzerland"), 41 },
    {I18N_NOOP("Syria"), 963 },
    {I18N_NOOP("Taiwan, Republic of China"), 886 },
    {I18N_NOOP("Tajikistan"), 708 },
    {I18N_NOOP("Tanzania"), 255 },
    {I18N_NOOP("Thailand"), 66 },
    {I18N_NOOP("Tinian Island"), 6702 },
    {I18N_NOOP("Togo"), 228 },
    {I18N_NOOP("Tokelau"), 690 },
    {I18N_NOOP("Tonga"), 676 },
    {I18N_NOOP("Trinidad and Tobago"), 117 },
    {I18N_NOOP("Tunisia"), 216 },
    {I18N_NOOP("Turkey"), 90 },
    {I18N_NOOP("Turkmenistan"), 709 },
    {I18N_NOOP("Turks and Caicos Islands"), 118 },
    {I18N_NOOP("Tuvalu"), 688 },
    {I18N_NOOP("USA"), 1 },
    {I18N_NOOP("Uganda"), 256 },
    {I18N_NOOP("Ukraine"), 380 },
    {I18N_NOOP("United Arab Emirates"), 971 },
    {I18N_NOOP("United Kingdom"), 44 },
    {I18N_NOOP("United States Virgin Islands"), 123 },
    {I18N_NOOP("Uruguay"), 598 },
    {I18N_NOOP("Uzbekistan"), 711 },
    {I18N_NOOP("Vanuatu"), 678 },
    {I18N_NOOP("Vatican City"), 379 },
    {I18N_NOOP("Venezuela"), 58 },
    {I18N_NOOP("Vietnam"), 84 },
    {I18N_NOOP("Wallis and Futuna Islands"), 681 },
    {I18N_NOOP("Western Samoa"), 685 },
    {I18N_NOOP("Yemen"), 967 },
    {I18N_NOOP("Yugoslavia"), 381 },
    {I18N_NOOP("Zaire"), 243 },
    {I18N_NOOP("Zambia"), 260 },
    {I18N_NOOP("Zimbabwe"), 263 },
    {"", 0 },
};

EXPORT const ext_info *getCountries()
{
    return Countries;
}

static const pager_provider providers[] =
{
    { "(Brazil) Access", "email.pageacess.com.br" },
    { "(Brazil) E-Trim", "etrim.com.br" },
    { "(Canada) BC Tel Mobility", "message.bctm.com" },
    { "(Canada) Select Communication", "selectcomm.ab.ca" },
    { "(Canada) TeleLink", "ds5k.telelink.com" },
    { "(Canada) Bell Mobility", "pager.mobility.com" },
    { "(India) MessageIndia", "messageindia.com" },
    { "(India) MobiLink", "MobilinkIndia.com" },
    { "(India) PageLink", "pagelink-india.com" },
    { "(Malaysia) EasyCall", "easycall.com.my" },
    { "(Mexico) WebLink Wireless (PageMart) (Traditional)", "pagemart.net" },
    { "(Mexico) WebLink Wireless (PageMart) (Advanced)", "airmessage.net" },
    { "(Russia) F1", "pager.oryol.ru" },
    { "(Russia) FCN (Full Cry Neva)", "pager.fcn.ru" },
    { "(Russia) Multi-Page", "pager.multi-page.ru" },
    { "(Russia) Mobile Telecom", "pager.mtelecom.ru" },
    { "(Russia) Mobile Telecom (subject)", "notify.mtelecom.ru" },
    { "(Singapore) Hutchinson Paging SG", "hutch.com.sg" },
    { "(Singapore) M1", "m1.com.sg" },
    { "(Ukraine) U-Page (Eurotext)", "eurotext.kiev.ua" },
    { "(USA) Ameritech/SBC", "paging.acswireless.com" },
    { "(USA) Arch", "epage.arch.com" },
    { "(USA) AT&T", "mobile.att.net" },
    { "(USA) Infinitel", "alphame.com" },
    { "(USA) Metrocall", "page.metrocall.com" },
    { "(USA) PageNet", "pagenet.net" },
    { "(USA) ProComWireless", "page.procomwireless.com" },
    { "(USA) SkyTel/MCI", "skytel.com" },
    { "(USA) TeleBeep", "page.pnet5.com" },
    { "(USA) TeleTouch", "pageme.teletouch.com" },
    { "(USA) WebLink Wireless (PageMart) (Traditional)", "pagemart.net" },
    { "(USA) WebLink Wireless (PageMart) (Advanced)", "airmessage.net" },
    { "", "" }
};

EXPORT const pager_provider *getProviders()
{
    return providers;
}


};
Ejemplo n.º 6
0
#include <unistd.h>
#include <pwd.h>
#endif

#include <qdir.h>

Plugin *createHomeDirPlugin(unsigned base, bool, const char*)
{
    Plugin *plugin = new HomeDirPlugin(base);
    return plugin;
}

static PluginInfo info =
    {
#ifdef WIN32
        I18N_NOOP("Home directory"),
        I18N_NOOP("Plugin provides select directory for store config files"),
#else
        NULL,
        NULL,
#endif
        VERSION,
        createHomeDirPlugin,
        PLUGIN_NO_CONFIG_PATH | PLUGIN_NODISABLE
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}
Ejemplo n.º 7
0
bool MsgEdit::sendMessage(Message *msg)
{
    if (m_retry.msg){
        delete m_retry.msg;
        m_retry.msg = NULL;
    }
    if (m_msg){
        delete msg;
        Event e(EventMessageCancel, m_msg);
        if (e.process())
            m_msg = NULL;
        stopSend(false);
        return false;
    }
    bool bClose = true;
    if (CorePlugin::m_plugin->getContainerMode()){
        bClose = false;
        Command cmd;
        cmd->id		= CmdSendClose;
        cmd->param	= this;
        Event e(EventCommandWidget, cmd);
        QToolButton *btnClose = (QToolButton*)(e.process());
        if (btnClose)
            bClose = btnClose->isOn();
    }
    CorePlugin::m_plugin->setCloseSend(bClose);

    Contact *contact = getContacts()->contact(m_userWnd->id());
    if (contact){
        TranslitUserData *data = (TranslitUserData*)(contact->getUserData(CorePlugin::m_plugin->translit_data_id));
        if (data && data->Translit.bValue)
            msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT);
    }

    msg->setFlags(msg->getFlags() | m_flags);
    m_flags = 0;

    if (m_userWnd->m_list){
        multiply = m_userWnd->m_list->selected;
        if (multiply.empty())
            return false;
        multiply_it = multiply.begin();
        msg->setContact(*multiply_it);
        msg->setClient(NULL);
        ++multiply_it;
        if (multiply_it != multiply.end())
            msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY);
    }else if (!m_resource.isEmpty()){
        void *data = NULL;
        Client *c = client(data, true, false, msg->contact(), true);
        if (c){
            string resources = c->resources(data);
            while (!resources.empty()){
                string res = getToken(resources, ';');
                getToken(res, ',');
                if (m_resource == QString::fromUtf8(res.c_str())){
                    msg->setResource(m_resource);
                    break;
                }
            }
        }
    }

    editLostFocus();
    Command cmd;
    cmd->id		= CmdSend;
    cmd->text	= I18N_NOOP("Cancel");
    cmd->icon	= "cancel";
    cmd->flags	= BTN_PICT;
    cmd->param	= this;
    Event eCmd(EventCommandChange, cmd);
    eCmd.process();
    m_msg = msg;
    return send();
}
Ejemplo n.º 8
0
    shape.moveTo(0, -25);
    shape.lineTo(25, 0);
    shape.lineTo(0, 25);
    shape.lineTo(-25, 0);
    shape.closeSubpath();
    addStrategy(new SCIrisWipeEffectStrategyBase(shape, Diamond, "irisWipe", "diamond", false));

    //diamond reverse
    addStrategy(new SCIrisWipeEffectStrategyBase(shape, DiamondReverse, "irisWipe", "diamond", true));
}

SCIrisWipeEffectFactory::~SCIrisWipeEffectFactory()
{
}

static const char* s_subTypes[] = {
    I18N_NOOP("Rectangular"),
    I18N_NOOP("Rectangular Reverse"),
    I18N_NOOP("Diamond"),
    I18N_NOOP("Diamond Reverse")
};

QString SCIrisWipeEffectFactory::subTypeName(int subType) const
{
    if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
        return i18n(s_subTypes[subType]);
    } else {
        return i18n("Unknown subtype");
    }
}
Ejemplo n.º 9
0
    //horizontal
    shape = QPainterPath();
    shape.moveTo(-12, 0);
    shape.quadTo(0, 10, 12, 0);
    shape.quadTo(0, -10, -12, 0);
    addStrategy(new SCIrisWipeEffectStrategyBase(shape, Horizontal, "eyeWipe", "horizontal", false));

    //horizontal reverse
    addStrategy(new SCIrisWipeEffectStrategyBase(shape, HorizontalReverse, "eyeWipe", "horizontal", true));
}

SCEyeWipeEffectFactory::~SCEyeWipeEffectFactory()
{
}

static const char* s_subTypes[] = {
    I18N_NOOP("Vertical"),
    I18N_NOOP("Vertical Reverse"),
    I18N_NOOP("Horizontal"),
    I18N_NOOP("Horizontal Reverse"),
};

QString SCEyeWipeEffectFactory::subTypeName(int subType) const
{
    if (subType >= 0 && (uint)subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
        return i18n(s_subTypes[subType]);
    } else {
        return i18n("Unknown subtype");
    }
}
Ejemplo n.º 10
0
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include "cameroa.h"

// Inclusions pour la camera
//
#include "Apogee.h"
#include "ApnCamera.h"
#include "SimulateurApogee.h"


// Declarations
//

static const char description[] = I18N_NOOP("A KDE KPart Application");
static const char version[] = "1.0";

// Liste des options supportees par la ligne de commande
//
enum ArgumentsApplication {
	CheminRepCamerOA,
	CheminFichCertCA_OA,
	CheminFichCertServCamerOA,
	CheminFichClePriveeServCamerOA,
	CheminFichParamDH,
	MdpClePriveeServeur,
	AdresseClientAutorise,
	PortCanalCommandes,
	PortCanalDonnees,
	ArretSysteme
Ejemplo n.º 11
0
// Fonction principale de l'application
//
int main(int argc, char **argv)
{
	int lancement=true;			// Drapeau pour savoir si on doit lancer l'application
	int ArretSystemeEnQuittant=false;	// Drapeau pour le lancement de l'arret du systeme en quittant l'application
	int retour=0;				// Valeur de retour de la fin de l'application
	
	// Renseignements KDE
	//
	KAboutData about("cameroa", I18N_NOOP("CamerOA"), version, description,KAboutData::License_GPL, "(C) 2006 David Romeuf", 0, 0, "*****@*****.**");
	about.addAuthor( "David Romeuf", 0, "*****@*****.**" );
	
	
	// Initialisation des options de la ligne de commande (avec les Qt et KDE specifiques)
	//
	KCmdLineArgs::init(argc, argv, &about);
	
	// Ajout des options possibles sur la ligne de commande supportees par l'application
	//
	KCmdLineArgs::addCmdLineOptions(options);
	
	// Acces aux arguments reconnus par l'application
	//
	KCmdLineArgs *arguments=KCmdLineArgs::parsedArgs();
	
	// On test la validite des arguments
	//
	if( !QDir(arguments->getOption(OptionsLC[CheminRepCamerOA])).exists() )
	{
		std::cerr << "CamerOA: ERREUR: Le repertoire " << arguments->getOption(OptionsLC[CheminRepCamerOA]) << " n'existe pas." << std::endl;
		lancement=false;
	}
	
	struct in_addr AdresseClient;
	
	if( !inet_aton(arguments->getOption(OptionsLC[AdresseClientAutorise]),&AdresseClient) )
	{
		std::cerr << "CamerOA: ERREUR: L'adresse du client autorise " << arguments->getOption(OptionsLC[AdresseClientAutorise]) << "est invalide." << std::endl;
		lancement=false;
	}
	AdresseClient.s_addr=ntohl(AdresseClient.s_addr);
	
	if( QString(arguments->getOption(OptionsLC[ArretSysteme])) == QString("o") ) ArretSystemeEnQuittant=true;
	
	
	if( lancement )
	{
		// Instanciation de l'objet camera :
		//
		// ApnCamera.cpp contient le code de la classe CApnCamera definit dans ApnCamera.h commun
		//  a toutes les versions d'interfaces peripheriques (USB, Ethernet). Aucun code n'est
		//  specialise USB/Linux.
		//
		// ApnCamera_USB.cpp contient le code de la classe CApnCamera definit dans ApnCamera.h
		//  specialise pour la version USB (par exemple la methode InitDriver() qui n'est pas
		//  codee dans ApnCamera.cpp).
		//
		// ApogeeUsbLinux.cpp contient toutes les fonctions de communication via USB pour Linux
		//  utilisees par l'objet CApnCamera (par exemple : ApnUsbOpen() qui recherche les
		//  peripheriques par Id vendeur, ApnUsbClose()).
		//
#ifndef _SIMULATEUR_APOGEE
		CameraCCD=new CApnCamera();
#else
		CameraCCD=new SimulateurApogeeUSB(false);
#endif

		// Initialisation du systeme de la camera et test de communication USB
		//
		// Le numero de camera est celui trouve par ordre d'Id vendeur Apogee en scannant tous
		//  les bus USB.
		//
		if( !CameraCCD->InitDriver(NumeroCamera,0,0) )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'initialiser le systeme de la camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		// Reinitialisation complete du systeme de la camera et permission du flushing (vidage)
		//  FPGA_BIT_CMD_FLUSH
		//
		if( !CameraCCD->ResetSystem() )
		{
			std::cout << "CamerOA: ERREUR: Impossible de reinitialiser le systeme de la camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		// Recuperation des informations de la camera (version Linux speciale dans
		//  ApnCamera_Linux.cpp)
		//
		CameraCCD->sensorInfo();

		// Mode de fonctionnement de la camera
		//
		CameraCCD->write_CameraMode(Apn_CameraMode_Normal);

		// Parametrage du mode des diodes LED sur la camera
		//
		//  Apn_LedMode_DisableAll, Apn_LedMode_DisableWhileExpose, Apn_LedMode_EnableAll
		//
		CameraCCD->write_LedMode(Apn_LedMode_EnableAll);

		// Puissance lumineuse des diodes LED
		//
		CameraCCD->write_TestLedBrightness(100.0);

		// Fonction de la LED A
		//
		CameraCCD->write_LedState(0,Apn_LedState_Flushing);

		// Fonction de la LED B
		//
		CameraCCD->write_LedState(1,Apn_LedState_ImageActive);

		// Allocation memoire des buffers pixels physiques pour cette camera
		//
		// Il s'agit du nombre de pixels physiques et pas surface image du capteur pour avoir de la marge
		//
		if( (BufferPixelsPhysiquesImage=new (std::nothrow) unsigned short[CameraCCD->m_TotalRows*CameraCCD->m_TotalColumns]) == NULL )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'allouer le buffer pixels physiques image pour cette camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		if( (BufferPixelsPhysiquesVidage=new (std::nothrow) unsigned short[CameraCCD->m_TotalRows*CameraCCD->m_TotalColumns]) == NULL )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'allouer le buffer pixels physiques vidage pour cette camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		if( (BufferPixelsPhysiquesCentrage=new (std::nothrow) unsigned short[CameraCCD->m_TotalRows*CameraCCD->m_TotalColumns]) == NULL )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'allouer le buffer pixels physiques centrage pour cette camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		// Allocation memoire du buffer pixels d'une pose de centrage horizontal
		//
		if( (BufferPixelsPCH=new (std::nothrow) unsigned short[NB_LIGNES_POSE_CENTRAGE*CameraCCD->m_ImagingColumns/BINNING_POSE_CENTRAGE]) == NULL )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'allouer le buffer pixels d'une pose de centrage horizontal pour cette camera." << std::endl;
			exit(EXIT_FAILURE);
		}

		// Allocation memoire du buffer pixels d'une pose de centrage vertical
		//
		if( (BufferPixelsPCV=new (std::nothrow) unsigned short[NB_COLONNES_POSE_CENTRAGE*CameraCCD->m_ImagingRows/BINNING_POSE_CENTRAGE]) == NULL )
		{
			std::cout << "CamerOA: ERREUR: Impossible d'allouer le buffer pixels d'une pose de centrage vertical pour cette camera." << std::endl;
			exit(EXIT_FAILURE);
		}


		// Creation d'un objet application KDE
		//
		KApplication appli;
		
		// Pointeur sur un objet de fenetre principale KDE
		//
		CamerOA *FenetrePrincipale=0;		// Pointeur sur objet fenetre principale de notre application

		// Instanciation du processus leger de controle de la camera
		//
		// ATTENTION: On le fait avant la fenetre principale car celle-ci a besoin d'un pointeur
		//  vers le thread de controle de la camera
		//
		ProcessusLegerControleCamera PLCamera;

		// Si l'application est restauree par le gestionnaire de session
		//
		if( appli.isRestored() )
		{
			// On restaure l'application a l'aide de l'objet de configuration de la session sauve lors de la fermeture de session
			//
			RESTORE(CamerOA(arguments->getOption(OptionsLC[CheminRepCamerOA]),&appli,&PLCamera));
		}
		else
		{
			// Pas de restauration de session donc on demarre l'application normalement
			//
			
			// Creation de l'objet fenetre principale de l'application
			//
			if( (FenetrePrincipale=new (std::nothrow) CamerOA(arguments->getOption(OptionsLC[CheminRepCamerOA]),&appli,&PLCamera)) == NULL )
			{
    				std::cerr << "CamerOA: ERREUR: Impossible de creer la fenetre principale KMainWindow de l'application." << std::endl;
					appli.exit(-1);
			}

			// Le processus leger de controle de la camera contient un pointeur vers la fenetre
			//   principale de l'application
			//
			// ATTENTION: Il faut le placer immediatement apres la creation de la fenetre 
			//  principale de l'application car le thread utilise ses methodes
			//
			PLCamera.FPCamerOA=FenetrePrincipale;

			// On fixe la fenetre principale pour l'objet application KDE
			//
			appli.setMainWidget(FenetrePrincipale);
		
			// On fixe quelques proprietes de la fenetre principale heritees de QWidget
			//
			FenetrePrincipale->setMinimumSize(QSize(TAILLE_X_BASE_CAMEROA,TAILLE_Y_BASE_CAMEROA));
		
			// Chargement des consignes sauvegardees
			//
			if( !FenetrePrincipale->ChargeConsignes() ) exit(EXIT_FAILURE);
		}
		
		// Lancement du processus leger serveur reseau des commandes sur le CamerOA
		//
		ProcessusLegerServeurCommandes PLServeurCommandes(FenetrePrincipale,INADDR_ANY,QString(arguments->getOption(OptionsLC[PortCanalCommandes])).toInt(),AdresseClient.s_addr,2,TIMEOUT_EMISSION,TIMEOUT_RECEPTION,5,FnHandlerSIGPIPECamerOA,arguments->getOption(OptionsLC[MdpClePriveeServeur]),MotDePasseClePriveeServeurCAMEROA,FnMotDePasseClePriveeChiffreeCAMEROA,arguments->getOption(OptionsLC[CheminFichCertCA_OA]),arguments->getOption(OptionsLC[CheminFichCertServCamerOA]),arguments->getOption(OptionsLC[CheminFichClePriveeServCamerOA]),arguments->getOption(OptionsLC[CheminFichParamDH]),"HIGH");

		FenetrePrincipale->PLServeurCommandes=&PLServeurCommandes;
		
		PLServeurCommandes.start();
		
		// Lancement du processus leger serveur reseau des donnees sur le CamerOA
		//
		ProcessusLegerServeurDonnees PLServeurDonnees(FenetrePrincipale,INADDR_ANY,QString(arguments->getOption(OptionsLC[PortCanalDonnees])).toInt(),AdresseClient.s_addr,2,TIMEOUT_EMISSION,TIMEOUT_RECEPTION);

		FenetrePrincipale->PLServeurDonnees=&PLServeurDonnees;
		
		PLServeurDonnees.start();
		
		// Les pointeurs entre les processus
		//
		PLServeurCommandes.threadCanalDonnees=&PLServeurDonnees;
		PLServeurCommandes.threadCamera=&PLCamera;
		
		// Lancement du processus leger de controle de la camera
		//
		PLCamera.start();
		
		// Tant que les threads ne sont pas tous lances et operationnels
		//
		while( SemaphoreSyncLancementThreadCamerOA.available() > 0 );
		
		// On affiche la fenetre principale
		//
		FenetrePrincipale->show();
		
		// Demarrage du timer une fois que tout est lance et affiche
		//
		FenetrePrincipale->Pulsar1s->start(1000,FALSE);
		
		
		// FenetrePrincipale a un drapeau WDestructiveClose par defaut, elle se detruira elle meme.
		//
		retour=appli.exec();


		//	On demande l'arret des processus legers
		//
		if( PLServeurCommandes.running() )
		{
			PLServeurCommandes.DemandeTerminaison();
		}

		if( PLServeurDonnees.running() )
		{
			PLServeurDonnees.DemandeTerminaison();
		}

		if( PLCamera.running() )
		{
			PLCamera.DemandeTerminaison();
		}

		// Si le processus leger de controle de la camera tourne encore
		//  on attend la terminaison propre par lui meme
		//
		while( PLCamera.running() );
		PLCamera.wait(TEMPS_ATTENTE_TERMINAISON_PROCESSUS_LEGER);

		// Fermeture de la communication USB avec la camera
		//
		CameraCCD->write_ForceShutterOpen(false);
		CameraCCD->ResetSystem();
		usleep(1000000);
		CameraCCD->CloseDriver();
		
		// On attend la terminaison du processus leger avant de retourner la valeur
		//
		PLServeurCommandes.wait(TEMPS_ATTENTE_TERMINAISON_PROCESSUS_SERVEUR);

		// On attend la terminaison du processus leger avant de retourner la valeur
		//
		PLServeurDonnees.wait(TEMPS_ATTENTE_TERMINAISON_PROCESSUS_SERVEUR);

		
		// On lave la liste des options et arguments de la ligne de commande de l'application
		//
		arguments->clear();
		
		
		// Destruction de l'objet camera
		//
		delete CameraCCD;
		
		
		// Liberation de la memoire utilisee pour la gestion de la camera
		//
		delete [] BufferPixelsPhysiquesImage;
		delete [] BufferPixelsPhysiquesVidage;
		delete [] BufferPixelsPhysiquesCentrage;
		delete [] BufferPixelsPCH;
		delete [] BufferPixelsPCV;


		// Si on a demande l'arret du systeme en quittant l'application CamerOA
		//
		if( ArretSystemeEnQuittant )
		{
			std::cout << "Lancement de la demande de l'arret du systeme dans 60 secondes." << std::endl;
			
			// On utilise la commande propre du systeme via la commande sudo
			//
			// Il faut installer l'utilitaire sudo et configurer /etc/sudoers avec la ligne :
			//
			//  dromeuf cameroa-1=NOPASSWD: /sbin/halt
			//	observateur cameroa-1=NOPASSWD: /sbin/halt
			//
			//  qui permet par exemple a l'utilisateur dromeuf depuis la machine jedi, sans mot de passe,
			//   de lancer la commande /sbin/halt
			//
			system("/bin/sync ; /bin/sleep 60s ; /usr/bin/sudo /sbin/halt");
		}

		// Resultat de l'execution de la QApplication heritee par KApplication
		//
		return retour;
	}
}
Ejemplo n.º 12
0
#include <kwin.h>
#endif

Plugin *createOnTopPlugin(unsigned base, bool, const char *config)
{
#if defined(WIN32) || defined(USE_KDE)
    Plugin *plugin = new OnTopPlugin(base, config);
    return plugin;
#else
	return NULL;
#endif
}

static PluginInfo info =
    {
        I18N_NOOP("On Top"),
        I18N_NOOP("Plugin provides main window and containers allways on top"),
        VERSION,
        createOnTopPlugin,
        PLUGIN_DEFAULT
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}

/*
typedef struct OnTopData
{
    bool OnTop;
Ejemplo n.º 13
0
namespace KStdAccel {

struct KStdAccelInfo
{
    StdAccel id;
    const char *psName;
    const char *psDesc;
    int cutDefault, cutDefault4, cutDefault3B, cutDefault4B;
    KShortcut cut;
    bool bInitialized;
};

/** Array of predefined KStdAccelInfo objects, which cover all
    the "standard" accelerators. Each enum value from StdAccel
    should appear in this table.
*/
static KStdAccelInfo g_infoStdAccel[] = {
    {AccelNone, "Group:File", I18N_NOOP("File"), 0, 0, 0, 0, KShortcut(), false},
    {Open, I18N_NOOP("Open"), 0, Qt::CTRL + Qt::Key_O, 0, 0, 0, KShortcut(), false},
    {New, I18N_NOOP("New"), 0, Qt::CTRL + Qt::Key_N, 0, 0, 0, KShortcut(), false},
    {Close, I18N_NOOP("Close"), 0, Qt::CTRL + Qt::Key_W, Qt::CTRL + Qt::Key_Escape, 0, Qt::CTRL + Qt::Key_W, KShortcut(), false},
    {Save, I18N_NOOP("Save"), 0, Qt::CTRL + Qt::Key_S, 0, 0, 0, KShortcut(), false},
    {Print, I18N_NOOP("Print"), 0, Qt::CTRL + Qt::Key_P, 0, 0, 0, KShortcut(), false},
    {Quit, I18N_NOOP("Quit"), 0, Qt::CTRL + Qt::Key_Q, 0, 0, 0, KShortcut(), false},
    {AccelNone, "Group:Edit", I18N_NOOP("Edit"), 0, 0, 0, 0, KShortcut(), false},
    {Undo, I18N_NOOP("Undo"), 0, Qt::CTRL + Qt::Key_Z, 0, 0, 0, KShortcut(), false},
    {Redo, I18N_NOOP("Redo"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Z, 0, 0, 0, KShortcut(), false},
    {Cut, I18N_NOOP("Cut"), 0, Qt::CTRL + Qt::Key_X, 0, Qt::SHIFT + Qt::Key_Delete, 0, KShortcut(), false},
    {Copy, I18N_NOOP("Copy"), 0, Qt::CTRL + Qt::Key_C, 0, Qt::CTRL + Qt::Key_Insert, 0, KShortcut(), false},
    {Paste, I18N_NOOP("Paste"), 0, Qt::CTRL + Qt::Key_V, 0, Qt::SHIFT + Qt::Key_Insert, 0, KShortcut(), false},
    {PasteSelection, I18N_NOOP("Paste Selection"), 0, 0, 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Insert, 0, KShortcut(), false},
    {SelectAll, "SelectAll", I18N_NOOP("Select All"), Qt::CTRL + Qt::Key_A, 0, 0, 0, KShortcut(), false},
    {Deselect, I18N_NOOP("Deselect"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_A, 0, 0, 0, KShortcut(), false},
    {DeleteWordBack, "DeleteWordBack", I18N_NOOP("Delete Word Backwards"), Qt::CTRL + Qt::Key_Backspace, 0, 0, 0, KShortcut(), false},
    {DeleteWordForward, "DeleteWordForward", I18N_NOOP("Delete Word Forward"), Qt::CTRL + Qt::Key_Delete, 0, 0, 0, KShortcut(), false},
    {Find, I18N_NOOP("Find"), 0, Qt::CTRL + Qt::Key_F, 0, 0, 0, KShortcut(), false},
    {FindNext, "FindNext", I18N_NOOP("Find Next"), Qt::Key_F3, 0, 0, 0, KShortcut(), false},
    {FindPrev, "FindPrev", I18N_NOOP("Find Prev"), Qt::SHIFT + Qt::Key_F3, 0, 0, 0, KShortcut(), false},
    {Replace, I18N_NOOP("Replace"), 0, Qt::CTRL + Qt::Key_R, 0, 0, 0, KShortcut(), false},
    {AccelNone, "Group:Navigation", I18N_NOOP("Navigation"), 0, 0, 0, 0, KShortcut(), false},
    {Home, I18N_NOOP2("Opposite to End", "Home"), 0, Qt::CTRL + Qt::Key_Home, 0, Qt::Key_HomePage, 0, KShortcut(), false},
    {End, I18N_NOOP("End"), 0, Qt::CTRL + Qt::Key_End, 0, 0, 0, KShortcut(), false},
    {BeginningOfLine, "BeginningOfLine", I18N_NOOP("Beginning of Line"), Qt::Key_Home, 0, 0, 0, KShortcut(), false},
    {EndOfLine, "EndOfLine", I18N_NOOP("End of Line"), Qt::Key_End, 0, 0, 0, KShortcut(), false},
    {Prior, I18N_NOOP("Prior"), 0, Qt::Key_Prior, 0, 0, 0, KShortcut(), false},
    {Next, I18N_NOOP2("Opposite to Prior", "Next"), 0, Qt::Key_Next, 0, 0, 0, KShortcut(), false},
    {GotoLine, "GotoLine", I18N_NOOP("Go to Line"), Qt::CTRL + Qt::Key_G, 0, 0, 0, KShortcut(), false},
    {AddBookmark, "AddBookmark", I18N_NOOP("Add Bookmark"), Qt::CTRL + Qt::Key_B, 0, 0, 0, KShortcut(), false},
    {ZoomIn, "ZoomIn", I18N_NOOP("Zoom In"), Qt::CTRL + Qt::Key_Plus, 0, 0, 0, KShortcut(), false},
    {ZoomOut, "ZoomOut", I18N_NOOP("Zoom Out"), Qt::CTRL + Qt::Key_Minus, 0, 0, 0, KShortcut(), false},
    {Up, I18N_NOOP("Up"), 0, Qt::ALT + Qt::Key_Up, 0, 0, 0, KShortcut(), false},
    {Back, I18N_NOOP("Back"), 0, Qt::ALT + Qt::Key_Left, 0, Qt::Key_Back, 0, KShortcut(), false},
    {Forward, I18N_NOOP("Forward"), 0, Qt::ALT + Qt::Key_Right, 0, Qt::Key_Forward, 0, KShortcut(), false},
    {Reload, I18N_NOOP("Reload"), 0, Qt::Key_F5, 0, Qt::Key_Refresh, 0, KShortcut(), false},
    {PopupMenuContext, "PopupMenuContext", I18N_NOOP("Popup Menu Context"), Qt::Key_Menu, 0, 0, 0, KShortcut(), false},
    {ShowMenubar, "ShowMenubar", I18N_NOOP("Show Menu Bar"), Qt::CTRL + Qt::Key_M, 0, 0, 0, KShortcut(), false},
    {BackwardWord, "BackwardWord", I18N_NOOP("Backward Word"), Qt::CTRL + Qt::Key_Left, 0, 0, 0, KShortcut(), false},
    {ForwardWord, "ForwardWord", I18N_NOOP("Forward Word"), Qt::CTRL + Qt::Key_Right, 0, 0, 0, KShortcut(), false},
    {TabNext, I18N_NOOP("Activate Next Tab"), 0, Qt::CTRL + Qt::Key_Period, 0, Qt::CTRL + Qt::Key_BracketRight, 0, KShortcut(), false},
    {TabPrev, I18N_NOOP("Activate Previous Tab"), 0, Qt::CTRL + Qt::Key_Comma, 0, Qt::CTRL + Qt::Key_BracketLeft, 0, KShortcut(), false},
    {FullScreen, "FullScreen", I18N_NOOP("Full Screen Mode"), Qt::CTRL + Qt::SHIFT + Qt::Key_F, 0, 0, 0, KShortcut(), false},
    {AccelNone, "Group:Help", I18N_NOOP("Help"), 0, 0, 0, 0, KShortcut(), false},
    {Help, I18N_NOOP("Help"), 0, Qt::Key_F1, 0, 0, 0, KShortcut(), false},
    {WhatsThis, "WhatsThis", I18N_NOOP("What's This"), Qt::SHIFT + Qt::Key_F1, 0, 0, 0, KShortcut(), false},
    {AccelNone, "Group:TextCompletion", I18N_NOOP("Text Completion"), 0, 0, 0, 0, KShortcut(), false},
    {TextCompletion, "TextCompletion", I18N_NOOP("Text Completion"), Qt::CTRL + Qt::Key_E, 0, 0, 0, KShortcut(), false},
    {PrevCompletion, "PrevCompletion", I18N_NOOP("Previous Completion Match"), Qt::CTRL + Qt::Key_Up, 0, 0, 0, KShortcut(), false},
    {NextCompletion, "NextCompletion", I18N_NOOP("Next Completion Match"), Qt::CTRL + Qt::Key_Down, 0, 0, 0, KShortcut(), false},
    {SubstringCompletion, "SubstringCompletion", I18N_NOOP("Substring Completion"), Qt::CTRL + Qt::Key_T, 0, 0, 0, KShortcut(), false},
    {RotateUp, "RotateUp", I18N_NOOP("Previous Item in List"), Qt::Key_Up, 0, 0, 0, KShortcut(), false},
    {RotateDown, "RotateDown", I18N_NOOP("Next Item in List"), Qt::Key_Down, 0, 0, 0, KShortcut(), false},
    {AccelNone, 0, 0, 0, 0, 0, 0, KShortcut(), false}};

/** Search for the KStdAccelInfo object associated with the given @p id. */
static KStdAccelInfo *infoPtr(StdAccel id)
{
    if(id != AccelNone)
    {
        // Linear search. Changing the data structure doesn't seem possible
        // (since we need groups for the config stuff), but maybe a little
        // additional hashtable wouldn't hurt.
        for(uint i = 0; g_infoStdAccel[i].psName != 0; i++)
        {
            if(g_infoStdAccel[i].id == id)
                return &g_infoStdAccel[i];
        }
    }
    return 0;
}

/** Initialize the accelerator @p id by checking if it is overridden
    in the configuration file (and if it isn't, use the default).
*/
static void initialize(StdAccel id)
{
    KConfigGroupSaver saver(KGlobal::config(), "Shortcuts");
    KStdAccelInfo *pInfo = infoPtr(id);

    if(!pInfo)
    {
        kdWarning(125) << "KStdAccel: id not found!" << endl; // -- ellis
        return;
    }

    if(saver.config()->hasKey(pInfo->psName))
    {
        QString s = saver.config()->readEntry(pInfo->psName);
        if(s != "none")
            pInfo->cut.init(s);
        else
            pInfo->cut.clear();
    }
    else
        pInfo->cut = shortcutDefault(id);
    pInfo->bInitialized = true;
}

QString name(StdAccel id)
{
    KStdAccelInfo *pInfo = infoPtr(id);
    if(!pInfo)
        return QString::null;
    return pInfo->psName;
}

QString label(StdAccel id)
{
    KStdAccelInfo *pInfo = infoPtr(id);
    if(!pInfo)
        return QString::null;
    return i18n((pInfo->psDesc) ? pInfo->psDesc : pInfo->psName);
}

// TODO: Add psWhatsThis entry to KStdAccelInfo
QString whatsThis(StdAccel /*id*/)
{
    //	KStdAccelInfo* pInfo = infoPtr( id );
    //	if( pInfo && pInfo->psWhatsThis )
    //		return i18n(pInfo->psWhatsThis);
    //	else
    return QString::null;
}

const KShortcut &shortcut(StdAccel id)
{
    KStdAccelInfo *pInfo = infoPtr(id);
    if(!pInfo)
        return KShortcut::null();

    if(!pInfo->bInitialized)
        initialize(id);

    return pInfo->cut;
}

StdAccel findStdAccel(const KKeySequence &seq)
{
    if(!seq.isNull())
    {
        for(uint i = 0; g_infoStdAccel[i].psName != 0; i++)
        {
            StdAccel id = g_infoStdAccel[i].id;
            if(id != AccelNone)
            {
                if(!g_infoStdAccel[i].bInitialized)
                    initialize(id);
                if(g_infoStdAccel[i].cut.contains(seq))
                    return id;
            }
        }
    }
    return AccelNone;
}

KShortcut shortcutDefault(StdAccel id)
{
    return (KAccelAction::useFourModifierKeys()) ? shortcutDefault4(id) : shortcutDefault3(id);
}

KShortcut shortcutDefault3(StdAccel id)
{
    KShortcut cut;

    KStdAccelInfo *pInfo = infoPtr(id);
    if(pInfo)
    {
        if(pInfo->cutDefault)
            cut.init(pInfo->cutDefault);
        // FIXME: if there is no cutDefault, then this we be made the primary
        //  instead of alternate shortcut.
        if(pInfo->cutDefault3B)
            cut.append(KKey(pInfo->cutDefault3B));
    }

    return cut;
}

KShortcut shortcutDefault4(StdAccel id)
{
    KShortcut cut;

    KStdAccelInfo *pInfo = infoPtr(id);
    if(pInfo)
    {
        KStdAccelInfo &info = *pInfo;
        KKeySequence key2;

        cut.init((info.cutDefault4) ? QKeySequence(info.cutDefault) : QKeySequence(info.cutDefault4));

        if(info.cutDefault4B)
            key2.init(QKeySequence(info.cutDefault4B));
        else if(info.cutDefault3B)
            key2.init(QKeySequence(info.cutDefault3B));

        if(key2.count())
            cut.append(key2);
    }

    return cut;
}

#if 0 // unused
void createAccelActions( KAccelActions& actions )
{
	actions.clear();

	for( uint i = 0; g_infoStdAccel[i].psName != 0; i++ ) {
		StdAccel id = g_infoStdAccel[i].id;
		KStdAccelInfo* pInfo = &g_infoStdAccel[i];

		if( id != AccelNone ) {
			actions.insert( pInfo->psName,
				i18n((pInfo->psDesc) ? pInfo->psDesc : pInfo->psName),
				QString::null, // pInfo->psWhatsThis,
				shortcutDefault3(id),
				shortcutDefault4(id) );
		} else
			actions.insert( pInfo->psName, i18n(pInfo->psDesc) );
	}
}
#endif

const KShortcut &open()
{
    return shortcut(Open);
}
const KShortcut &openNew()
{
    return shortcut(New);
}
const KShortcut &close()
{
    return shortcut(Close);
}
const KShortcut &save()
{
    return shortcut(Save);
}
const KShortcut &print()
{
    return shortcut(Print);
}
const KShortcut &quit()
{
    return shortcut(Quit);
}
const KShortcut &cut()
{
    return shortcut(Cut);
}
const KShortcut &copy()
{
    return shortcut(Copy);
}
const KShortcut &paste()
{
    return shortcut(Paste);
}
const KShortcut &pasteSelection()
{
    return shortcut(PasteSelection);
}
const KShortcut &deleteWordBack()
{
    return shortcut(DeleteWordBack);
}
const KShortcut &deleteWordForward()
{
    return shortcut(DeleteWordForward);
}
const KShortcut &undo()
{
    return shortcut(Undo);
}
const KShortcut &redo()
{
    return shortcut(Redo);
}
const KShortcut &find()
{
    return shortcut(Find);
}
const KShortcut &findNext()
{
    return shortcut(FindNext);
}
const KShortcut &findPrev()
{
    return shortcut(FindPrev);
}
const KShortcut &replace()
{
    return shortcut(Replace);
}
const KShortcut &home()
{
    return shortcut(Home);
}
const KShortcut &end()
{
    return shortcut(End);
}
const KShortcut &beginningOfLine()
{
    return shortcut(BeginningOfLine);
}
const KShortcut &endOfLine()
{
    return shortcut(EndOfLine);
}
const KShortcut &prior()
{
    return shortcut(Prior);
}
const KShortcut &next()
{
    return shortcut(Next);
}
const KShortcut &backwardWord()
{
    return shortcut(BackwardWord);
}
const KShortcut &forwardWord()
{
    return shortcut(ForwardWord);
}
const KShortcut &gotoLine()
{
    return shortcut(GotoLine);
}
const KShortcut &addBookmark()
{
    return shortcut(AddBookmark);
}
const KShortcut &tabNext()
{
    return shortcut(TabNext);
}
const KShortcut &tabPrev()
{
    return shortcut(TabPrev);
}
const KShortcut &fullScreen()
{
    return shortcut(FullScreen);
}
const KShortcut &zoomIn()
{
    return shortcut(ZoomIn);
}
const KShortcut &zoomOut()
{
    return shortcut(ZoomOut);
}
const KShortcut &help()
{
    return shortcut(Help);
}
const KShortcut &completion()
{
    return shortcut(TextCompletion);
}
const KShortcut &prevCompletion()
{
    return shortcut(PrevCompletion);
}
const KShortcut &nextCompletion()
{
    return shortcut(NextCompletion);
}
const KShortcut &rotateUp()
{
    return shortcut(RotateUp);
}
const KShortcut &rotateDown()
{
    return shortcut(RotateDown);
}
const KShortcut &substringCompletion()
{
    return shortcut(SubstringCompletion);
}
const KShortcut &popupMenuContext()
{
    return shortcut(PopupMenuContext);
}
const KShortcut &whatsThis()
{
    return shortcut(WhatsThis);
}
const KShortcut &reload()
{
    return shortcut(Reload);
}
const KShortcut &selectAll()
{
    return shortcut(SelectAll);
}
const KShortcut &up()
{
    return shortcut(Up);
}
const KShortcut &back()
{
    return shortcut(Back);
}
const KShortcut &forward()
{
    return shortcut(Forward);
}
const KShortcut &showMenubar()
{
    return shortcut(ShowMenubar);
}

//---------------------------------------------------------------------
// ShortcutList
//---------------------------------------------------------------------

ShortcutList::ShortcutList()
{
}

ShortcutList::~ShortcutList()
{
}

uint ShortcutList::count() const
{
    static uint g_nAccels = 0;
    if(g_nAccels == 0)
    {
        for(; g_infoStdAccel[g_nAccels].psName != 0; g_nAccels++)
            ;
    }
    return g_nAccels;
}

QString ShortcutList::name(uint i) const
{
    return g_infoStdAccel[i].psName;
}

QString ShortcutList::label(uint i) const
{
    return i18n((g_infoStdAccel[i].psDesc) ? g_infoStdAccel[i].psDesc : g_infoStdAccel[i].psName);
}

QString ShortcutList::whatsThis(uint) const
{
    return QString::null;
}

const KShortcut &ShortcutList::shortcut(uint i) const
{
    if(!g_infoStdAccel[i].bInitialized)
        initialize(g_infoStdAccel[i].id);
    return g_infoStdAccel[i].cut;
}

const KShortcut &ShortcutList::shortcutDefault(uint i) const
{
    static KShortcut cut;
    cut = KStdAccel::shortcutDefault(g_infoStdAccel[i].id);
    return cut;
}

bool ShortcutList::isConfigurable(uint i) const
{
    return (g_infoStdAccel[i].id != AccelNone);
}

bool ShortcutList::setShortcut(uint i, const KShortcut &cut)
{
    g_infoStdAccel[i].cut = cut;
    return true;
}

QVariant ShortcutList::getOther(Other, uint) const
{
    return QVariant();
}

bool ShortcutList::setOther(Other, uint, QVariant)
{
    return false;
}

bool ShortcutList::save() const
{
    return writeSettings(QString::null, 0, false, true);
}

KDECORE_EXPORT QString action(StdAccel id)
{
    return name(id);
}
KDECORE_EXPORT QString description(StdAccel id)
{
    return label(id);
}
KDECORE_EXPORT int key(StdAccel id)
{
    return shortcut(id).keyCodeQt();
}
KDECORE_EXPORT int defaultKey(StdAccel id)
{
    return shortcutDefault(id).keyCodeQt();
}

KDECORE_EXPORT bool isEqual(const QKeyEvent *ev, int keyQt)
{
    KKey key1(ev), key2(keyQt);
    return key1 == key2;
}
}
Ejemplo n.º 14
0
: KPrPageEffectFactory( PinWheelWipeEffectId, i18n( "Pin Wheel" ) )
{
    addStrategy( new KPrClockWipeStrategy( 270, 2, TwoBladeVerticalClockwise, "pinWheelWipe", "twoBladeVertical", false ) );
    addStrategy( new KPrClockWipeStrategy( 0, 2, TwoBladeHorizontalClockwise, "pinWheelWipe", "twoBladeHorizontal", false ) );
    addStrategy( new KPrClockWipeStrategy( 0, 4, FourBladeClockwise, "pinWheelWipe", "fourBlade", false ) );
    addStrategy( new KPrClockWipeStrategy( 270, 2, TwoBladeVerticalCounterClockwise, "pinWheelWipe", "twoBladeVertical", true ) );
    addStrategy( new KPrClockWipeStrategy( 0, 2, TwoBladeHorizontalCounterClockwise, "pinWheelWipe", "twoBladeHorizontal", true ) );
    addStrategy( new KPrClockWipeStrategy( 0, 4, FourBladeCounterClockwise, "pinWheelWipe", "fourBlade", true ) );
}

KPrPinWheelWipeEffectFactory::~KPrPinWheelWipeEffectFactory()
{
}

static const char* s_subTypes[] = {
    I18N_NOOP( "Two Blades Vertical Clockwise" ),
    I18N_NOOP( "Two Blades Horizontal Clockwise" ),
    I18N_NOOP( "Four Blades Horizontal Clockwise" ),
    I18N_NOOP( "Two Blades Vertical Counterclockwise" ),
    I18N_NOOP( "Two Blades Horizontal Counterclockwise" ),
    I18N_NOOP( "Four Blades Horizontal Counterclockwise" )
};

QString KPrPinWheelWipeEffectFactory::subTypeName(int subType) const
{
    if (subType >= 0 && subType < sizeof s_subTypes / sizeof s_subTypes[0]) {
        return i18n( s_subTypes[subType] );
    } else {
        return i18n( "Unknown subtype" );
    }
}
Ejemplo n.º 15
0
#include "navcfg.h"
#endif

#ifdef WIN32
#include <windows.h>
#endif

Plugin *createNavigatePlugin(unsigned base, bool, const char *config)
{
    Plugin *plugin = new NavigatePlugin(base, config);
    return plugin;
}

static PluginInfo info =
    {
        I18N_NOOP("Navigate"),
        I18N_NOOP("Plugin provides navigation on hyperlinks, call an external browser and mailer"),
        VERSION,
        createNavigatePlugin,
        PLUGIN_DEFAULT
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}

#ifndef WIN32

/*
typedef struct NavigateData
Ejemplo n.º 16
0
#include <qwidgetlist.h>
#include <qtimer.h>

Plugin *createFloatyPlugin(unsigned base, bool, const char*)
{
    FloatyPlugin *plugin = new FloatyPlugin(base);
    if (plugin->core == NULL){
        delete plugin;
        return NULL;
    }
    return plugin;
}

static PluginInfo info =
    {
        I18N_NOOP("Floaty"),
        I18N_NOOP("Plugin provides floating windows for contacts"),
        VERSION,
        createFloatyPlugin,
        PLUGIN_DEFAULT
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}

/*
typedef struct FloatyUserData
{
	unsigned	Floaty;
Ejemplo n.º 17
0
Archivo: main.cpp Proyecto: kcroot/Kup
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "kupdaemon.h"

#include <KStartupInfo>
#include <KUniqueApplication>
#include <KAboutData>
#include <KCmdLineArgs>

#include <QDebug>

static const char description[] = I18N_NOOP("Kup is a flexible backup solution using the backup storage system 'bup'. "
                                            "This allows it to quickly perform incremental backups, only saving the "
                                            "parts of files that has actually changed since last backup was taken.");

static const char version[] = "0.3";

int main(int argc, char **argv) {
	KupDaemon *lDaemon = new KupDaemon();
	if(!lDaemon->shouldStart()) {
		qWarning() <<ki18n("Kup is not enabled, enable it from the system settings module.").toString();
		return 0;
	}
	KAboutData lAbout("kupdaemon", "kup", ki18nc("@title", "Kup Daemon"), version, ki18n(description),
	                  KAboutData::License_GPL, ki18n("Copyright (C) 2011 Simon Persson"),
	                  KLocalizedString(), 0, "*****@*****.**");
	lAbout.addAuthor(ki18n("Simon Persson"), KLocalizedString(), "*****@*****.**");
	KCmdLineArgs::init(argc, argv, &lAbout);
Ejemplo n.º 18
0
void *FloatyPlugin::processEvent(Event *e)
{
    switch (e->type()){
    case EventInit:{
            Contact *contact;
            ContactList::ContactIterator it;
            while ((contact = ++it) != NULL){
                FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, false));
                if ((data == NULL) || !data->Floaty)
                    continue;
                FloatyWnd *wnd = new FloatyWnd(this, contact->id());
                wnd->move(data->X, data->Y);
                wnd->show();
            }
            break;
        }
    case EventCheckState:{
            CommandDef *cmd = (CommandDef*)(e->param());
            if (cmd->id == CmdFloaty){
                Contact *contact = getContacts()->contact((unsigned)(cmd->param));
                if (contact){
                    FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, false));
                    if (data && data->Floaty){
                        cmd->text = I18N_NOOP("Floating off");
                        cmd->flags |= COMMAND_CHECKED;
                    }else{
                        cmd->text = I18N_NOOP("Floating on");
                        cmd->flags &= ~COMMAND_CHECKED;
                    }
                }
                return e->param();
            }
            break;
        }
    case EventCommandExec:{
            CommandDef *cmd = (CommandDef*)(e->param());
            if (cmd->id == CmdFloaty){
                Contact *contact = getContacts()->contact((unsigned)(cmd->param));
                if (contact){
                    FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, true));
                    if (data->Floaty){
                        data->Floaty = 0;
                        data->X = 0;
                        data->Y = 0;
                        FloatyWnd *wnd = findFloaty(contact->id());
                        if (wnd)
                            delete wnd;
                    }else{
                        data->Floaty = (unsigned)(-1);
                        FloatyWnd *wnd = new FloatyWnd(this, (unsigned)(cmd->param));
                        wnd->move(0, 0);
                        wnd->show();
                    }
                }
                return e->param();
            }
            break;
        }
    case EventMessageDeleted:
    case EventMessageRead:
    case EventMessageReceived:{
            Message *msg = (Message*)(e->param());
            FloatyWnd *wnd = findFloaty(msg->contact());
            if (wnd){
                wnd->init();
                wnd->repaint();
            }
            break;
        }
    case EventContactClient:
    case EventContactStatus:
    case EventContactChanged:{
            Contact *contact = (Contact*)(e->param());
            FloatyWnd *wnd = findFloaty(contact->id());
            if (wnd){
                wnd->init();
                wnd->repaint();
            }
            break;
        }
    case EventContactDeleted:{
            Contact *contact = (Contact*)(e->param());
            FloatyWnd *wnd = findFloaty(contact->id());
            if (wnd)
                delete wnd;
            break;
        }
    case EventRepaintView:{
            QWidgetList *list = QApplication::topLevelWidgets();
            QWidgetListIt it(*list);
            QWidget * w;
            while ((w = it.current()) != NULL) {
                if (w->inherits("FloatyWnd")){
                    FloatyWnd *wnd = static_cast<FloatyWnd*>(w);
                    wnd->init();
                    wnd->repaint();
                }
                ++it;
            }
            delete list;
            break;
        }
    }
    return NULL;
}
Ejemplo n.º 19
0
            m->setFile(fileName);
            return m;
        }
    }
    return NULL;
}

#if 0
i18n("File", "%n files", 1);
#endif

static CommandDef fileCommands[] =
    {
        {
            CmdFileAccept,
            I18N_NOOP("&Accept"),
            NULL,
            NULL,
            NULL,
            ToolBarMsgEdit,
            0x1090,
            MenuMessage,
            0,
            0,
            COMMAND_CHECK_STATE,
            NULL,
            NULL
        },
        {
            CmdFileDecline,
            I18N_NOOP("&Decline"),
namespace Kst {

const QString EventMonitorEntry::staticTypeString = I18N_NOOP("Event Monitor");
const QString EventMonitorEntry::staticTypeTag = I18N_NOOP("eventmonitor");

namespace {
  const int EventMonitorEventType = int(QEvent::User) + 2931;
  class EventMonitorEvent : public QEvent {
    public:
      EventMonitorEvent(const QString& msg) : QEvent(QEvent::Type(EventMonitorEventType)), logMessage(msg) {}
      QString logMessage;
  };
}

//extern "C" int yyparse();
//extern "C" void *ParsedEquation;
//extern "C" struct yy_buffer_state *yy_scan_string(const char*);

const QString EventMonitorEntry::OUTXVECTOR('X');
const QString EventMonitorEntry::OUTYVECTOR('Y');

EventMonitorEntry::EventMonitorEntry(ObjectStore *store) : DataObject(store) {
  _level = Debug::Warning;
  _logDebug = true;
  _logEMail = false;
  _logELOG = false;

  const int NS = 1;

  _numDone = 0;
  _isValid = false;
  _pExpression = 0L;

  _typeString = staticTypeString;
  _type = "Event";
  _initializeShortName();

  VectorPtr xv = store->createObject<Vector>();
  xv->resize(NS);
  xv->setProvider(this);
  _xVector = _outputVectors.insert(OUTXVECTOR, xv);

  VectorPtr yv = store->createObject<Vector>();
  yv->resize(NS);
  yv->setProvider(this);
  _yVector = _outputVectors.insert(OUTYVECTOR, yv);
}

void EventMonitorEntry::_initializeShortName() {
}

bool EventMonitorEntry::reparse() {
  _isValid = false;
  if (!_event.isEmpty()) {
    Equations::mutex().lock();
    yy_scan_string(_event.toLatin1());
    int rc = yyparse(store());
    if (rc == 0) {
      _pExpression = static_cast<Equations::Node*>(ParsedEquation);
      Equations::Context ctx;
      Equations::FoldVisitor vis(&ctx, &_pExpression);
      StringMap stm;
      _pExpression->collectObjects(_vectorsUsed, _inputScalars, stm);

      for (ScalarMap::ConstIterator i = _inputScalars.begin(); i != _inputScalars.end(); ++i) {
        if ((*i)->myLockStatus() == KstRWLock::UNLOCKED) {
          (*i)->readLock();
        }
      }
      Equations::mutex().unlock();
      _isValid = true;
    } else {
      delete (Equations::Node*)ParsedEquation;
      Equations::mutex().unlock();
    }
    ParsedEquation = 0L;
  }
  return _isValid;
}


void EventMonitorEntry::save(QXmlStreamWriter &xml) {
  xml.writeStartElement(staticTypeTag);
  xml.writeAttribute("equation", _event);
  xml.writeAttribute("description", _description);
  xml.writeAttribute("logdebug", QVariant(_logDebug).toString());
  xml.writeAttribute("loglevel", QVariant(_level).toString());
  xml.writeAttribute("logemail", QVariant(_logEMail).toString());
  xml.writeAttribute("logelog", QVariant(_logELOG).toString());
  xml.writeAttribute("emailrecipients", _eMailRecipients);
  xml.writeAttribute("script", _script);
  xml.writeEndElement();
}


EventMonitorEntry::~EventMonitorEntry() {
  logImmediately(false);

  delete _pExpression;
  _pExpression = 0L;
}


void EventMonitorEntry::internalUpdate() {
  writeLockInputsAndOutputs();

  if (!_pExpression) {
    reparse();
  }

  VectorPtr xv = *_xVector;
  VectorPtr yv = *_yVector;
  int ns = 1;

  for (VectorMap::ConstIterator i = _vectorsUsed.begin(); i != _vectorsUsed.end(); ++i) {
    ns = qMax(ns, i.value()->length());
  }

  double *rawValuesX = 0L;
  double *rawValuesY = 0L;
  if (xv && yv) {
    if (xv->resize(ns)) {
      rawValuesX = xv->value();
    }

    if (yv->resize(ns)) {
      rawValuesY = yv->value();
    }
  }

  Equations::Context ctx;
  ctx.sampleCount = ns;
  ctx.x = 0.0;

  if (needToEvaluate()) {
    if (_pExpression) {
      for (ctx.i = _numDone; ctx.i < ns; ++ctx.i) {
        const double value = _pExpression->value(&ctx);
        if (value != 0.0) { // The expression evaluates to true
          log(ctx.i);
          if (rawValuesX && rawValuesY) {
            rawValuesX[ctx.i] = ctx.i;
            rawValuesY[ctx.i] = 1.0;
          }
        } else {
          if (rawValuesX && rawValuesY) {
            rawValuesX[ctx.i] = ctx.i;
            rawValuesY[ctx.i] = 0.0;
          }
        }
      }
      _numDone = ns;
      logImmediately();
    }
  } else {
    _numDone = ns;
  }

  unlockInputsAndOutputs();

  return;
}


void EventMonitorEntry::setEvent(const QString& strEvent) {
  if (_event != strEvent) {
    _event = strEvent;
    _vectorsUsed.clear();
    _inputScalars.clear();

    _numDone = 0;
    _isValid = false;

    delete _pExpression;
    _pExpression = 0L;
  }
}


bool EventMonitorEntry::needToEvaluate() {
  return _logDebug || _logEMail || _logELOG || !_script.isEmpty();
}


void EventMonitorEntry::logImmediately(bool sendEvent) {
  const int arraySize = _indexArray.size();

  if (arraySize > 0) {
    QString logMessage;
    QString rangeString;
    bool makeRange = false;
    int idx = 0;
    int idxOld = 0;

    for (int i = 0; i < arraySize; ++i) {
      idx = _indexArray.at(i);
      if (i == 0) {
        rangeString.setNum(idx);
      } else if (!makeRange && idx == idxOld + 1) {
        makeRange = true;
      } else if (makeRange && idx != idxOld + 1) {
        rangeString = rangeString + QString(" - %1, %2").arg(idxOld).arg(idx);
        makeRange = false;
      } else if (idx != idxOld + 1) {
        rangeString = rangeString + QString(", %1").arg(idx);
      }
      idxOld = idx;
    }

    if (makeRange) {
        rangeString = rangeString + QString(", %1").arg(idx);
    }

    if (_description.isEmpty()) {
      logMessage = "Event Monitor: " + _event + ": " + rangeString;
    } else {
      logMessage = "Event Monitor: " + _description + ": " + rangeString;
    }

    _indexArray.clear();

    if (sendEvent) { // update thread
      QApplication::postEvent(this, new EventMonitorEvent(logMessage));
    } else { // GUI thread
      doLog(logMessage);
    }
  }
}


bool EventMonitorEntry::event(QEvent *e) {
    if (e->type() == EventMonitorEventType) {
      readLock();
      doLog(static_cast<EventMonitorEvent*>(e)->logMessage);
      unlock();
      return true;
    }
    return false;
}


void EventMonitorEntry::doLog(const QString& logMessage) const {
  if (_logDebug) {
    Debug::self()->log(logMessage, _level);
  }

  //if (_logEMail && !_eMailRecipients.isEmpty()) {
  //  EMailThread* thread = new EMailThread(_eMailRecipients, "Kst Event Monitoring Notification", logMessage);
  //  thread->send();
  //}

//FIXME ELOG need to be implemented.
//   if (_logELOG) {
//     KstApp::inst()->EventELOGSubmitEntry(logMessage);
//   }

//FIXME PORT!
//   if (!_script.isEmpty()) {
//     DCOPRef ref(QString("kst-%1").arg(getpid()).toLatin1(), "KstScript");
//     ref.send("evaluate", _script);
//   }
}


void EventMonitorEntry::log(int idx) {
  _indexArray.append(idx);
  if (_indexArray.size() > 1000) {
    logImmediately();
  }
}


QString EventMonitorEntry::propertyString() const {
  return _event;
}


void EventMonitorEntry::showNewDialog() {
  DialogLauncher::self()->showEventMonitorDialog();
}


void EventMonitorEntry::showEditDialog() {
  DialogLauncher::self()->showEventMonitorDialog();
}


const QString& EventMonitorEntry::scriptCode() const {
  return _script;
}


void EventMonitorEntry::setScriptCode(const QString& script) {
  if (_script != script) {
    _script = script;
  }
}


void EventMonitorEntry::setDescription(const QString& str) {
  if (_description != str) {
    _description = str;
  }
}


void EventMonitorEntry::setLevel(Debug::LogLevel level) {
  if (_level != level) {
    _level = level;
  }
}


void EventMonitorEntry::setExpression(Equations::Node* pExpression) {
  if (_pExpression != pExpression) {
    _pExpression = pExpression;
  }
}


void EventMonitorEntry::setLogDebug(bool logDebug) {
  if (_logDebug != logDebug) {
    _logDebug = logDebug;
  }
}


void EventMonitorEntry::setLogEMail(bool logEMail) {
  if (logEMail != _logEMail) {
    _logEMail = logEMail;
  }
}


void EventMonitorEntry::setLogELOG(bool logELOG) {
  if (logELOG != _logELOG) {
    _logELOG = logELOG;
  }
}


void EventMonitorEntry::setEMailRecipients(const QString& str) {
  if (str != _eMailRecipients) {
    _eMailRecipients = str;
  }
}


DataObjectPtr EventMonitorEntry::makeDuplicate() const {
  EventMonitorEntryPtr eventMonitor = store()->createObject<EventMonitorEntry>();

  eventMonitor->setScriptCode(_script);
  eventMonitor->setEvent(_event);
  eventMonitor->setDescription(_description);
  eventMonitor->setLevel(_level);
  eventMonitor->setLogDebug(_logDebug);
  eventMonitor->setLogEMail(_logEMail);
  eventMonitor->setLogELOG(_logELOG);
  eventMonitor->setEMailRecipients(_eMailRecipients);

  if (descriptiveNameIsManual()) {
    eventMonitor->setDescriptiveName(descriptiveName());
  }
  eventMonitor->reparse();

  eventMonitor->writeLock();
  eventMonitor->registerChange();
  eventMonitor->unlock();

  return DataObjectPtr(eventMonitor);
}


bool EventMonitorEntry::uses(ObjectPtr p) const {
  // check VectorsUsed in addition to _input*'s
  if (VectorPtr vect = kst_cast<Vector>(p)) {
    for (VectorMap::ConstIterator j = _vectorsUsed.begin(); j != _vectorsUsed.end(); ++j) {
      if (j.value() == vect) {
        return true;
      }
    }
  } else if (DataObjectPtr obj = kst_cast<DataObject>(p) ) {
    // check all connections from this expression to p
    for (VectorMap::ConstIterator j = obj->outputVectors().begin(); j != obj->outputVectors().end(); ++j) {
      for (VectorMap::ConstIterator k = _vectorsUsed.begin(); k != _vectorsUsed.end(); ++k) {
        if (j.value() == k.value()) {
          return true;
        }
      }
    }
  }
  return DataObject::uses(p);
}

QString EventMonitorEntry::_automaticDescriptiveName() const {
  return i18n("event");
}

QString EventMonitorEntry::descriptionTip() const {
  return i18n("Event: %1").arg(Name());
}

}
Ejemplo n.º 21
0
const unsigned PHONE_TYPE		= 0;
const unsigned PHONE_NUMBER		= 1;
const unsigned PHONE_PUBLISH	= 2;
const unsigned PHONE_ICON		= 0x10;
const unsigned PHONE_PROTO		= 0x11;
const unsigned PHONE_TYPE_ASIS	= 0x12;
const unsigned PHONE_ACTIVE		= 0x13;

const unsigned MAIL_ADDRESS		= 0;
const unsigned MAIL_PUBLISH		= 1;
const unsigned MAIL_PROTO		= 0x10;

const char *phoneTypeNames[] =
{
    I18N_NOOP("Home Phone"),
    I18N_NOOP("Home Fax"),
    I18N_NOOP("Work Phone"),
    I18N_NOOP("Work Fax"),
    I18N_NOOP("Private Cellular"),
    I18N_NOOP("Wireless Pager"),
    NULL
};

ext_info phoneIcons[] =
{
    { "phone", PHONE },
    { "fax", FAX },
    { "cell", CELLULAR },
    { "pager", PAGER },
    { NULL, 0 }
Ejemplo n.º 22
0
#include <X11/Xutil.h>
#include <X11/Xlibint.h>
#include <X11/extensions/scrnsaver.h>
#endif

const unsigned AUTOAWAY_TIME	= 10000;

Plugin *createAutoAwayPlugin(unsigned base, bool, Buffer *config)
{
    Plugin *plugin = new AutoAwayPlugin(base, config);
    return plugin;
}

static PluginInfo info =
    {
        I18N_NOOP("AutoAway"),
        I18N_NOOP("Plugin provides set away and N/A status after some idle time"),
        VERSION,
        createAutoAwayPlugin,
        PLUGIN_DEFAULT
    };

EXPORT_PROC PluginInfo* GetPluginInfo()
{
    return &info;
}

#if defined(HAVE_CARBON_CARBON_H) && !defined(HAVE_X)

static unsigned mSecondsIdle = 0;
static EventLoopTimerRef mTimerRef;
Ejemplo n.º 23
0
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <kapplication.h>
#include <klocale.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>

#include "ktimer.h"

static const char description[] =
        I18N_NOOP("KDE Timer");

static const char version[] = "v0.1";

int main( int argc, char **argv )
{
    KAboutData aboutData( "ktimer", I18N_NOOP("KTimer"),
                          version, description, KAboutData::License_GPL,
                          "(c) 2001, Stefan Schimanski");
    aboutData.addAuthor("Stefan Schimanski",0, "*****@*****.**");
    KCmdLineArgs::init( argc, argv, &aboutData );

    KApplication app;

    KTimerPref *timer = new KTimerPref;
    app.setMainWidget( timer );
Ejemplo n.º 24
0
Archivo: main.cpp Proyecto: xrg/choqok
    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, see http://www.gnu.org/licenses/

*/

#include "mainwindow.h"
#include "choqokbehaviorsettings.h"
#include "choqokapplication.h"
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <KDE/KLocale>

static const char description[] =
    I18N_NOOP( "KDE Micro-Blogging Client." );

static const char version[] = "1.3.1";

int main( int argc, char **argv )
{
    qDebug()<<"Choqok "<<version;
    KAboutData about( "choqok", 0, ki18n( "Choqok" ), version, ki18n( description ),
                      KAboutData::License_GPL_V3, ki18n( "(C) 2008-2010 Mehrdad Momeny\n(C) 2011-2012 Choqok Developers" ),
                      KLocalizedString(), 0  );
    about.addAuthor( ki18n( "Mehrdad Momeny" ), ki18n( "Author and Core Developer" ),
                     "*****@*****.**", "http://identi.ca/mtux" );
    about.addAuthor( ki18n( "Andrey Esin" ), ki18n( "Developer" ),
                     "*****@*****.**", "http://twitter.com/la_stik" );
    about.addCredit( ki18n( "Roozbeh Shafiee" ), ki18n( "Artworks" ), "*****@*****.**" );
    about.addCredit( ki18n( "Shahrzad Shojaei" ), ki18n( "Artworks" ), "*****@*****.**" );
Ejemplo n.º 25
0
}

void MonitorWindow::pause()
{
    bPause = !bPause;
}

typedef struct level_def
{
    unsigned	level;
    const char	*name;
} level_def;

static level_def levels[] =
    {
        { L_DEBUG, I18N_NOOP("&Debug") },
        { L_WARN, I18N_NOOP("&Warnings") },
        { L_ERROR, I18N_NOOP("&Errors") },
        { L_PACKETS, I18N_NOOP("&Packets") },
        { 0, NULL }
    };

void MonitorWindow::adjustLog()
{
    menuLog->clear();
    PacketType *packet;
    ContactList::PacketIterator it;
    while ((packet = ++it) != NULL){
        menuLog->insertItem(i18n(packet->name()), packet->id());
        menuLog->setItemChecked(packet->id(), m_plugin->isLogType(packet->id()));
    }
Ejemplo n.º 26
0
{
}

SMSProtocol::~SMSProtocol()
{
}

Client *SMSProtocol::createClient(Buffer *cfg)
{
    return new SMSClient(this, cfg);
}

static CommandDef sms_descr =
    {
        0,
        I18N_NOOP("SMS"),
        "SMS",
        NULL,
        NULL,
        0,
        0,
        0,
        0,
        0,
        PROTOCOL_NOPROXY | PROTOCOL_TEMP_DATA | PROTOCOL_NODATA | PROTOCOL_NO_AUTH,
        NULL,
        NULL
    };

const CommandDef *SMSProtocol::description()
{
Ejemplo n.º 27
0
void ICQClient::snac_service(unsigned short type, unsigned short)
{
    switch (type){
    case ICQ_SNACxSRV_RATExCHANGE:
        log(L_DEBUG, "Rate change");
        if (m_nSendTimeout < 200){
            m_nSendTimeout = m_nSendTimeout + 2;
            if (m_sendTimer->isActive()){
                m_sendTimer->stop();
                m_sendTimer->start(m_nSendTimeout * 500);
            }
        }
        break;
    case ICQ_SNACxSRV_RATExINFO:
        snac(ICQ_SNACxFAM_SERVICE, ICQ_SNACxSRV_RATExACK);
        m_socket->writeBuffer << 0x00010002L << 0x00030004L << 0x0005;
        sendPacket();
        snac(ICQ_SNACxFAM_SERVICE, ICQ_SNACxSRV_GETxUSERxINFO);
        sendPacket();
        listsRequest();
        locationRequest();
        buddyRequest();
        icmbRequest();
        bosRequest();
        break;
    case ICQ_SNACxSRV_MOTD:
        break;
    case ICQ_SNACxSRV_ACKxIMxICQ:
        snac(ICQ_SNACxFAM_SERVICE, ICQ_SNACxSRV_REQxRATExINFO);
        sendPacket();
        break;
    case ICQ_SNACxSRV_NAMExINFO:{
            string screen = m_socket->readBuffer.unpackScreen();
            if (screen.length() == 0){
                char n;
                m_socket->readBuffer >> n;
                m_socket->readBuffer.incReadPos(n);
                screen = m_socket->readBuffer.unpackScreen();
            }
            if ((unsigned)atol(screen.c_str()) != data.owner.Uin){
                log(L_WARN, "No my name info (%s)", screen.c_str());
                break;
            }
            m_socket->readBuffer.incReadPos(4);
            TlvList tlv(m_socket->readBuffer);
            Tlv *tlvIP = tlv(0x000A);
            if (tlvIP)
                set_ip(&data.owner.IP, htonl((unsigned long)(*tlvIP)));
            log(L_DEBUG, "Name info");
            break;
        }
    case ICQ_SNACxSRV_SERVICExRESP:{
            TlvList tlv(m_socket->readBuffer);
            Tlv *tlv_id = tlv(0x0D);
            if (tlv_id == NULL){
                log(L_WARN, "No service id in response");
                break;
            }
            ServiceSocket *s = NULL;
            for (list<ServiceSocket*>::iterator it = m_services.begin(); it != m_services.end(); ++it){
                if ((*it)->id() == (unsigned short)(*tlv_id)){
                    s = *it;
                    break;
                }
            }
            if (s == NULL){
                log(L_WARN, "Service not found");
                break;
            }
            Tlv *tlv_addr   = tlv(0x05);
            if (tlv_addr == NULL){
                s->error_state("No address for service", 0);
                break;
            }
            Tlv *tlv_cookie = tlv(0x06);
            if (tlv_cookie == NULL){
                s->error_state("No cookie for service", 0);
                break;
            }
            unsigned short port = getPort();
            string addr;
            addr = (const char*)(*tlv_addr);
            char *p = (char*)strchr(addr.c_str(), ':');
            if (p){
                *p = 0;
                port = (unsigned short)atol(p + 1);
            }
            s->connect(addr.c_str(), port, *tlv_cookie, tlv_cookie->Size());
            break;
        }
    case ICQ_SNACxSRV_READYxSERVER:
        log(L_DEBUG, "Server ready");
        snac(ICQ_SNACxFAM_SERVICE, ICQ_SNACxSRV_IMxICQ);
        if (m_bAIM){
            m_socket->writeBuffer
            << 0x00010003L
            << 0x00130003L
            << 0x00020001L
            << 0x00030001L
            << 0x00040001L
            << 0x00060001L
            << 0x00080001L
            << 0x00090001L
            << 0x000A0001L
            << 0x000B0001L;
        }else{
            m_socket->writeBuffer
            << 0x00010004L
            << 0x00130004L
            << 0x00020001L
            << 0x00030001L
            << 0x00150001L
            << 0x00040001L
            << 0x00060001L
            << 0x00090001L
            << 0x000A0001L
            << 0x000B0001L;
        }
        sendPacket();
        break;
    case ICQ_SNACxSRV_ERROR:
        break;
    case ICQ_SNACxSRV_EVIL:{
            unsigned short level;
            m_socket->readBuffer.unpack(level);
            string from = m_socket->readBuffer.unpackScreen();
            data.owner.WarningLevel = level;
            QString f;
            f = from.c_str();
            if (f.isEmpty())
                f = i18n("anonymous");
            clientErrorData d;
            d.client  = this;
            d.code    = 0;
            d.err_str = I18N_NOOP("You've been warned by %1");
            d.args    = strdup(f.utf8());
            Event e(EventClientError, &d);
            e.process();
            free(d.args);
            break;
        }
    default:
        log(L_WARN, "Unknown service family type %04X", type);
    }
Ejemplo n.º 28
0
void SMSClient::ta_error()
{
    error_state(I18N_NOOP("Port error"), 0);
}
Ejemplo n.º 29
0

//----------------------------------------------------------------------------


#ifndef UNIT_TEST
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>


// libkscreensaver interface
extern "C"
{
    KDE_EXPORT const char* kss_applicationName = "keuphoria.kss";
    KDE_EXPORT const char* kss_description = I18N_NOOP( "Euphoria" );
    KDE_EXPORT const char* kss_version = "1.0";

    KDE_EXPORT KScreenSaver* kss_create( WId id )
    {
        return new KEuphoriaScreenSaver( id );
    }

    KDE_EXPORT QDialog* kss_setup()
    {
        return new KEuphoriaSetup;
    }
}


//----------------------------------------------------------------------------
Ejemplo n.º 30
0
 *                                                                         *
 *   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 "protoeditor.h"
#include "mainwindow.h"
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>

static const char description[] =
  I18N_NOOP("A little KDE PHP Debugger client");

static const char version[] = "0.5";

static KCmdLineOptions options[] =
  {
    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
    KCmdLineLastOption
  };


int main(int argc, char **argv)
{
  KAboutData about("protoeditor", I18N_NOOP("Protoeditor"), version, description,
                   KAboutData::License_GPL, "(C) 2004 Thiago Silva", 0, 0, "*****@*****.**");
  about.addAuthor( "Thiago Silva", 0, "*****@*****.**" );