Beispiel #1
0
ChatView::ChatView(const QByteArray &id, const QString &url, QWidget *parent)
  : WebView(parent)
  , m_loaded(false)
  , m_id(id)
  , m_lastMessage(0)
{
  setPage(new WebPage(this));

  page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

  setUrl(QUrl(url));
  connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(populateJavaScriptWindowObject()));

  setFocusPolicy(Qt::NoFocus);

  connect(ChatCore::settings(), SIGNAL(changed(QString,QVariant)), SLOT(settingsChanged(QString,QVariant)));
  connect(this, SIGNAL(linkClicked(QUrl)), SLOT(openUrl(QUrl)));
  connect(ChatNotify::i(), SIGNAL(notify(Notify)), SLOT(notify(Notify)));

  setAcceptDrops(true);
  setIcons();
  createActions();
  retranslateUi();

  QTimer::singleShot(0, this, SLOT(start()));
}
ConferenceWindow::ConferenceWindow(const QString &profile_name,bool webkit_mode)
{
        smiler=false;
	m_profile_name = profile_name;
	m_webkit_mode = webkit_mode;
	setNULLs();
	loadSettings();

	QString window_file_path;
	if ( m_webkit_mode )
	{
		window_file_path = m_chat_form_path + "/webconfwindow.ui";
	}
	else
	{
		window_file_path = m_chat_form_path + "/textconfwindow.ui";
	}

	if (m_chat_form_path.isEmpty() || !QFile::exists(window_file_path) )
		loadDefaultForm();
	else
		loadCustomForm(window_file_path);

	setAttribute(Qt::WA_QuitOnClose, false);
	setAttribute(Qt::WA_DeleteOnClose, true);
	setIcons();
	if ( m_conference_list )
	{
		m_item_delegate = new ContactListItemDelegate();
		m_item_delegate->setTreeView(m_conference_list);
		m_conference_list->setItemDelegate(m_item_delegate);
		m_conference_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
		m_conference_list->setSelectionMode(QAbstractItemView::SingleSelection);
		m_conference_list->setSelectionBehavior(QAbstractItemView::SelectItems);
		m_cl_event_eater = new ConfContactListEventEater();
		m_conference_list->findChild<QObject *>("qt_scrollarea_viewport")->installEventFilter(m_cl_event_eater);
		m_conference_list->installEventFilter(m_cl_event_eater);

	}

	if ( m_plain_text_edit)
	{
		m_tab_compl = new ConfTabCompletion(this);
		m_tab_compl->setTextEdit(m_plain_text_edit);
		m_plain_text_edit->installEventFilter(this);
	}
	GeneralWindow::installEventEater();
	GeneralWindow::setFocusPolicy();
	focusTextEdit();
	if ( m_splitter_chat && m_splitter_cl )
	{
		QSettings settings(QSettings::defaultFormat(), QSettings::UserScope, "qutim/qutim."+m_profile_name, "profilesettings");
		settings.beginGroup("conference");
		m_splitter_chat->restoreState(settings.value("splitter1", QByteArray()).toByteArray());
		m_splitter_cl->restoreState(settings.value("splitter2", QByteArray()).toByteArray());
		settings.endGroup();
	}
	if ( m_send_button ) m_send_button->setEnabled(false);
}
Beispiel #3
0
void IconPreview::showPreview(const char *file)
{
    if (file == NULL){
        if (icons){
            delete icons;
            icons = NULL;
            setIcons();
        }
        return;
    }
    icons = new IconDLL;
    if (!icons->load(QFile::decodeName(file))){
        delete icons;
        icons = NULL;
    }
    setIcons();
}
void PreviewPlayer::playVideo()
{
    setWindowTitle("Preview: " + videofile);

    player->play(Phonon::MediaSource(videofile));

    setIcons();
}
Beispiel #5
0
void Settings::readSettings()
{
    setLanguage(value(KEY_LANGUAGE, defaultValue(KEY_LANGUAGE)).toString());

    setPlaylist(value(KEY_PLAYLIST, defaultValue(KEY_PLAYLIST)).toString());
    setPlaylistUpdate(value(KEY_PLAYLIST_UPDATE, defaultValue(KEY_PLAYLIST_UPDATE)).toBool());
    setPlaylistUpdateUrl(value(KEY_PLAYLIST_UPDATE_URL, defaultValue(KEY_PLAYLIST_UPDATE_URL)).toString());
    setRadioCategory(value(KEY_RADIO_CATEGORY, defaultValue(KEY_RADIO_CATEGORY)).toString());
    setHdCategory(value(KEY_HD_CATEGORY, defaultValue(KEY_HD_CATEGORY)).toString());
    setUdpxy(value(KEY_UDPXY, defaultValue(KEY_UDPXY)).toBool());
    setUdpxyUrl(value(KEY_UDPXY_URL, defaultValue(KEY_UDPXY_URL)).toString());
    setUdpxyPort(value(KEY_UDPXY_PORT, defaultValue(KEY_UDPXY_PORT)).toInt());

    setWidth(value(KEY_WIDTH, defaultValue(KEY_WIDTH)).toInt());
    setHeight(value(KEY_HEIGHT, defaultValue(KEY_HEIGHT)).toInt());
    setPosX(value(KEY_POS_X, defaultValue(KEY_POS_X)).toInt());
    setPosY(value(KEY_POS_Y, defaultValue(KEY_POS_Y)).toInt());

    setOsd(value(KEY_OSD, defaultValue(KEY_OSD)).toBool());
    setTrayEnabled(value(KEY_TRAY_ENABLED, defaultValue(KEY_TRAY_ENABLED)).toBool());
    setHideToTray(value(KEY_HIDE_TO_TRAY, defaultValue(KEY_HIDE_TO_TRAY)).toBool());
    setMouseWheel(value(KEY_MOUSE_WHEEL, defaultValue(KEY_MOUSE_WHEEL)).toString());
    setRememberGuiSession(value(KEY_REMEMBER_GUI_SESSION, defaultValue(KEY_REMEMBER_GUI_SESSION)).toBool());
    setIcons(value(KEY_ICONS, defaultValue(KEY_ICONS)).toString());

    setVout(value(KEY_VOUT, defaultValue(KEY_VOUT)).toInt());
    setAout(value(KEY_AOUT, defaultValue(KEY_AOUT)).toInt());
    setYuvToRgb(value(KEY_YUV_TO_RGB, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setSpdif(value(KEY_SPDIF, defaultValue(KEY_SPDIF)).toBool());

    setRememberVideoSettings(value(KEY_REMEMBER_VIDEO_SETTINGS, defaultValue(KEY_REMEMBER_VIDEO_SETTINGS)).toBool());
    setRememberVideoPerChannel(value(KEY_REMEMBER_VIDEO_PER_CHANNEL, defaultValue(KEY_REMEMBER_VIDEO_PER_CHANNEL)).toBool());
    setAspectRatio(value(KEY_ASPECT_RATIO, defaultValue(KEY_ASPECT_RATIO)).toInt());
    setCropRatio(value(KEY_CROP_RATIO, defaultValue(KEY_CROP_RATIO)).toInt());
    setDeinterlacing(value(KEY_DEINTERLACING, defaultValue(KEY_DEINTERLACING)).toInt());
    setAudioLanguage(value(KEY_AUDIO_LANGUAGE, defaultValue(KEY_AUDIO_LANGUAGE)).toString());
    setSubtitleLanguage(value(KEY_SUBTITLE_LANGUAGE, defaultValue(KEY_SUBTITLE_LANGUAGE)).toString());

    setMuteOnMinimize(value(KEY_MUTE_ON_MINIMIZE, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setTeletext(value(KEY_TELETEXT, defaultValue(KEY_TELETEXT)).toBool());

    setRecorderDirectory(value(KEY_RECORDER_DIRECTORY, defaultValue(KEY_RECORDER_DIRECTORY)).toString());
    setSnapshotsDirectory(value(KEY_SNAPSHOTS_DIRECTORY, defaultValue(KEY_SNAPSHOTS_DIRECTORY)).toString());

    setSessionAutoplay(value(KEY_SESSION_AUTOPLAY, defaultValue(KEY_SESSION_AUTOPLAY)).toBool());
    setSessionChannel(value(KEY_SESSION_CHANNEL, defaultValue(KEY_SESSION_CHANNEL)).toInt());
    setSessionRememberVolume(value(KEY_SESSION_REMEMBER_VOLUME, defaultValue(KEY_SESSION_REMEMBER_VOLUME)).toBool());
    setSessionVolume(value(KEY_SESSION_VOLUME, defaultValue(KEY_SESSION_VOLUME)).toInt());

    setXmltvUpdate(value(KEY_XMLTV_UPDATE, defaultValue(KEY_XMLTV_UPDATE)).toBool());
    setXmltvUpdateLocation(value(KEY_XMLTV_UPDATE_LOCATION, defaultValue(KEY_XMLTV_UPDATE_LOCATION)).toString());
    setXmltvUpdateRemote(value(KEY_XMLTV_UPDATE_REMOTE, defaultValue(KEY_XMLTV_UPDATE_REMOTE)).toBool());
}
Beispiel #6
0
int AtoB_Button::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QToolButton::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setIcons((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Beispiel #7
0
IconsPlugin::IconsPlugin(unsigned base, const char *config)
        : Plugin(base)
{
    load_data(iconsData, &data, config);
	smiles = NULL;
	if (!getSmiles().isEmpty()){
		smiles = new Smiles;
		if (!smiles->load(getSmiles())){
			delete smiles;
			smiles = NULL;
			setSmiles(NULL);
		}
	}
    setIcons();
}
Beispiel #8
0
KAnimWidget::KAnimWidget( const QString& icons, int size, QWidget *parent,
                          const char *name )
  : QFrame( parent, name ),
    d( new KAnimWidgetPrivate )
{
  connect( &d->timer, SIGNAL(timeout()), this, SLOT(slotTimerUpdate()));

  if (parent && parent->inherits( "KToolBar" ))
    connect(parent, SIGNAL(modechange()), this, SLOT(updateIcons()));

  d->loadingCompleted = false;
  d->size = size;
  d->initDone = false;
  setIcons( icons );
  setFrameStyle( StyledPanel | Sunken );
}
Beispiel #9
0
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
	: QMainWindow(parent, f) {
	setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose);
	QActionGroup *viewGroup = new QActionGroup(this);
	viewGroup->addAction(actionConnections);
	viewGroup->addAction(actionHosts);
	viewGroup->addAction(actionVariables);
	viewGroup->addAction(actionProtocols);
	createTrayIcon();
	setSlots();
	setIcons();
	// edit dialogs
	dialogC = new DialogConnectionImpl(this);
	dialogH = new DialogHostImpl(this);
	dialogP = new DialogProtocolImpl(this);
	dialogV = new DialogVarImpl(this);
	settings = new DialogSettingsImpl(this);

	currentList = PROTO;	// NOT connections
}
Beispiel #10
0
HistoryWindow::HistoryWindow(const ChatUnit *unit)
{
	ui.setupUi(this);

	ui.historyLog->setHtml("<p align='center'><span style='font-size:36pt;'>"
			+ tr("No History") + "</span></p>");
	ui.label_in->setText( tr( "In: %L1").arg( 0 ) );
	ui.label_out->setText( tr( "Out: %L1").arg( 0 ) );
	ui.label_all->setText( tr( "All: %L1").arg( 0 ) );
	Shortcut *shortcut = new Shortcut("findNext", this);
	connect(shortcut, SIGNAL(activated()), ui.searchButton, SLOT(click()));
	shortcut = new Shortcut("findPrevious", this);
	connect(shortcut, SIGNAL(activated()), SLOT(findPrevious()));

	centerizeWidget(this);
	setAttribute(Qt::WA_QuitOnClose, false);
	setAttribute(Qt::WA_DeleteOnClose, true);
	QList<int> sizes;
	sizes.append(80);
	sizes.append(250);
	ui.splitter->setSizes(sizes);
	ui.splitter->setCollapsible(1,false);
	setIcons();

	m_unitInfo = unit ? History::info(unit) : History::ContactInfo();

	connect(ui.dateTreeWidget, &QTreeWidget::itemExpanded, this, &HistoryWindow::fillMonth);

	fillAccountComboBox();

	setParent(QApplication::activeWindow());
	setWindowFlags(windowFlags() | Qt::Window);

	QAction *action = new QAction(tr("Close"),this);
	connect(action, SIGNAL(triggered()), SLOT(close()));
	addAction(action);
	SystemIntegration::show(this);
}
void PreviewPlayer::on_pushButtonStart_clicked()
{
    //does the rest
    if(player->isPlaying())
    {
        player->pause();
    }
    else
    {
        if(player->isPaused())
        {
            player->play();
        }
        else
        {
            playVideo();
        }
    }

    //Sets the propper icon
    setIcons();

}
void FlatButton::updateIcons()
{
	if (m_icon.isNull()) {
		setIcons(icon(), m_checkedIcon, m_hoverIcon);
	}
}
Beispiel #13
0
uint8_t editNumber(S32MMSValCb_t* s32, uint8_t aY)
{
    // aY is the current yPos from were the edit was triggered
    /**
     * calculate the rectangle height on the display: 
     *    fontheight + 1 pix on top + 1 pix at bottom + 2*2 pix for the frame 
     */
    int32_t valBackup = s32->m_val; // backup the old value
    uint8_t fontHeight = FONTHEIGHT(EDITFONT);
    // re-use aY
    aY = (aY < LCDHEIGHT/2 - 9 ? aY+11: aY - 25);

    // maximum size, for a scaled long: "-2123456.789" + 1 leading blank + 0x00 = 14
    char valBuf[14]; 
    // put this in a block to release memory after calculation
    { 
        // get the biggest absolute value to calculate longest
        // possible string
        uint32_t min = (s32->m_min < 0) ? -s32->m_min : s32->m_min;
        uint32_t max = (s32->m_max < 0) ? -s32->m_max : s32->m_max;
        valBuf[0] = ' '; // leading blank
        valBuf[1] = '-'; // prepend minus-sign
        valBuf[2] = '.'; // prepend decimal point
        ltoa( (max > min ? max : min), valBuf+2, 10);
        //        maxDigits = strlen(valBuf+2);
    }

    uint8_t textLength = lcdBufPuts(AT_RAM, valBuf, &EDITFONT, 0, 0, LA_CHARWIDTHONLY); 
    
    uint8_t x = (LCDWIDTH - textLength - 8) / 2;     
    drawEditFrame(x, aY, textLength, fontHeight);
    x += 4;
    aY += 4;
    uint8_t endX = x + textLength;
    uint8_t clearLength = textLength;
    uint8_t key = 0;
    uint8_t accel = 1;
    int32_t step = 1;

    CallbackFunctor_t cb = s32->m_callback;

    // call the callback if exists
    if (cb)
        cb(CT_ENTRY, s32); 

    do
    {
        /** 
         * procedure: - clear rectangle
         *              write value to string
         *              length = (write string to ldcBuffer, width_only)
         *              clear area of (width x length)
         *              paint rectangle
         *              write string to lcdbuffer(last digit inverse)
         *              display buffer
         *              read key
         *                if (enter) update & return
         *                if (back) return
         *                if (accel) inc-value <<= 2;
         *                   else inc-value = 1; 
         *                if (up) increase
         *                if (down) decrease
         */
        
        lcdBufFillRect(x, aY, clearLength, fontHeight+1, COL_WHITE);
        // write current value
        ltoa(s32->m_val, valBuf, 10);

        if (s32->m_scale)
            rescale(s32->m_scale, valBuf);

        // get size in pixels
        textLength = lcdBufPuts(AT_RAM, valBuf, &EDITFONT, 0, 0, LA_CHARWIDTHONLY);
        uint8_t xt = endX - textLength;

        lcdBufPuts(AT_RAM, valBuf, &EDITFONT, xt, aY, COL_BLACK);
        //        lcdBufPuts(AT_RAM, valBuf, &EDITFONT, endX - textLength, aY, COL_BLACK);

        uint8_t iconMask = BT_BACK|BT_ENTER;
        if (s32->m_val > s32->m_min) 
            iconMask |= BT_MINUS;
        if (s32->m_val < s32->m_max) 
            iconMask |= BT_PLUS;

        setIcons(IT_EDIT, iconMask);
        lcdUpdate(1);

        key = pollButtons(BT_ALL, BF_ACCEL|BF_DELAY); 

        if (key & BF_ACCEL)
        {
            if (accel == 10)
            {
                accel = 1;
                if (step < (s32->m_max/8))
                    step *= 8;
            }
            else
                ++accel;
        }
        else
        {
            accel = 1;
            step = 1;
        }

        switch (key & 0xF0) // clean code
        {
            case BT_BACK: 
            case BT_ENTER:
                break;

            case BT_PLUS: 
                s32->m_val += step;
                if (s32->m_val > s32->m_max)
                    s32->m_val = s32->m_max;
                break;
            case BT_MINUS: 
                s32->m_val -= step; 
                if (s32->m_val < s32->m_min)
                    s32->m_val = s32->m_min;
                break;
        } // switch key
        
        // call the callback if exists
        if (cb)
            cb((CT_CHANGE | (key & 0xF0)), s32); 
    } while (! (key & (BT_BACK | BT_ENTER)) );

    if (key & BT_BACK) // restore old value if BT_BACK was pressed
        s32->m_val = valBackup;
    if (cb)
        cb((CT_RETURN | (key & 0xF0)), s32);     
    return key & 0xF0; // return pure key
} // editNumber (s32 ..)
Beispiel #14
0
void KCMLookandFeel::save()
{
    Plasma::Package package = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
    package.setPath(m_selectedPlugin);

    if (!package.isValid()) {
        return;
    }

    m_configGroup.writeEntry("LookAndFeelPackage", m_selectedPlugin);

    if (!package.filePath("defaults").isEmpty()) {
        KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults"));
        KConfigGroup cg(conf, "kdeglobals");
        cg = KConfigGroup(&cg, "KDE");
        if (m_applyWidgetStyle) {
            setWidgetStyle(cg.readEntry("widgetStyle", QString()));
        }

        if (m_applyColors) {
            QString colorsFile = package.filePath("colors");
            KConfigGroup cg(conf, "kdeglobals");
            cg = KConfigGroup(&cg, "General");
            QString colorScheme = cg.readEntry("ColorScheme", QString());

            if (!colorsFile.isEmpty()) {
                if (!colorScheme.isEmpty()) {
                    setColors(colorScheme, colorsFile);
                } else {
                    setColors(package.metadata().name(), colorsFile);
                }
            } else if (!colorScheme.isEmpty()) {
                colorScheme.remove('\''); // So Foo's does not become FooS
                QRegExp fixer(QStringLiteral("[\\W,.-]+(.?)"));
                int offset;
                while ((offset = fixer.indexIn(colorScheme)) >= 0) {
                    colorScheme.replace(offset, fixer.matchedLength(), fixer.cap(1).toUpper());
                }
                colorScheme.replace(0, 1, colorScheme.at(0).toUpper());
                QString src = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "color-schemes/" +  colorScheme + ".colors");
                setColors(colorScheme, src);
            }
        }

        if (m_applyIcons) {
            cg = KConfigGroup(conf, "kdeglobals");
            cg = KConfigGroup(&cg, "Icons");
            setIcons(cg.readEntry("Theme", QString()));
        }

        if (m_applyPlasmaTheme) {
            cg = KConfigGroup(conf, "plasmarc");
            cg = KConfigGroup(&cg, "Theme");
            setPlasmaTheme(cg.readEntry("name", QString()));
        }

        if (m_applyCursors) {
            cg = KConfigGroup(conf, "kcminputrc");
            cg = KConfigGroup(&cg, "Mouse");
            setCursorTheme(cg.readEntry("cursorTheme", QString()));
        }

        if (m_applyWindowSwitcher) {
            cg = KConfigGroup(conf, "kwinrc");
            cg = KConfigGroup(&cg, "WindowSwitcher");
            setWindowSwitcher(cg.readEntry("LayoutName", QString()));
        }

        if (m_applyDesktopSwitcher) {
            cg = KConfigGroup(conf, "kwinrc");
            cg = KConfigGroup(&cg, "DesktopSwitcher");
            setDesktopSwitcher(cg.readEntry("LayoutName", QString()));
        }
    }

    //TODO: option to enable/disable apply? they don't seem required by UI design
    setSplashScreen(m_selectedPlugin);
    setLockScreen(m_selectedPlugin);

    m_configGroup.sync();
    runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings);
}
void PreviewPlayer::on_pushButtonStop_clicked()
{
    player->stop();
    setIcons();
}