Ejemplo n.º 1
0
/*!
  Create a new QSoftMenuBarProvider instance, with the specified \a parent.
 */
QSoftMenuBarProvider::QSoftMenuBarProvider(QObject *parent)
: QObject(parent)
{
    d = new QSoftMenuBarProviderPrivate;

    QtopiaChannel *channel = new QtopiaChannel("QPE/QSoftMenuBar", this);
    QObject::connect(channel,
                     SIGNAL(received(QString,QByteArray)),
                     this, SLOT(message(QString,QByteArray)));

    QSettings cfg(Qtopia::defaultButtonsFile(), QSettings::IniFormat);
    cfg.beginGroup("SoftKeys");
    int buttonCount = cfg.value("Count", 0).toInt();

    for(int ii = 0; ii < buttonCount; ++ii) {
        int key =
            QKeySequence(cfg.value("Key" + QString::number(ii)).toString())[0];
        MenuButton button;
        button.d->index = ii;
        button.d->key = key;
        d->buttons.append(button);

        MenuButton obutton(button);
        obutton.d->index = -1;
        d->overrideButtons.append(obutton);
    }
    cfg.endGroup();

    //swap menu/back key (when RTL)
    if ( QApplication::layoutDirection() == Qt::RightToLeft ) {
        int backIdx = d->keyToIdx( Qt::Key_Back );
        int menuIdx = d->keyToIdx( QSoftMenuBar::menuKey() );
        d->buttons[backIdx].d->index = menuIdx;
        d->buttons[menuIdx].d->index = backIdx;
        d->buttons.swap( backIdx, menuIdx );
    }

    WindowManagement *man = new WindowManagement(this);
    QObject::connect(man, SIGNAL(windowActive(QString,QRect,WId)),
                     this, SLOT(activeChanged(QString,QRect,WId)));
}
Ejemplo n.º 2
0
Archivo: win.c Proyecto: michalsc/AROS
static IPTR mNew(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct data temp;

    memset(&temp,0,sizeof(temp));

    if((obj = (Object *)DoSuperNew(cl,obj,
        MUIA_HelpNode,           "WIN",
        MUIA_Window_ID,          MAKE_ID('M', 'W', 'I', 'N'),
        MUIA_Window_Title,       getString(MSG_Win_WinTitle),
        MUIA_Window_ScreenTitle, getString(MSG_App_ScreenTitle),

        WindowContents, VGroup,
            Child, temp.reg = RegisterObject,
                MUIA_Background,       MUII_RegisterBack,
                MUIA_CycleChain,       TRUE,
                MUIA_Register_Titles,  tabs,

                /* Browsers */
                Child, temp.browsers = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_Browser,
                End,

                /* Mailers */
                Child, temp.mailers = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_Mailer,
                End,

                /* FTPs */
                Child, temp.FTPs = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_FTP,
                End,

                /* Miscellaneous */
                Child, temp.misc = VGroup,
                    MUIA_HelpNode, "MISCS",

                    /* Defaults */
                    Child, VGroup,
                        GroupFrameT(getString(MSG_Misc_Defaults)),
                        Child, HGroup,
                            Child, ColGroup(2),
                                Child, temp.show = ocheckmark(MSG_Misc_Show,MSG_Misc_Show_Help),
                                Child, ollabel1(MSG_Misc_Show),
                                Child, temp.toFront = ocheckmark(MSG_Misc_Bring,MSG_Misc_Bring_Help),
                                Child, ollabel1(MSG_Misc_Bring),
                                Child, temp.newWin = ocheckmark(MSG_Misc_Open,MSG_Misc_Open_Help),
                                Child, ollabel1(MSG_Misc_Open),
                                Child, temp.launch = ocheckmark(MSG_Misc_Launch,MSG_Misc_Launch_Help),
                                Child, ollabel1(MSG_Misc_Launch),
                            End,
                            Child, HSpace(0),
                        End,
                        Child, VSpace(0),
                    End,

                    /* Options */
                    Child, VGroup,
                        GroupFrameT(getString(MSG_Misc_Options)),
                        Child, HGroup,
                            Child, ColGroup(2),
                                Child, temp.prepend = ocheckmark(MSG_Misc_Prepend,MSG_Misc_Prepend_Help),
                                Child, ollabel1(MSG_Misc_Prepend),
                                Child, temp.mailto = ocheckmark(MSG_Misc_UseMailer,MSG_Misc_UseMailer_Help),
                                Child, ollabel1(MSG_Misc_UseMailer),
                                Child, temp.useFTP = ocheckmark(MSG_Misc_UseFTP,MSG_Misc_UseFTP_Help),
                                Child, ollabel1(MSG_Misc_UseFTP),
                            End,
                            Child, HSpace(0),
                        End,
                        Child, VSpace(0),
                    End,
                End,
            End,
            /* Buttons */
            Child, HGroup,
                Child, temp.save = obutton(MSG_Win_Save,MSG_Win_Save_Help),
                Child, wspace(16),
                Child, temp.use = obutton(MSG_Win_Use,MSG_Win_Use_Help),
                Child, wspace(16),
                Child, temp.apply = obutton(MSG_Win_Apply,MSG_Win_Apply_Help),
                Child, wspace(16),
                Child, temp.cancel = obutton(MSG_Win_Cancel,MSG_Win_Cancel_Help),
            End,

        End,
        TAG_MORE, msg->ops_AttrList)) != NULL)
    {
        struct data *data = INST_DATA(cl,obj);

        /* init instance data */
        CopyMem(&temp,data,sizeof(*data));

        data->browserList = (Object *)xget(data->browsers, MUIA_AppList_ListObj);
        data->mailerList = (Object *)xget(data->mailers, MUIA_AppList_ListObj);
        data->FTPList = (Object *)xget(data->FTPs, MUIA_AppList_ListObj);

        /* buttons */
        set(obj,MUIA_Window_DefaultObject,data->browserList);

        /* window notifies */
        DoMethod(obj,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,MUIV_Notify_Application,2,
            MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);

        /* buttons notifies */
        DoMethod(data->save,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Save);
        DoMethod(data->use,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Use);
        DoMethod(data->apply,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Apply);
        DoMethod(data->cancel,MUIM_Notify,MUIA_Pressed,FALSE,MUIV_Notify_Application,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
    }

    return (IPTR)obj;
}
Ejemplo n.º 3
0
static IPTR mNew(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct data            temp;
    struct URL_BrowserNode *bn;
    struct TagItem         *attrs = msg->ops_AttrList;

    memset(&temp,0,sizeof(temp));

    temp.browserList  = (Object *)GetTagData(MUIA_BrowserEditWin_ListObj,(IPTR)NULL,attrs);
    if (!temp.browserList) return 0;

    bn = temp.bn = (struct URL_BrowserNode *)GetTagData(MUIA_BrowserEditWin_Browser,(IPTR)NULL,attrs);
    if (!bn) return 0;


    if((obj = (Object *)DoSuperNew(cl,obj,
        MUIA_HelpNode,             "BWIN",
        MUIA_Window_ID,            MAKE_ID('E','D','B','R'),
        MUIA_Window_Title,         getString(MSG_Browser_WinTitle),
        MUIA_Window_ScreenTitle,   getString(MSG_App_ScreenTitle),
        MUIA_Window_AllowTopMenus, FALSE,

        WindowContents, VGroup,
            Child, ColGroup(2),
                GroupFrameT(getString(MSG_Edit_Definitions)),

                Child, olabel2(MSG_Edit_Name),
                Child, temp.name = ostring(NAME_LEN,MSG_Edit_Name,MSG_Edit_Name_Help),

                Child, olabel2(MSG_Edit_Path),
                Child, temp.path = opopph(syms,names,PATH_LEN,MSG_Edit_Path,TRUE,MSG_Edit_Path_Help),
                Child, olabel2(MSG_Edit_Port),
                Child, temp.port = opopport(PORT_LEN,MSG_Edit_Port,MSG_Edit_Port_Help),
            End,

            Child, ColGroup(2),
                GroupFrameT(getString(MSG_Edit_ARexx)),

                Child, olabel2(MSG_Edit_Show),
                Child, temp.show = ostring(SHOWCMD_LEN,MSG_Edit_Show,MSG_Edit_Show_Help),

                Child, olabel2(MSG_Edit_Screen),
                Child, temp.toFront = ostring(TOFRONTCMD_LEN,MSG_Edit_Screen,MSG_Edit_Screen_Help),

                Child, olabel2(MSG_Edit_OpenURL),
                Child, temp.openURL = opopph(syms,names,OPENURLCMD_LEN,MSG_Edit_OpenURL,FALSE,MSG_Edit_OpenURL_Help),
                Child, olabel2(MSG_Edit_NewWin),
                Child, temp.openURLNW = opopph(syms,names,OPENURLWCMD_LEN,MSG_Edit_NewWin,FALSE,MSG_Edit_NewWin_Help),
            End,

            Child, ColGroup(3),
                Child, temp.use = obutton(MSG_Edit_Use,MSG_Edit_Use_Help),
                Child, RectangleObject, End,
                Child, temp.cancel = obutton(MSG_Edit_Cancel,MSG_Edit_Cancel_Help),
            End,
        End,
        TAG_MORE, attrs)) != NULL)
    {
        struct data *data = INST_DATA(cl,obj);

        CopyMem(&temp,data,sizeof(*data));

        set(data->name,MUIA_String_Contents,bn->ubn_Name);
        set(data->path,MUIA_String_Contents,bn->ubn_Path);
        set(data->port,MUIA_String_Contents,bn->ubn_Port);
        set(data->show,MUIA_String_Contents,bn->ubn_ShowCmd);
        set(data->toFront,MUIA_String_Contents,bn->ubn_ToFrontCmd);
        set(data->openURL,MUIA_String_Contents,bn->ubn_OpenURLCmd);
        set(data->openURLNW,MUIA_String_Contents,bn->ubn_OpenURLWCmd);
    }

    return (IPTR)obj;
}
Ejemplo n.º 4
0
static IPTR mNew(struct IClass *cl,Object *obj,struct opSet *msg)
{
    TEXT  buf[256];
    Object *ok;

    strlcpy(buf, "OpenURL-Prefs " LIB_REV_STRING " [" SYSTEMSHORT "/" CPU "] (" LIB_DATE ")\n" LIB_COPYRIGHT, sizeof(buf));

    if ((obj = (Object *)DoSuperNew(cl,obj,
            MUIA_Window_Title,          getString(MSG_About_WinTitle),
            MUIA_Window_ScreenTitle,    getString(MSG_App_ScreenTitle),
            MUIA_Window_IconifyGadget,  FALSE,
            MUIA_Window_MenuGadget,     FALSE,
            MUIA_Window_SnapshotGadget, FALSE,
            MUIA_Window_ConfigGadget,   FALSE,
            MUIA_Window_SizeGadget,     FALSE,
            MUIA_Window_CloseGadget,    FALSE,
            MUIA_Window_AllowTopMenus,  FALSE,

            WindowContents, VGroup,
                MUIA_Background, MUII_RequesterBack,

                Child, HGroup,
                    Child, HSpace(0),
                    Child, TextObject,
                        MUIA_Text_Contents, getString(MSG_About_Descr),
                    End,
                    Child, HSpace(0),
                End,

                Child, RectangleObject, MUIA_FixHeight, 4, End,

                Child, HGroup,
                    Child, HSpace(0),
                    Child, TextObject,
                        MUIA_Text_PreParse, "\33c",
                        MUIA_Text_Contents, buf,
                    End,
                    Child, HSpace(0),
                End,

                Child, HGroup,
                    Child, HSpace(0),
                    Child, ourltext("http://sourceforge.net/projects/openurllib",NULL),
                    Child, HSpace(0),
                End,

                //Child, RectangleObject, MUIA_FixHeight, 4, End,

                Child, RectangleObject, MUIA_Rectangle_HBar, TRUE, End,

                Child, HGroup,
                    Child, RectangleObject, MUIA_Weight, 200, End,
                    Child, ok = obutton(MSG_About_OK,0),
                    Child, RectangleObject, MUIA_Weight, 200, End,
                End,
            End,
            TAG_MORE, msg->ops_AttrList)))
    {
        superset(cl,obj,MUIA_Window_ActiveObject,ok);

        DoMethod(ok,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,3,
            MUIM_Set,MUIA_Window_CloseRequest,TRUE);
    }

    return (IPTR)obj;
}