void LevelScene::initPauseMenu3()
{
    m_pauseMenu_opened=false;
    m_pauseMenuID=3;
    m_pauseMenu.setParentScene(this);
    m_pauseMenu.construct(
                //% "Pause"
                qtTrId("LVL_MENU_PAUSE_TTL"),
                PGE_MenuBox::msg_info, PGE_Point(-1,-1),
                ConfigManager::setup_menu_box.box_padding,
                ConfigManager::setup_menu_box.sprite);
    m_pauseMenu.clearMenu();

    std::vector<std::string> items;
    //% "Continue"
    items.push_back(qtTrId("LVL_MENU_PAUSE_CONTINUE"));
    //% "Replay level"
    items.push_back(qtTrId("LVL_MENU_PAUSE_REPLAY"));
    //% "Quit"
    items.push_back(qtTrId("LVL_MENU_PAUSE_EXIT"));

    m_pauseMenu.addMenuItems(items);
    m_pauseMenu.setRejectSnd(obj_sound_role::MenuPause);
    m_pauseMenu.setMaxMenuItems(3);
    m_isPauseMenu=false;
    m_isTimeStopped=false;
}
CallItemView::CallItemView(CallItem *controller)
    : MWidgetView(controller),
      //% "00:00:00"
      m_duration(new MLabel(qtTrId("xx_default_duration"), controller)),
      //% "..."
      m_status(new MLabel(qtTrId("xx_default_status"), controller)),
      m_updateTimer(this)
{
    TRACE

    m_controller = controller;
    m_layout = new QGraphicsGridLayout;
    m_layout->setContentsMargins(0,0,0,0);
    m_layout->setSpacing(0);
    m_controller->setLayout(m_layout);

    m_status->setAlignment(Qt::AlignCenter);

    if (peopleItem())
        peopleItem()->setObjectName("callItemPeopleItem");
    m_status->setObjectName("callItemStatusName");

    initLayout();

    connect(m_controller, SIGNAL(stateChanged()), SLOT(updateStatusLabel()));
}
void ShutdownUI::showWindow(const QString &text1, const QString &text2, int timeout)
{
    // If the widgets are not created create them now
    realize();

    if (!(text1.isEmpty() && text2.isEmpty())) {
        // Set the labels to show the text strings that we got only if they exist
        if (label1 != NULL) {
            if (text1.startsWith("qtn")) {
                label1->setText(qtTrId(text1.toLatin1().constData()));
            } else {
                label1->setText(text1);
            }
        }

        if (label2 != NULL) {
            if (text2.startsWith("qtn")) {
                label2->setText(qtTrId(text2.toLatin1().constData()));
            } else {
                label2->setText(text2);
            }
        }
    }

    timer->stop();

    show();
    raise();
    disableCompositorSwipeRect(this, rect());

    feedback->play();

    // Set the interval and start the timer to the next phase: hiding the labels and showing the logo
    timer->start(timeout);
}
void
ResetWidget::clearActivated ()
{
    MDialog   *dialog;
    MLocale    locale;
    QString    question;

    if (m_ResetBusinessLogic->isUsbConnected ()) {
        showMassStorageWarning ();
        return;
    }

    //% "Clear all user data and restore original settings?"
    question = qtTrId("qtn_rset_clear_query").arg(locale.formatNumber(15));
    question.replace ("\\n", "<br>");
    question.replace ("\n", "<br>");

    //% "Clear all data?"
    dialog = new MMessageBox (qtTrId ("qtn_rset_clear_query_title"),
                              question, M::YesButton | M::NoButton);
    connect (dialog, SIGNAL (accepted ()), SLOT (clearConfirmed ()));
    connect (dialog, SIGNAL (rejected ()), SLOT (operationCancelled ()));

    dialog->appear (MApplication::instance ()->activeWindow (),
                    MSceneWindow::DestroyWhenDone);
}
Example #5
0
void PlaylistModel::addHeader()
{
    QString title;
    PlaylistHeaderItem *header;

    switch (m_playlist->type())
    {
    case QSpotifyPlaylist::Inbox:
        //% "QTN_LIST_INBOX"
        title = qtTrId("QTN_LIST_INBOX");
        break;

    case QSpotifyPlaylist::Starred:
        //% "QTN_LIST_STARRED"
        title = qtTrId("QTN_LIST_STARRED");
        break;

    case QSpotifyPlaylist::Playlist:
        title = m_playlist->name();
        break;
    }

    header = new PlaylistHeaderItem(title);

    m_list.append(header);
}
void SwAcctEditPage::onFlickrClicked()
{
    //We're logging out...
    if (mService->isConfigured() && (mService->credsState() == SwClientService::CredsValid)) {
        mServiceConfig->flickrDeleteLogin();
        mFlickrClicked = false;
    } else if (!mFlickrClicked) {
        //We're pressing Login...

        if (mServiceConfig->flickrOpenLogin())
            //% "Continue"
            mFlickrButton->setText(qtTrId("button_continue"));
        else
            qWarning("Couldn't open Flickr login!");
        mFlickrClicked = true;
    } else {
        //We're pressing Continue
        mServiceConfig->flickrContinueLogin();
        mFlickrClicked = false;
        //If we get success, it will switch to log out at soon as
        //libsocialweb updates the DynCaps.
        //If we get failure, we want it to say "Log in" to try again...
        //% "Log in"
        mFlickrButton->setText(qtTrId("button_login"));
    }
}
void
Ut_BatteryBusinessLogic::testPSMStateChanged ()
{
#ifdef HAVE_QMSYSTEM
    QList<QVariant> arguments;
    QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));

    /* Entering to power-save mode */
    m_logic->devicePSMStateChanged (MeeGo::QmDeviceMode::PSMStateOn);

    QTest::qWait (10);
    QCOMPARE (spy.count (), 1);
    arguments = spy.takeFirst ();
    QVERIFY (arguments.at (0).toString () == "x-nokia.battery.enterpsm");
    QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_ent_psnote"));
    QVERIFY (arguments.at (2).toString () == "");

    spy.clear ();

    /* Exiting from power-save mode */
    m_logic->devicePSMStateChanged (MeeGo::QmDeviceMode::PSMStateOff);

    QTest::qWait (10);
    QCOMPARE (spy.count (), 1);
    arguments = spy.takeFirst ();
    QVERIFY (arguments.at (0).toString () == "x-nokia.battery.exitpsm");
    QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_exit_psnote"));
    QVERIFY (arguments.at (2).toString () == "");
#endif
}
void
ResetWidget::restoreActivated ()
{
    MDialog   *dialog;

    if (m_ResetBusinessLogic->isUsbConnected ())
    {
        showMassStorageWarning ();
        return;
    }

    //% "Restore original settings?"
    QString question = qtTrId ("qtn_rset_restore_query");
    // It is a bit ugly, but translations contains \n stuffs:
    question.replace ("\\n", "<br>");
    question.replace ("\n", "<br>");

    //% "Restore original settings?"
    dialog = new MMessageBox (qtTrId ("qtn_rset_restore_query_title"),
                              question, M::YesButton | M::NoButton);
    connect (dialog, SIGNAL (accepted ()), SLOT (restoreConfirmed ()));
    connect (dialog, SIGNAL (rejected ()), SLOT (operationCancelled ()));

    dialog->appear (MApplication::instance ()->activeWindow (),
                    MSceneWindow::DestroyWhenDone);
}
void ApplicationMenuPage::retranslateUi()
{
    //% "Application Menu"
    setTitle(qtTrId("xx_applicationmenu_page_title"));
    if (!isContentCreated())
        return;

    //% "Application Menu is a menu element available to any view. "
    //% "<ul><li>It can be opened by tapping on the menu title area."
    //% "</li><li>It contains commands and view settings for the view "
    //% "in question and an optional area for style commands.</li>"
    //% "<li>Each view of the application can have different menu "
    //% "contents.</li></ul><b>Guidelines</b> for mandatory menu items: "
    //% "<ul><li>Settings should be on the main View of the application, "
    //% "unless the settings are specific to a sub-View</li>"
    //% "<li>Help should be available in each View </li>"
    //% "<li>Exit task should be present in all Views except for the "
    //% "main View of the application.</li></ul>"
    infoLabel->setText("<a></a>" + qtTrId("xx_applicationmenu_page_info"));

    showText(m_textIndex);

    //% "Italic"
    actionItalic->setText(qtTrId("xx_appmenu_italic"));
    //% "Normal"
    actionNormal->setText(qtTrId("xx_appmenu_normal"));
}
void ConversationPage::openAttachmentOpenDialog()
{
    MPopupList *popuplist = new MPopupList();
    QStringListModel *model = new QStringListModel(this);

    QDir homeDir = QDir::home();

    // Hack: hardcoded the list of applications for the 1.1 release
    QStringList apps = QStringList()
                          //% "Music player"
                          << qtTrId("xx_music_player")
                          //% "Photo viewer"
                          << qtTrId("xx_photo_viewer")
                          //% "Video player"
                          << qtTrId("xx_video player");


    model->setStringList(apps);
    popuplist->setItemModel(model);
    //% "Select an application"
    popuplist->setTitle(qtTrId("xx_select_an_application"));
    popuplist->appear();
    connect(popuplist, SIGNAL(clicked(const QModelIndex&)), SLOT(applicationSelected(const QModelIndex &)));

}
QString FilterableFacebookRelatedDataFilterInterface::dataSection(const QVariantMap &data)
{
    if (sectionField().isEmpty()) {
        return QString();
    }

    QString section = data.value(sectionField()).toString();

    if (sectionField() == "rsvp_status") {
        QString trueSection;


        if (section == "attending") {
            //: A section header for people attending an event
            //% "Attending"
            trueSection = qtTrId("facebook_event_attending");
        } else if (section == "unsure") {
            //: A section header for people that are unsure about attending to an event
            //% "Unsure"
            trueSection = qtTrId("facebook_event_unsure");
        } else if (section == "declined") {
            //: A section header for people who declined an event
            //% "Declined"
            trueSection = qtTrId("facebook_event_declined");
        } else if (section == "not_replied") {
            //: A section header for people who did not replied yet
            //% "Not replied"
            trueSection = qtTrId("facebook_event_not_replied");
        }

        return trueSection;
    }

    return section.left(1);
}
Example #12
0
void ShutdownScreen::applySystemState(MeeGo::QmSystemState::StateIndication what)
{
    switch (what) {
        case MeeGo::QmSystemState::Shutdown:
            // To avoid early quitting on shutdown
            HomeApplication::instance()->restoreSignalHandlers();
            setWindowVisible(true);
            break;

        case MeeGo::QmSystemState::ThermalStateFatal:
            //% "Temperature too high. Device shutting down."
            createAndPublishNotification("x-nemo.battery.temperature", qtTrId("qtn_shut_high_temp"));
            break;

        case MeeGo::QmSystemState::ShutdownDeniedUSB:
            //% "USB cable plugged in. Unplug the USB cable to shutdown."
            createAndPublishNotification("device.added", qtTrId("qtn_shut_unplug_usb"));
            break;

        case MeeGo::QmSystemState::BatteryStateEmpty:
            //% "Battery empty. Device shutting down."
            createAndPublishNotification("x-nemo.battery.shutdown", qtTrId("qtn_shut_batt_empty"));
            break;

        default:
            break;
    }
}
/*
 * gconftool-2 -t string -s /meegotouch/i18n/language hu_HU
 */
void
WarrantyWidget::retranslateUi ()
{
    if (m_labelExpiration)
    {
        int expirationDays = m_WarrantyBusinessLogic->getExpirationDays ();

        if (expirationDays > 0) {
            //% "Product warranty will expire in <b>%Ln</b> day."
            m_labelExpiration->setText (
                qtTrId ("qtn_warr_expiration", expirationDays)
                .arg (expirationDays));
        } else if (expirationDays == 0) {
            //% "Product warranty is expired."
            m_labelExpiration->setText (qtTrId ("qtn_warr_expired"));
        } else {
            //% "Warranty timer error."
            m_labelExpiration->setText (qtTrId ("qtn_warr_error_timer"));
        }
    }

    /* This stuff is for eng.english generation */
#if 0
    //% "(insert terms of warranty here)"
    qtTrId ("qtn_warr_terms")
#endif
    m_labelTerms->setText (m_warrantyText);
}
Example #14
0
void LLVM_ATTRIBUTE_NORETURN CrashHandler::crashByUnhandledException()
{
    std::string stack = getStacktrace();
    std::string exc = "";

    try
    {
        //throw;
    }
    catch(const std::exception &e)
    {
        exc.append(__FUNCTION__);
        exc.append(" caught unhandled exception. what(): ");
        exc.append(e.what());
    }
    catch(...)
    {
        exc.append(__FUNCTION__);
        exc.append(" caught unhandled exception. (unknown) ");
    }

    pLogFatal("<Unhandled exception! %s>\n"
              STACK_FORMAT, exc.c_str(),
              stack.c_str(), g_messageToUser);
    msgBox(
        //% "Unhandled exception!"
        qtTrId("CRASH_UNHEXC_TITLE"),
        //% "Engine has crashed because accepted unhandled exception!"
        qtTrId("CRASH_UNHEXC_MSG"));
    abortEngine(-1);
}
void MRichTextEditDialogsManager::initTextStylingDialog()
{
    selectedFontSize = -1;
    selectedFontFamily = QString();
    selectedFontColor = QColor();

    if (dialogs.textStyles.first) {
        return;
    }
    //% "Text styles"
    dialogs.textStyles.first = new MDialog(qtTrId("qtn_comm_text_styles"),M::DoneButton);
    dialogs.textStyles.second = false;

    QGraphicsWidget *centralWidget = dialogs.textStyles.first->centralWidget();
    MLayout *layout = new MLayout(centralWidget);
    MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);

    // Initialize Font Family combo box
    QFontDatabase fontDatabase;
    QStringList fontFamilyValues = fontDatabase.families();

    // NOTE: black listing some ill-behaving fonts temporarily
    fontFamilyValues.removeAll("Webdings");
    fontFamilyValues.removeAll("Wingdings");

    fontFamilyCombo = new MComboBox(centralWidget);
    //% "Font"
    fontFamilyCombo->setTitle(qtTrId("qtn_comm_font"));
    QStringListModel *fontModel = new QStringListModel(centralWidget);
    fontModel->setStringList(fontFamilyValues);
    fontFamilyCombo->setItemModel(fontModel);
    policy->addItem(fontFamilyCombo);

    connect(fontFamilyCombo, SIGNAL(activated(QString)),
            this, SLOT(rememberFontFamily(QString)));

    // Initialize Font Size combo box
    fontSizeCombo = new MComboBox(centralWidget);
    //% "Font size"
    fontSizeCombo->setTitle(qtTrId("qtn_comm_font_size"));
    QStringListModel *sizeModel = new QStringListModel(centralWidget);
    fontSizeCombo->setItemModel(sizeModel);
    policy->addItem(fontSizeCombo);
    connect(fontSizeCombo, SIGNAL(activated(QString)),
            this, SLOT(rememberFontSize()));

    // Initialize Font Color item
    fontColorCombo = new MColorComboBox(centralWidget);
    //% "Font color"
    fontColorCombo->setTitle(qtTrId("qtn_comm_font_color_combobox"));
    policy->addItem(fontColorCombo);
    connect(fontColorCombo, SIGNAL(colorPicked(QColor)),
            this, SLOT(rememberFontColor(QColor)));

    // Selections are applied at pressing button "Done"
    connect(dialogs.textStyles.first, SIGNAL(accepted()),
            this, SLOT(applySelection()));
}
void
OfflineBrief::setToggle (
        bool toggle)
{
    SYS_DEBUG ("toggle = %s", SYS_BOOL (toggle));
    /*
     * Don't do anything if we already in the desired mode
     */
    if (toggle && m_LastMode == QmDeviceMode::Flight)
        return;
    else if ((! toggle) && m_LastMode == QmDeviceMode::Normal)
        return;

#ifdef HAVE_QMSYSTEM
    if (! toggle)
    {
        MMessageBox* dialog =
                             //% "Exit offline mode?"
            new MMessageBox (qtTrId ("qtn_offl_exiting_title"),
                             //% "Connections will be restored."
                             qtTrId ("qtn_offl_exiting"),
                             M::YesButton | M::NoButton);
        /*
         * This will set the 'Normal' mode if dialog accepted
         */
        connect (dialog, SIGNAL (accepted ()),
                 SLOT (processDialogResult ()));
        /*
         * This will switch back the button for the proper state
         */
        connect (dialog, SIGNAL (rejected ()),
                 this, SIGNAL (valuesChanged ()));
        dialog->appear (MApplication::activeWindow (),
                        MSceneWindow::DestroyWhenDone);
    }
    else
    {
        bool success = m_DevMode->setMode (QmDeviceMode::Flight);
        SYS_DEBUG ("m_DevMode->setMode (Flight) success: %s", SYS_BOOL (success));
        if (success)
        {
            m_infoBanner = new MBanner;
            m_infoBanner->setStyleName ("InformationBanner");
            m_infoBanner->setObjectName ("InfoBanner");

            //% "Closing all connections. Switching to offline mode."
            m_infoBanner->setTitle (qtTrId ("qtn_offl_entering"));
            m_infoBanner->appear (
                MApplication::activeWindow (),
                MSceneWindow::DestroyWhenDone);
            // Set to NULL, as will destroy itself
            m_infoBanner = 0;
        }
    }
#endif
}
void Ut_BatteryBusinessLogic::testBatteryStateChanged()
{
#ifdef HAVE_QMSYSTEM
    QList<QVariant> arguments;

    gQmBatteryStub->stubReset();
    gQmLEDStub->stubReset();

    /* StateFull */
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateFull);

    QCOMPARE(mNotificationEventTypes.count(), 1);
    QCOMPARE(mNotificationEventTypes.at(0), QString("x-nemo.battery.chargingcomplete"));
    QCOMPARE(mNotificationBodies.at(0), qtTrId("qtn_ener_charcomp"));
    QCOMPARE(mNotificationSummaries.at(0), QString());
    QCOMPARE(mNotificationImages.at(0), QString());
    QCOMPARE(gQmLEDStub->stubLastCallTo("activate").parameter<QString>(0), QString("PatternBatteryFull"));

    /* StateOK */
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateOK);

    /* no notifications should be published, just silently no-op */
    QCOMPARE(mNotificationEventTypes.count(), 1);

    /* StateEmpty */
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateEmpty);

    QCOMPARE(mNotificationEventTypes.count(), 2);
    QCOMPARE(mNotificationEventTypes.at(1), QString("x-nemo.battery.recharge"));
    QCOMPARE(mNotificationBodies.at(1), qtTrId("qtn_ener_rebatt"));
    QCOMPARE(mNotificationSummaries.at(1), QString());
    QCOMPARE(mNotificationImages.at(1), QString());

    /* StateError */
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateError);

    /* no notifications should be published, just silently no-op */
    QCOMPARE(mNotificationEventTypes.count(), 2);

    /* StateLow and charging */
    gQmBatteryStub->stubSetReturnValue<MeeGo::QmBattery::ChargingState>("getChargingState", MeeGo::QmBattery::StateCharging);
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateLow);

    /* no notifications should be published, because battery is charging... */
    QCOMPARE(mNotificationEventTypes.count(), 2);

    /* StateLow and not charging */
    gQmBatteryStub->stubSetReturnValue<MeeGo::QmBattery::ChargingState>("getChargingState", MeeGo::QmBattery::StateNotCharging);
    m_logic->setTouchScreenLockActive(true);
    m_logic->batteryStateChanged(MeeGo::QmBattery::StateLow);

    QCOMPARE(gLowBatteryNotifierStub->stubCallCount("setTouchScreenLockActive"), 1);
    QCOMPARE(gLowBatteryNotifierStub->stubLastCallTo("setTouchScreenLockActive").parameter<bool>(0), true);
    QCOMPARE(gLowBatteryNotifierStub->stubCallCount("sendLowBatteryAlert"), 1);
#endif
}
Example #18
0
void Ut_USBModeSelector::testUSBNotifications_data()
{
    QTest::addColumn<MeeGo::QmUSBMode::Mode>("mode");
    QTest::addColumn<QString>("category");
    QTest::addColumn<QString>("body");

    QTest::newRow("Disconnected") << MeeGo::QmUSBMode::Disconnected << "device.removed" << qtTrId("qtn_usb_disconnected");
    QTest::newRow("Ovi Suite") << MeeGo::QmUSBMode::OviSuite << "device.added" << qtTrId("qtn_usb_sync_active");
    QTest::newRow("Mass Storage") << MeeGo::QmUSBMode::MassStorage << "device.added" << qtTrId("qtn_usb_storage_active");
    QTest::newRow("SDK") << MeeGo::QmUSBMode::SDK << "device.added" << qtTrId("qtn_usb_sdk_active");
}
void CustomDirectIMWidget::keyPressEvent(QKeyEvent *event)
{
    QString label;
    //% "<i>Key press</i> key:"
    label = qtTrId("xx_textentry_keypress");
    label += QString("%1, ").arg(event->key(), 0, 16);
    //% "text:"
    label += qtTrId("xx_textentry_text");
    label += event->text();
    this->setText(label);
}
void Ut_BatteryBusinessLogic::testChargingStateChanged()
{
#ifdef HAVE_QMSYSTEM
    QList<QVariant> arguments;

    gQmBatteryStub->stubReset();
    gQmLEDStub->stubReset();

    gQmBatteryStub->stubSetReturnValue("getChargerType", MeeGo::QmBattery::Wall);

    for(int i = 0; i <= 100; i += 5) {
        /* StateCharging */
        gQmBatteryStub->stubSetReturnValue<int>("getRemainingCapacityPct", i);
        m_logic->chargingStateChanged(MeeGo::QmBattery::StateCharging);

        QCOMPARE(mNotificationEventTypes.count(), 1);
        QCOMPARE(mNotificationEventTypes.at(0), QString("x-nemo.battery"));
        QCOMPARE(mNotificationBodies.at(0), qtTrId("qtn_ener_charging"));
        QCOMPARE(mNotificationSummaries.at(0), QString());
        QCOMPARE(mNotificationImages.at(0), m_logic->chargingImageId());
        QCOMPARE(gQmLEDStub->stubLastCallTo("activate").parameter<QString>(0), QString("PatternBatteryCharging"));

        mNotificationEventTypes.clear();
        mNotificationBodies.clear();
        mNotificationSummaries.clear();
        mNotificationImages.clear();
    }

    /* StateNotCharging */
    m_logic->chargingStateChanged(MeeGo::QmBattery::StateNotCharging);

    QCOMPARE(mNotificationEventTypes.count(), 0);
    QCOMPARE(gQmLEDStub->stubLastCallTo("deactivate").parameter<QString>(0), QString("PatternBatteryCharging"));

    /* StateChargingFailed */
    m_logic->chargingStateChanged(MeeGo::QmBattery::StateChargingFailed);

    QCOMPARE(mNotificationEventTypes.count(), 1);
    QCOMPARE(mNotificationEventTypes.at(0), QString("x-nemo.battery.chargingnotstarted"));
    QCOMPARE(mNotificationBodies.at(0), qtTrId("qtn_ener_repcharger"));
    QCOMPARE(mNotificationSummaries.at(0), QString());
    QCOMPARE(mNotificationImages.at(0), QString());

    /* Test "not enough power to charge" situation... */
    gQmBatteryStub->stubSetReturnValue("getChargerType", MeeGo::QmBattery::USB_100mA);
    m_logic->chargingStateChanged(MeeGo::QmBattery::StateCharging);

    QCOMPARE(mNotificationEventTypes.count(), 2);
    QCOMPARE(mNotificationEventTypes.at(1), QString("x-nemo.battery.notenoughpower"));
    QCOMPARE(mNotificationBodies.at(1), qtTrId("qtn_ener_nopowcharge"));
    QCOMPARE(mNotificationSummaries.at(1), QString());
    QCOMPARE(mNotificationImages.at(1), QString("icon-m-energy-management-insufficient-power"));
#endif
}
void
ResetWidget::createContent ()
{
    MLayout             *layout;
    MLinearLayoutPolicy *policy;
    MButton             *restoreButton;
    MButton             *clearButton;
    MSeparator          *spacer;

    /*
     *
     */
    layout = new MLayout;
    policy = new MLinearLayoutPolicy (layout, Qt::Vertical);
    policy->setContentsMargins (0., 0., 0., 0.);
    policy->setSpacing (0.);
    
    /*
     *
     */
    spacer = new MSeparator;
    // Using this one instead of "CommonSpacer", margins look even.
    spacer->setStyleName ("CommonLargeSpacer");
    policy->addItem (spacer);

    /*
     * The first button.
     */
    //% "Restore original settings"
    restoreButton = new MButton (qtTrId("qtn_rset_restore"));
    restoreButton->setStyleName ("CommonSingleButtonInverted");
    restoreButton->setObjectName ("ResetAppletRFSButton");
    connect (restoreButton, SIGNAL(clicked()), 
            this, SLOT(restoreActivated()));

    
    /*
     * The second button.
     */
    //% "Clear device"
    clearButton = new MButton (qtTrId("qtn_rset_clear"));
    clearButton->setStyleName ("CommonSingleButtonInverted");
    clearButton->setObjectName ("ResetAppletCUDButton");
    connect (clearButton, SIGNAL(clicked()), 
            this, SLOT(clearActivated()));

    addButtonContainer (policy, restoreButton, clearButton);
    policy->addStretch();
    /*
     *
     */
    layout->setPolicy (policy);
    setLayout (layout);
}
QString
DcpAppletMetadata::text1 () const
{
    QString id = desktopEntryStr(KeyNameId);
    if (qtTrId(qPrintable(id)) == id) {
        QString name = desktopEntryStr(KeyName);
        return "!! " + name;
    } else {
        return qtTrId(qPrintable(id));
    }
}
Example #23
0
void BatteryNotifier::sendNotification(BatteryNotifier::NotificationID id)
{
    switch(id) {
    case NotificationCharging:
        sendNotification("x-nemo.battery",
                //% "Charging"
                qtTrId("qtn_ener_charging"));
        break;

    case NotificationChargingComplete:
        sendNotification("x-nemo.battery.chargingcomplete",
                //% "Charging complete"
                qtTrId("qtn_ener_charcomp"));
        break;

    case NotificationRemoveCharger:
        sendNotification("x-nemo.battery.removecharger",
                //% "Disconnect charger from power supply to save energy"
                qtTrId("qtn_ener_remcha"));
        break;

    case NotificationChargingNotStarted:
        sendNotification("x-nemo.battery.chargingnotstarted",
                //% "Charging not started. Replace charger."
                qtTrId("qtn_ener_repcharger"));
        break;

    case NotificationRechargeBattery:
        sendNotification("x-nemo.battery.recharge",
                //% "Recharge battery"
                qtTrId("qtn_ener_rebatt"));
        break;

    case NotificationEnteringPSM:
        sendNotification("x-nemo.battery.enterpsm",
                //% "Entering power save mode"
                qtTrId("qtn_ener_ent_psnote"));
        break;

    case NotificationExitingPSM:
        sendNotification("x-nemo.battery.exitpsm",
                //% "Exiting power save mode"
                qtTrId("qtn_ener_exit_psnote"));
        break;

    case NotificationLowBattery:
        sendNotification("x-nemo.battery.lowbattery",
                //% "Low battery"
                qtTrId("qtn_ener_lowbatt"));
        break;

    case NotificationNoEnoughPower:
        sendNotification("x-nemo.battery.notenoughpower",
                //% "Not enough power to charge"
                qtTrId("qtn_ener_nopowcharge"), "icon-m-energy-management-insufficient-power");
        break;
    }
}
// ----------------------------------------------------------------------------
// CReporterPrivacySettingsWidget::initWidget
// ----------------------------------------------------------------------------
void CReporterPrivacySettingsWidget::initWidget()
{    
    //% "Crash Reporter"
    MLabel *titleLabel = new MLabel(qtTrId("qtn_dcp_crash_reporter").arg(QString(CREPORTERVERSION)));
    titleLabel->setStyleName("CommonApplicationHeaderInverted");

    //% "Version %1"
    MLabel *versionLabel = new MLabel(qtTrId("qtn_dcp_version_%1").arg(QString(CREPORTERVERSION)));
    versionLabel->setStyleName("CommonSubTitleInverted");

    // Create containers.
    CReporterMonitorSettingsContainer *monitorSettings =
            new CReporterMonitorSettingsContainer(this);

    CReporterIncludeSettingsContainer *includeSettings =
            new CReporterIncludeSettingsContainer(this);

	// Button for showing privacy statement.
    MButton *showPrivacyButton = new MButton(this);
    showPrivacyButton->setObjectName("ShowPrivacyButton");
    showPrivacyButton->setStyleName("CommonSingleButtonInverted");
    //% "Privacy Disclaimer"
    showPrivacyButton->setText(qtTrId("qtn_dcp_privacy_statement_button"));

    connect(showPrivacyButton, SIGNAL(clicked()), this, SLOT(openPrivacyDisclaimerDialog()));

    // Button for sending cores via selection
    MButton *sendSelectButton = new MButton(this);
    sendSelectButton->setObjectName("SendSelectButton");
    sendSelectButton->setStyleName("CommonSingleButtonInverted");
    //% "Send/Delete Reports"
    sendSelectButton->setText(qtTrId("qtn_dcp_send_delete_button_text"));
    connect(sendSelectButton, SIGNAL(clicked()), this, SLOT (handleSendSelectButtonClicked()), Qt::DirectConnection);
    connect(sendSelectButton, SIGNAL(clicked()), monitorSettings, SLOT(updateButtons()), Qt::QueuedConnection);

    // Create main layout and policy.
    MLayout *mainLayout = new MLayout(this);
    MLinearLayoutPolicy *mainLayoutPolicy =
            new MLinearLayoutPolicy(mainLayout, Qt::Vertical);
    mainLayoutPolicy->setObjectName("PageMainLayout");
    mainLayout->setPolicy(mainLayoutPolicy);
    mainLayout->setContentsMargins(0,0,0,0);

    mainLayoutPolicy->addItem(titleLabel, Qt::AlignLeft);
    mainLayoutPolicy->addItem(versionLabel, Qt::AlignLeft);
    mainLayoutPolicy->addItem(monitorSettings, Qt::AlignCenter);
    mainLayoutPolicy->addItem(includeSettings, Qt::AlignCenter);
//    mainLayoutPolicy->addItem(bottomLayout, Qt::AlignCenter);
    mainLayoutPolicy->addStretch();
    mainLayoutPolicy->addItem(showPrivacyButton, Qt::AlignCenter);
    mainLayoutPolicy->addItem(sendSelectButton, Qt::AlignCenter);
}
Example #25
0
void LLVM_ATTRIBUTE_NORETURN CrashHandler::crashByFlood()
{
    std::string stack = getStacktrace();
    pLogFatal("<Out of memory!>\n"
              STACK_FORMAT,
              stack.c_str(), g_messageToUser);
    msgBox(
        //% "Out of memory!"
        qtTrId("CRASH_OUT_OF_MEM_TITLE"),
        //% "Engine has crashed because out of memory! Try to close other applications and restart game."
        qtTrId("CRASH_OUT_OF_MEM_MSG"));
    abortEngine(-2);
}
void CustomDirectIMWidget::keyReleaseEvent(QKeyEvent *event)
{
    QString label;
    label = this->text();
    label += '\n';
    //% "<i>Key release</i> key:"
    label += qtTrId("xx_textentry_keyrelease");
    label += QString("%1, ").arg(event->key(), 0, 16);
    //% "text:"
    label += qtTrId("xx_textentry_text");
    label += event->text();
    this->setText(label);
}
void LoginSheet::createHeaderWidget()
{
    MBasicSheetHeader *basicHeader = new MBasicSheetHeader(this);

    //% "Cancel"
    basicHeader->setNegativeAction(new QAction(qtTrId("xx_wg_sheets_cancel"), basicHeader));
    //% "Connect"
    basicHeader->setPositiveAction(new QAction(qtTrId("xx_wg_sheets_connect"), basicHeader));

    connect(basicHeader->negativeAction(), SIGNAL(triggered()), SLOT(cancel()));
    connect(basicHeader->positiveAction(), SIGNAL(triggered()), SLOT(login()));

    setHeaderWidget(basicHeader);
}
void SheetsPage::populateFullscreenPhotoSheetHeader(MSheet *sheet)
{
    MBasicSheetHeader *basicHeader = new MBasicSheetHeader(sheet);
    basicHeader->setStyleName("Inverted");

    // "Done"
    basicHeader->setNegativeAction(new QAction(qtTrId("xx_wg_sheets_done"), basicHeader));
    // "Save
    basicHeader->setPositiveAction(new QAction(qtTrId("xx_wg_sheets_save"), basicHeader));
    basicHeader->connect(basicHeader->negativeAction(), SIGNAL(triggered()), sheet, SLOT(dismiss()));
    basicHeader->connect(basicHeader->positiveAction(), SIGNAL(triggered()), this, SLOT(processFullscreenSave()));

    sheet->setHeaderWidget(basicHeader);
}
void TimeZoneModel::populateModel()
{
#ifdef HAVE_CITIES
    m_LocationDb = new MLocationDatabase();
#else
    m_LocationDb = new MLocationDatabaseFake();
#endif
    m_Cities = m_LocationDb->cities();
    qSort(m_Cities.begin(), m_Cities.end(), compareCityName);
    QSet<QString> tmz;
    QList<MCity> cityItems;
    
    for(QList<MCity>::iterator iter = m_Cities.begin();
       iter != m_Cities.end(); iter++)
      {
        MCity city = *iter;
    	sm_CityNames[city.key()] = qtTrId(qPrintable(city.key())); 
        sm_CityInCountryNames[city.key()] = qtTrId(qPrintable(city.country().key())); 
        QString key = equalityKey(city);
        if (m_EqualCities.contains(key)) {
            m_EqualCities[key].append(city);
        }
        else //if (!tmz.contains(city.timeZone()))
        {
            tmz.insert(city.timeZone());
	        cityItems.append(city);
            m_LookupByTimeZone[city.timeZone()] = city;
            QChar label = groupLabel(city);
            int groupIndex = m_GroupLabels.indexOf(label);
            if (groupIndex == -1) {
                m_GroupLabels.append(label);
                groupIndex = m_GroupLabels.count() - 1;
            }
             m_GroupMap[groupIndex].append(city);
             QVector<int> indexVec(2);
             indexVec[0] = groupIndex;
             indexVec[1] = m_GroupMap[groupIndex].count() - 1;
             m_TimeZoneIndexMap[city.timeZone()] = indexVec;
             m_EqualCities[key].append(city);
      }
    } 
   for(QList<MCity>::iterator iter = m_Cities.begin();
       iter != m_Cities.end(); iter++)
        {
            MCity city = *iter;
	        cacheCity(city);
        }

}
Example #30
0
void Ut_BatteryNotifier::testBatteryStateChanged()
{
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 0);
    setStubProperty("Battery.ChargingState", "idle");
    batteryNotifier->prepareNotification();

    /* StateFull, full */
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 1);
    QCOMPARE(getNotificationCategory(), QString("x-nemo.battery.chargingcomplete"));
    QCOMPARE(getNotificationPreviewBody(), qtTrId("qtn_ener_charcomp"));
    QCOMPARE(gNotificationManagerStub->stubLastCallTo("Notify").parameter<QString>(2), QString());
    gNotificationManagerStub->stubReset();

    /* StateOK */
    setStubProperty("Battery.ChargingState", "discharging");
    batteryNotifier->prepareNotification();
    /* no notifications should be published, just silently no-op */
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 0);

    /* StateEmpty */
    setStubProperty("Battery.Level", "empty");
    batteryNotifier->prepareNotification();
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 1);
    QCOMPARE(getNotificationCategory(), QString("x-nemo.battery.recharge"));
    QCOMPARE(getNotificationPreviewBody(), qtTrId("qtn_ener_rebatt"));
    QCOMPARE(gNotificationManagerStub->stubLastCallTo("Notify").parameter<QString>(2), QString());
    gNotificationManagerStub->stubReset();

    /* StateError */
    setStubProperty("Battery.Level", "unknown");
    batteryNotifier->prepareNotification();
    /* no notifications should be published, just silently no-op */
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 0);

    /* StateLow and charging */
    setNewStubState("low", "charging", "dcp");
    QCOMPARE(gNotificationManagerStub->stubCallCount("Notify"), 1);
    QCOMPARE(getNotificationPreviewBody(), qtTrId("qtn_ener_charging"));
    gNotificationManagerStub->stubReset();

    /* StateLow and not charging */
    batteryNotifier->setTouchScreenLockActive(true);
    setStubProperty("Battery.ChargingState", "discharging");
    batteryNotifier->prepareNotification();

    QCOMPARE(gLowBatteryNotifierStub->stubCallCount("setTouchScreenLockActive"), 1);
    QCOMPARE(gLowBatteryNotifierStub->stubLastCallTo("setTouchScreenLockActive").parameter<bool>(0), true);
    QCOMPARE(gLowBatteryNotifierStub->stubCallCount("sendLowBatteryAlert"), 1);
}