Exemplo n.º 1
0
void MainWindow::processStarted()
{
    systrayMenu.actions().at(1)->setEnabled(false);
    systrayMenu.actions().at(2)->setEnabled(true);
    ui->stopButton->setEnabled(true);
    ui->startButton->setEnabled(false);
    ui->logBrowser->clear();

    systray.setIcon(QIcon(":/icon/running_icon.png"));
    showNotification(tr("Profile: %1 Started").arg(current_profile->profileName));
}
Exemplo n.º 2
0
void MainWindow::processStopped()
{
    systrayMenu.actions().at(1)->setEnabled(true);
    systrayMenu.actions().at(2)->setEnabled(false);
    ui->stopButton->setEnabled(false);
    ui->startButton->setEnabled(true);

#ifdef Q_OS_WIN
    systray.setIcon(QIcon(":/icon/black_icon.png"));
#else
    systray.setIcon(QIcon(":/icon/mono_icon.png"));
#endif

    showNotification(tr("Profile: %1 Stopped").arg(current_profile->profileName));
}
void Client::start() {
	socket.setUpSocket();
	socket.connectTo("127.0.0.1",31000);
	ClientReceiverThread *receiverThread = new ClientReceiverThread(&socket,user);
        receiverThread->start();
	string command;
	while (true)
        {
            showNotification();
            cout<<"> ";
            cin>>command;
            if (command=="signup"){
                proccessCommandSignup();
            }
            else if (command=="login"){
                proccessCommandLogin();
            }
            else if (command=="message"){
                proccessCommandMessage();
            }
            else if (command=="show")
            {
                proccessCommandShow();
            }
            else if (command=="create")
            {
            	processCommandCreate();
            }
            else if (command=="join")
            {
            	processCommandJoin();
            }
            else if (command=="leave")
            {
            	processCommandLeave();
            }
            else if (command=="logout")
            {
                processCommandLogout();
            }
            else if (command=="sendFile")
            {
                processCommandSendFile();
            }
	}
	socket.closeSocket();
}
 void init() {
     if (!notify_is_initted()) {
         notify_init(QGSTRING(QCoreApplication::applicationName()));
     }
     
     Q_Q(QchNotification);
     notification = hildon_notification_new(QGSTRING(title), QGSTRING(text), QGSTRING(iconSource), NULL);
     notify_notification_add_action(NOTIFY_NOTIFICATION(notification), "default",
                                    QGSTRING(QCoreApplication::applicationName()),
                                    NOTIFY_ACTION_CALLBACK(onNotificationClicked), q, NULL);
     g_signal_connect(G_OBJECT(notification), "closed", G_CALLBACK(onNotificationClosed), q);
     
     setNotificationCategory();
     setNotificationHints();
     setNotificationSound();
     setNotificationTimeout();
     
     if (showOnInit) {
         showNotification();
     }
 }
void ponycountdownplasma::interval_to()
{
    m_tonewep -= 1000;
    
    if(timePart(Qt::Milliseconds) < 0) {
      showNotification("ponycountdownplasma",
		       "Ponies!",
		       "New episode of My Little Pony: Friendship is Magic was started",
		       "ponycountdown"
      );
      download();
      return;		//Do not do anything >:3
    }
    
    m_label_day_est->setText(timePart(Qt::Days));
    m_label_hour_est->setText(timePart(Qt::Hours));
    m_label_min_est->setText(timePart(Qt::Minutes));
    m_label_sec_est->setText(timePart(Qt::Seconds));
    
    //qDebug() << timePart(Qt::Days) << timePart(Qt::Hours) << timePart(Qt::Minutes) << timePart(Qt::Seconds);
}
Exemplo n.º 6
0
void WebView::addNotification(QWidget* notif)
{
    emit showNotification(notif);
}
Exemplo n.º 7
0
void SimApp::simCommand(const QSimCommand &cmd)
{
    switch (cmd.type()) {
        case QSimCommand::SetupMenu: {
            // prevent No SIM message from appearing while fetching main menu
            if ( failLabel ) {
                stack->removeWidget( failLabel );
                delete failLabel;
                failLabel = 0;
            }
            QWidget *oldView = view;
            if (listViewPreferred(cmd))
                cmdMenu(cmd);
            else
                softKeysMenu(cmd);
            removeView(oldView);
            break;
        }
        case QSimCommand::DisplayText:
            cmdDisplayText(cmd);
            break;
        case QSimCommand::GetInkey:
            cmdInKey(cmd);
            break;
        case QSimCommand::GetInput:
            cmdInput(cmd);
            break;
        case QSimCommand::SetupCall:
            cmdSetupCall(cmd);
            break;
        case QSimCommand::PlayTone:
            cmdTone(cmd);
            break;
        case QSimCommand::SelectItem:
            if (listViewPreferred(cmd))
                cmdMenu(cmd);
            else
                softKeysMenu(cmd);
            break;
        case QSimCommand::Refresh:
            cmdRefresh(cmd);
            break;
        case QSimCommand::SendSS:
        case QSimCommand::SendSMS:
        case QSimCommand::SendUSSD:
        case QSimCommand::SendDTMF:
        case QSimCommand::RunATCommand:
        case QSimCommand::CloseChannel:
        case QSimCommand::ReceiveData:
        case QSimCommand::SendData:
            // Pop up a notification to the user if text is not empty.
            showNotification(cmd);
            break;
        case QSimCommand::Timeout:
            // Wavecom only - ignore this.
            break;
        case QSimCommand::EndSession:
            qApp->quit();
            break;
        case QSimCommand::LaunchBrowser:
            cmdLaunchBrowser(cmd);
            break;
        case QSimCommand::OpenChannel:
            cmdChannel(cmd);
            break;
        case QSimCommand::SetupIdleModeText:
            cmdIdleModeText(cmd);
            break;
        case QSimCommand::NoCommand:
        case QSimCommand::MoreTime:
        case QSimCommand::PollInterval:
        case QSimCommand::PollingOff:
        case QSimCommand::ProvideLocalInformation:
        case QSimCommand::PerformCardAPDU:
        case QSimCommand::PowerOffCard:
        case QSimCommand::PowerOnCard:
        case QSimCommand::GetReaderStatus:
        case QSimCommand::TimerManagement:
        case QSimCommand::GetChannelStatus:
        case QSimCommand::LanguageNotification:
            // Ignore these commands: they are handled by modem vendor plugins.
            break;
        case QSimCommand::SetupEventList:
            cmdSetupEventList(cmd);
            break;

        default: break;
    }
}
/*virtual*/
void LLPanelPrimMediaControls::draw()
{
	LLViewerMediaImpl* impl = getTargetMediaImpl();
	if (impl)
	{
		LLNotificationPtr notification = impl->getCurrentNotification();
		if (notification != mActiveNotification)
		{
			mActiveNotification = notification;
			if (notification)
			{
				showNotification(notification);
			}
			else
			{
				hideNotification();
			}
		}
	}

	F32 alpha = getDrawContext().mAlpha;
	if(mHideImmediately)
	{
		//hide this panel
		clearFaceOnFade();

		mHideImmediately = false;
	}
	else if(mFadeTimer.getStarted())
	{
		F32 time = mFadeTimer.getElapsedTimeF32();
		alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);

		if(time >= mControlFadeTime)
		{
			//hide this panel
			clearFaceOnFade();
		}
	}
	
	// Build rect for icon area in coord system of this panel
	// Assumes layout_stack is a direct child of this panel
	mMediaControlsStack->updateLayout();
	
	// adjust for layout stack spacing
	S32 space = mMediaControlsStack->getPanelSpacing() + 2;
	LLRect controls_bg_area = mMediaControlsStack->getRect();
	
	controls_bg_area.mTop += space + 2;
	
	// adjust to ignore space from volume slider
	controls_bg_area.mBottom += mVolumeSliderCtrl->getRect().getHeight();
	
	// adjust to ignore space from left bookend padding
	controls_bg_area.mLeft += mLeftBookend->getRect().getWidth() - space;
	
	// ignore space from right bookend padding
	controls_bg_area.mRight -= mRightBookend->getRect().getWidth() - space - 2;
		
	// draw control background UI image
	mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
	
	// draw volume slider background UI image
	if (mVolumeSliderCtrl->getVisible())
	{
		LLRect volume_slider_rect;
		screenRectToLocal(mVolumeSliderCtrl->calcScreenRect(), &volume_slider_rect);
		mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
	}
	
	{
		LLViewDrawContext context(alpha);
		LLPanel::draw();
	}
}
OptionsDialog::OptionsDialog(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::OptionsPage),
    model(0),
    mapper(0),
    fRestartWarningDisplayed_Proxy(false),
    fRestartWarningDisplayed_Lang(false),
    fProxyIpValid(true)
{
    ui->setupUi(this);

    /* Network elements init */
#ifndef USE_UPNP
    ui->mapPortUpnp->setEnabled(false);
#endif

    ui->proxyIp->setEnabled(false);
    ui->proxyPort->setEnabled(false);
    ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));

    ui->socksVersion->setEnabled(false);
    ui->socksVersion->addItem("5", 5);
    ui->socksVersion->addItem("4", 4);
    ui->socksVersion->setCurrentIndex(0);

    connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
    connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
    connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
    connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));

    ui->proxyIp->installEventFilter(this);

    /* Window elements init */
#ifdef Q_OS_MAC
    ui->tabWindow->setVisible(false);
#endif

    /* Display elements init */
    QDir translations(":translations");
    ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
    foreach(const QString &langStr, translations.entryList())
    {
        QLocale locale(langStr);

        /** check if the locale name consists of 2 parts (language_country) */
        if(langStr.contains("_"))
        {
#if QT_VERSION >= 0x040800
            /** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
            ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
            /** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
            ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
        }
        else
        {
#if QT_VERSION >= 0x040800
            /** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
            ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
            /** display language strings as "language (locale name)", e.g. "German (de)" */
            ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
        }
    }

    ui->unit->setModel(new CarbonemissiontradecoinUnits(this));

    /* Widget-to-option mapper */
    mapper = new MonitoredDataMapper(this);
    mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
    mapper->setOrientation(Qt::Vertical);

    /* enable apply button when data modified */
    connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
    /* disable apply button when new data loaded */
    connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
    /* setup/change UI elements when proxy IP is invalid/valid */
    connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));

    showNotification(ui->verticalLayout, 2,
                     tr("Optional transaction fee per kB that helps make sure your transactions are processed quickly. Fee 0.01 recommended."), true);
}
/*virtual*/
void LLPanelPrimMediaControls::draw()
{
	LLViewerMediaImpl* impl = getTargetMediaImpl();
	if (impl)
	{
		LLNotificationPtr notification = impl->getCurrentNotification();
		if (notification != mActiveNotification)
		{
			mActiveNotification = notification;
			if (notification)
			{
				showNotification(notification);
			}
			else
			{
				hideNotification();
			}
		}
	}

	F32 alpha = getDrawContext().mAlpha;
	if(mHideImmediately)
	{
		//hide this panel
		clearFaceOnFade();

		mHideImmediately = false;
	}
	else if(mFadeTimer.getStarted())
	{
		F32 time = mFadeTimer.getElapsedTimeF32();
		alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);

		if(time >= mControlFadeTime)
		{
			//hide this panel
			clearFaceOnFade();
		}
	}

    // Show/hide the lock icon for secure browsing
    mSecureLockIcon->setVisible(mSecureURL && !mMediaAddress->hasFocus());
	
	// Build rect for icon area in coord system of this panel
	// Assumes layout_stack is a direct child of this panel
	mMediaControlsStack->updateLayout();
	
	// adjust for layout stack spacing
	S32 space = mMediaControlsStack->getPanelSpacing() + 2;
	LLRect controls_bg_area = mMediaControlsStack->getRect();
	
	controls_bg_area.mTop += space + 2;
	
	// adjust to ignore space from volume slider
	controls_bg_area.mBottom += mVolumeSliderCtrl->getRect().getHeight();
	
	// adjust to ignore space from left bookend padding
	controls_bg_area.mLeft += mLeftBookend->getRect().getWidth() - space;
	
	// ignore space from right bookend padding
	controls_bg_area.mRight -= mRightBookend->getRect().getWidth() - space - 2;

	// draw control background UI image

	// <FS:ND> VWR-29449; Only draw mBackgroundImage when the user has MEDIA_PERM_CONTROL. Otherwise we did hide all media controls above and drawing mBackgroundImage draws a useless grey square.
	
	// mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);

	LLViewerObject* objectp = getTargetObject();
	LLMediaEntry *media_data(0);

	if( objectp )
		media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
	if( !dynamic_cast<LLVOVolume*>(objectp) || !media_data || dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL) )
		mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
 
	// </FS:ND>

	// draw volume slider background UI image
	if (mVolumeSliderCtrl->getVisible())
	{
		LLRect volume_slider_rect;
		screenRectToLocal(mVolumeSliderCtrl->calcScreenRect(), &volume_slider_rect);
		mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
	}
	
	{
		LLViewDrawContext context(alpha);
		LLPanel::draw();
	}
}
Exemplo n.º 11
0
int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("SRFGames");
    QCoreApplication::setOrganizationDomain("sol-online.org"),
    QCoreApplication::setApplicationName("TrackYourTime");

#ifdef Q_OS_MAC
    QDir dir(argv[0]);
    dir.cdUp();
    QString currentDir = dir.absolutePath();
    dir.cdUp();
    dir.cd("PlugIns");
    QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

    QApplication a(argc, argv);
    QApplication::setQuitOnLastWindowClosed(false);

#ifdef Q_OS_MAC
    QDir::setCurrent(currentDir);
#endif


    qDebug() << "application start\n";

    cSettings settings;
    QString Language = QLocale::system().name();
    Language.truncate(Language.lastIndexOf('_'));
    Language = settings.db()->value(cDataManager::CONF_LANGUAGE_ID,Language).toString();
    if (settings.db()->value(cDataManager::CONF_FIRST_LAUNCH_ID,true).toBool()){
        settings.db()->setValue(cDataManager::CONF_FIRST_LAUNCH_ID,false);
        settings.db()->setValue(cDataManager::CONF_LANGUAGE_ID,Language);
        settings.db()->setValue(cDataManager::CONF_AUTORUN_ID,true);
        setAutorun();
        settings.db()->sync();
    }

    qDebug() << "laod translation\n";
    QTranslator translator;
    translator.load("lang_" + Language,QDir::currentPath()+"/data/languages");
    QApplication::installTranslator(&translator);

    qDebug() << "init datamanager\n";
    cDataManager datamanager;
    qDebug() << "init schedule\n";
    cSchedule schedule(&datamanager);
    qDebug() << "init updater\n";
    cUpdater updater;
    QObject::connect(&schedule,SIGNAL(checkUpdates()),&updater,SLOT(checkUpdates()));

    qDebug() << "init tray icon\n";
    cTrayIcon trIcon(&datamanager);
    QObject::connect(&datamanager, SIGNAL(trayActive()), &trIcon, SLOT(setActive()));
    QObject::connect(&datamanager, SIGNAL(traySleep()), &trIcon, SLOT(setInactive()));
    QObject::connect(&datamanager, SIGNAL(trayShowHint(QString)), &trIcon, SLOT(showHint(QString)));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &trIcon, SLOT(onProfilesChange()));

    qDebug() << "init applications window\n";
    ApplicationsWindow applicationsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showApplications()), &applicationsWindow, SLOT(showNormal()));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &applicationsWindow, SLOT(onProfilesChange()));
    QObject::connect(&datamanager, SIGNAL(applicationsChanged()), &applicationsWindow, SLOT(onApplicationsChange()));

    qDebug() << "init profiles window\n";
    ProfilesWindow profilesWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showProfiles()), &profilesWindow, SLOT(showNormal()));

    qDebug() << "init app settings window\n";
    App_SettingsWindow app_settingsWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showAppSettings(int)), &app_settingsWindow, SLOT(showApp(int)));
    QObject::connect(&datamanager, SIGNAL(debugScriptResult(QString,sSysInfo)), &app_settingsWindow, SLOT(onScriptResult(QString,sSysInfo)));

    qDebug() << "init settings window\n";
    SettingsWindow settingsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showSettings()), &settingsWindow, SLOT(showNormal()));
    QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &datamanager, SLOT(onPreferencesChanged()));

    qDebug() << "init schedule window\n";
    ScheduleWindow scheduleWindow(&datamanager,&schedule);
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &scheduleWindow, SLOT(rebuild()));
    QObject::connect(&trIcon, SIGNAL(showSchedule()), &scheduleWindow, SLOT(showNormal()));

    qDebug() << "init statistic window\n";
    StatisticWindow statisticWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showStatistic()), &statisticWindow, SLOT(showNormal()));

    qDebug() << "init about window\n";
    AboutWindow aboutWindow;
    QObject::connect(&trIcon, SIGNAL(showAbout()), &aboutWindow, SLOT(showNormal()));

    qDebug() << "init update window\n";
    UpdateAvailableWindow updateAvailableWindow;
    QObject::connect(&updater, SIGNAL(newVersionAvailable(QString)), &updateAvailableWindow, SLOT(showUpdate(QString)));
    QObject::connect(&updateAvailableWindow, SIGNAL(ignoreUpdate()), &updater, SLOT(ignoreNewVersion()));

    qDebug() << "init notification window\n";
    NotificationWindow notificationWindow(&datamanager);
    QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &notificationWindow, SLOT(onPreferencesChanged()));
    QObject::connect(&datamanager, SIGNAL(showNotification()), &notificationWindow, SLOT(onShow()));

    qDebug() << "start schedule\n";
    schedule.start();

    qDebug() << "start app loop\n";
    int result = a.exec();
    qDebug() << "application close\n";
    return result;
}