示例#1
0
void DeviceSettings::slotApply()
{
    bool succeed = true;

    /* Manual Settings */
    if ( manualButton->isChecked() ) {
        // SET IP
        int ret = set_iface( _dev.ascii(),
                             ipaddr->text().ascii(),
                             // we can ommit broadcast and netmask.
                             broadcast->text().length() ? broadcast->text().ascii() : 0,
                             netmask->text().length() ? netmask->text().ascii() : 0
            );
        if ( ret < 0 ) succeed = false;

        // SET ROUTE
        if ( !defaultgw->text().isEmpty() ) {
            ret =  set_default_route( defaultgw->text().ascii() );
            if ( ret < 0 ) succeed = false;
        }

        ret = writeDnsList();
        if ( ret < 0 ) succeed = false;

    }
    /* Automatic (DHCP) */
    else if ( automaticButton->isChecked() ) {
        // I don't like to invoke programs directly
        // but we have no chance for now,
        // this is clearly a bad hack :(.

        QFile pidfile( "/var/run/dhcpcd-" + _dev + ".pid" );
        if ( pidfile.exists() ) {
            KProcess killdhcpcd;
            killdhcpcd << "/sbin/dhcpcd" << "-k" << _dev;
            killdhcpcd.start();
            killdhcpcd.wait();

            // how ugly... wait 2 seconds to dhcpcd to finish its work...
            if ( killdhcpcd.normalExit() )
                QTimer::singleShot( 2000, this, SLOT( startDhcpcd() ) );
            else
                printf( "failed (kill)\n" );
        }
        else
            startDhcpcd();
    }

    writeSettings();

    if ( succeed ) {
        QString msg = i18n( "Successfully configured device: " ) + _dev;
        KMessageBox::information( this, msg, i18n( "Done!" ) );
    }
    else {
        QString msg = i18n( "Failed to configure device: " ) + _dev;
        KMessageBox::error( this, msg, i18n( "Error!" ) );
    }

    done( 0 );
}
示例#2
0
void KCMStyle::loadStyle( KConfig& config )
{
	cbStyle->clear();

	// Create a dictionary of WidgetStyle to Name and Desc. mappings,
	// as well as the config page info
	styleEntries.clear();
	styleEntries.setAutoDelete(true);

	QString strWidgetStyle;
	QStringList list = KGlobal::dirs()->findAllResources("themes", "*.themerc", true, true);
	for (QStringList::iterator it = list.begin(); it != list.end(); ++it)
	{
		KSimpleConfig config( *it, true );
		if ( !(config.hasGroup("KDE") && config.hasGroup("Misc")) )
			continue;

		config.setGroup("KDE");

		strWidgetStyle = config.readEntry("WidgetStyle");
		if (strWidgetStyle.isNull())
			continue;

		// We have a widgetstyle, so lets read the i18n entries for it...
		StyleEntry* entry = new StyleEntry;
		config.setGroup("Misc");
		entry->name = config.readEntry("Name");
		entry->desc = config.readEntry("Comment", i18n("No description available."));
		entry->configPage = config.readEntry("ConfigPage", QString::null);

		// Check if this style should be shown
		config.setGroup("Desktop Entry");
		entry->hidden = config.readBoolEntry("Hidden", false);

		// Insert the entry into our dictionary.
		styleEntries.insert(strWidgetStyle.lower(), entry);
	}

	// Obtain all style names
	QStringList allStyles = QStyleFactory::keys();

	// Get translated names, remove all hidden style entries.
	QStringList styles;
	StyleEntry* entry;
	for (QStringList::iterator it = allStyles.begin(); it != allStyles.end(); it++)
	{
		QString id = (*it).lower();
		// Find the entry.
		if ( (entry = styleEntries.find(id)) != 0 )
		{
			// Do not add hidden entries
			if (entry->hidden)
				continue;

			styles += entry->name;

			nameToStyleKey[entry->name] = id;
		}
		else
		{
			styles += (*it); //Fall back to the key (but in original case)
			nameToStyleKey[*it] = id;
		}
	}

	// Sort the style list, and add it to the combobox
	styles.sort();
	cbStyle->insertStringList( styles );

	// Find out which style is currently being used
	config.setGroup( "General" );
	QString defaultStyle = KStyle::defaultStyle();
	QString cfgStyle = config.readEntry( "widgetStyle", defaultStyle );

	// Select the current style
	// Do not use cbStyle->listBox() as this may be NULL for some styles when
	// they use QPopupMenus for the drop-down list!

	// ##### Since Trolltech likes to seemingly copy & paste code,
	// QStringList::findItem() doesn't have a Qt::StringComparisonMode field.
	// We roll our own (yuck)
	cfgStyle = cfgStyle.lower();
	int item = 0;
	for( int i = 0; i < cbStyle->count(); i++ )
	{
		QString id = nameToStyleKey[cbStyle->text(i)];
		item = i;
		if ( id == cfgStyle )	// ExactMatch
			break;
		else if ( id.contains( cfgStyle ) )
			break;
		else if ( id.contains( QApplication::style().className() ) )
			break;
		item = 0;
	}
	cbStyle->setCurrentItem( item );

	m_bStyleDirty = false;

	switchStyle( currentStyle() );	// make resets visible
}
示例#3
0
文件: walk.c 项目: cglinden/autocook
static graph_walk_status_ty
graph_walk_inner(graph_ty *gp,
    graph_walk_status_ty (*func)(graph_recipe_ty *, graph_ty *),
    int nproc)
{
    graph_recipe_list_nrc_ty walk;
    graph_walk_status_ty status;
    graph_walk_status_ty status2;
    graph_recipe_ty *grp;
    size_t          j;
    size_t          walk_pos;
    itab_ty         *itp;
    string_list_ty  single_thread;

    trace(("graph_walk(gp = %8.8lX, nproc = %d)\n{\n",
            (long)gp, nproc));
    status = graph_walk_status_uptodate;
    itp = itab_alloc(nproc);

    /*
     * Reset the activity counter for each recipe.
     *
     * Recipes with no inputs are added to the list at this time,
     * all of their inputs are satisfied.
     */
    graph_recipe_list_nrc_constructor(&walk);
    for (j = 0; j < gp->already_recipe->nrecipes; ++j)
    {
        grp = gp->already_recipe->recipe[j];
        grp->input_satisfied = 0;
        grp->input_uptodate = 0;

        if (grp->output->nfiles != 0 && grp->input->nfiles == 0)
        {
            grp->input_uptodate = 1;
            graph_recipe_list_nrc_append(&walk, grp);
        }
    }

    /*
     * Turn the list upside down.  We want to find all of the files
     * with outputs but no inputs.  This is the initial list of file
     * nodes to walk.
     */
    symtab_walk(gp->already, is_it_a_leaf, &walk);

    /*
     * Keep chewing up graph recipe nodes until no more are left to
     * be processed.
     */
    string_list_constructor(&single_thread);
    walk_pos = 0;
    while (walk_pos < walk.nrecipes || itp->load > 0)
    {
        /*
         * Terminate elegantly, if asked to.
         */
        if (desist_requested())
        {
          desist:
            status = graph_walk_status_error;
            if (itp->load > 0 && !option_test(OPTION_SILENT))
            {
                sub_context_ty  *scp;

                scp = sub_context_new();
                sub_var_set(scp, "Number", "%ld", (long)itp->load);
                sub_var_optional(scp, "Number");
                error_intl(scp, i18n("waiting for outstanding processes"));
                sub_context_delete(scp);
            }

            /*
             * No matter what, don't do another recipe.
             * However, we must still wait for the
             * unfinished actions to complete in an orderly
             * fashion.
             */
          no_persevere:
            assert(gp->already_recipe);
            walk_pos = gp->already_recipe->nrecipes * 2;
            continue;
        }

        /*
         * If there is available processing resource, and
         * outstanding recipe instances, run another recipe.
         */
        trace(("itp->load = %ld;\n", (long)itp->load));
        trace(("nproc = %d;\n", nproc));
        trace(("walk_pos = %ld;\n", (long)walk_pos));
        trace(("walk.nrecipes = %ld;\n", (long)walk.nrecipes));
        while (itp->load < nproc && walk_pos < walk.nrecipes)
        {
            if (desist_requested())
                goto desist;
            fp_sync();

            /*
             * Extract a recipe from the list.  Order does
             * not matter, they are all valid candidates
             * with up-to-date ingredients.
             *
             * However: the users expect a mostly
             * left-to-right order of evaluation.  That
             * means taking the first one, NOT the last one.
             */
            grp = walk.recipe[walk_pos++];

            /*
             * Make sure there is no conflict with existing
             * single thread flags.  Go hunting for a recipe
             * not in conflict.  Come back later if we can't
             * find one.
             */
            if
            (
                grp->single_thread
            &&
                string_list_intersect(grp->single_thread, &single_thread)
            )
            {
                size_t          k;
                graph_recipe_ty *kp;

                /*
                 * go hunting
                 */
                for (k = walk_pos; k < walk.nrecipes; ++k)
                {
                    kp = walk.recipe[k];
                    if
                    (
                        !kp->single_thread
                    ||
                        !string_list_intersect
                        (
                            kp->single_thread,
                            &single_thread
                        )
                    )
                        break;
                }

                /*
                 * Come back later if we find no alternative.
                 */
                if (k >= walk.nrecipes)
                {
                    --walk_pos;
                    break;
                }

                /*
                 * Have the conflicting recipe and the
                 * alternative change places.
                 */
                kp = walk.recipe[k];
                trace(("k = %ld\n", (long)k));
                trace(("kp = %08lX\n", (long)kp));
                walk.recipe[walk_pos - 1] = kp;
                walk.recipe[k] = grp;
                grp = kp;
            }
            trace(("grp = %08lX;\n", (long)grp));
            trace(("grp->input->nfiles = %ld;\n", (long)grp->input->nfiles));
            trace(("grp->output->nfiles = %ld;\n", (long)grp->output->nfiles));

            /*
             * Remember the single threading, so other
             * recipes avoid conflicting with *this* one.
             */
            if (grp->single_thread)
            {
                string_list_append_list(&single_thread, grp->single_thread);
            }

            /*
             * run the recipe body
             */
          run_a_recipe:
            status2 = func(grp, gp);

            /*
             * Look at what happened.
             */
            if (grp->single_thread && status2 != graph_walk_status_wait)
            {
                string_list_remove_list(&single_thread, grp->single_thread);
            }
            switch (status2)
            {
            case graph_walk_status_wait:
                assert(itp);
                trace(("pid = %d;\n", graph_recipe_getpid(grp)));
                itab_assign(itp, graph_recipe_getpid(grp), grp);
                trace(("itp->load = %ld;\n", (long)itp->load));
                break;

            case graph_walk_status_error:
                /*
                 * It failed.  Don't do anything with the
                 * outputs of the recipe.  Usually, we stop
                 * altogether.
                 */
                trace(("error\n"));
                status = graph_walk_status_error;
                if (!option_test(OPTION_PERSEVERE))
                    goto no_persevere;
                break;

            case graph_walk_status_done_stop:
                /*
                 * It worked, but we need to stop for
                 * some reason.  This is usually only
                 * used by isit_uptodate.
                 */
                trace(("done_stop\n"));
                if (status == graph_walk_status_uptodate)
                    status = graph_walk_status_done_stop;
                assert(itp->load == 0);
                goto done;

            case graph_walk_status_uptodate:
                star_as_specified('#');
                /* fall through... */

            case graph_walk_status_uptodate_done:
                /*
                 * It worked.  Now push all of the
                 * recipes which depend on the outputs
                 * of this recipe.
                 */
                implications_of_recipe(&walk, grp, 1);
                break;

            case graph_walk_status_done:
                /*
                 * It worked.  Now push all of the
                 * recipes which depend on the outputs
                 * of this recipe.
                 */
                implications_of_recipe(&walk, grp, 0);
                if (status == graph_walk_status_uptodate)
                    status = graph_walk_status_done;
                break;
            }

#ifdef HAVE_WAIT3
            /*
             * We want to see if any children have exited.
             * Do not block (that's why wait3 is used).
             * Only do one at a time.
             */
            if (itp->load > 0)
            {
                int             pid;
                int             exit_status;
                struct rusage   ru;

                trace(("mark\n"));
                pid = os_wait3(&exit_status, WNOHANG, &ru);
                trace(("pid = %d\n", pid));
                if (pid < 0)
                {
                    sub_context_ty  *scp;

                    if (errno == EINTR)
                        continue;
                    scp = sub_context_new();
                    sub_errno_set(scp);
                    fatal_intl(scp, i18n("wait(): $errno"));
                    /* NOTREACHED */
                }
                else if (pid > 0)
                {
                    trace(("es = 0x%04X\n", exit_status));
                    grp = itab_query(itp, pid);
                    if (grp)
                    {
                        /* if it's one of ours... */
                        trace(("...waited\n"));
                        assert(pid == graph_recipe_getpid(grp));
                        if (grp->ocp->meter_p)
                            grp->ocp->meter_p->ru = ru;
                        graph_recipe_waited(grp, exit_status);
                        itab_delete(itp, pid);
                        trace(("itp->load = %ld;\n", (long)itp->load));
                        goto run_a_recipe;
                    }
                }
            }
#endif /* HAVE_WAIT3 */
        }

        /*
         * Collect the results of execution, and kick off the
         * recipes that are blocked.  Only do one at a time.
         */
        if (itp->load > 0)
        {
            int             pid;
            int             exit_status;
#ifdef HAVE_WAIT3
            struct rusage   ru;
#endif

            trace(("mark\n"));
#ifdef HAVE_WAIT3
            pid = os_wait3(&exit_status, 0, &ru);
#else
            pid = os_wait(&exit_status);
#endif
            trace(("pid = %d\n", pid));
            assert(pid != 0);
            if (pid == 0)
                errno = EINVAL;
            if (pid <= 0)
            {
                sub_context_ty  *scp;

                if (errno == EINTR)
                    continue;
                scp = sub_context_new();
                sub_errno_set(scp);
                fatal_intl(scp, i18n("wait(): $errno"));
                /* NOTREACHED */
            }
            trace(("es = 0x%04X\n", exit_status));
            grp = itab_query(itp, pid);
            if (grp)
            {
                /* if it's one of ours... */
                trace(("...waited\n"));
                assert(pid == graph_recipe_getpid(grp));
#ifdef HAVE_WAIT3
                if (grp->ocp->meter_p)
                    grp->ocp->meter_p->ru = ru;
#endif
                graph_recipe_waited(grp, exit_status);
                itab_delete(itp, pid);
                trace(("itp->load = %ld;\n", (long)itp->load));
                goto run_a_recipe;
            }
        }
        trace(("mark\n"));
    }
  done:
    itab_free(itp);

    /*
     * Confirmation for the user when things go wrong.
     */
    if (status == graph_walk_status_error)
        symtab_walk(gp->already, excuse_me, gp);

    /*
     * Free up the list of recipes (which have been) / (to be) walked.
     */
    graph_recipe_list_nrc_destructor(&walk);
    string_list_destructor(&single_thread);

    trace(("return %s;\n", graph_walk_status_name(status)));
    trace(("}\n"));
    return status;
}
示例#4
0
void KCMStyle::addWhatsThis()
{
	// Page1
	QWhatsThis::add( cbStyle, i18n("Here you can choose from a list of"
							" predefined widget styles (e.g. the way buttons are drawn) which"
							" may or may not be combined with a theme (additional information"
							" like a marble texture or a gradient).") );
	QWhatsThis::add( stylePreview, i18n("This area shows a preview of the currently selected style "
							"without having to apply it to the whole desktop.") );

	// Page2
	QWhatsThis::add( page2, i18n("This page allows you to enable various widget style effects. "
							"For best performance, it is advisable to disable all effects.") );
	QWhatsThis::add( cbEnableEffects, i18n( "If you check this box, you can select several effects "
							"for different widgets like combo boxes, menus or tooltips.") );
	QWhatsThis::add( comboComboEffect, i18n( "<p><b>Disable: </b>do not use any combo box effects.</p>\n"
							"<b>Animate: </b>Do some animation.") );
	QWhatsThis::add( comboTooltipEffect, i18n( "<p><b>Disable: </b>do not use any tooltip effects.</p>\n"
							"<p><b>Animate: </b>Do some animation.</p>\n"
							"<b>Fade: </b>Fade in tooltips using alpha-blending.") );
	QWhatsThis::add( comboMenuEffect, i18n( "<p><b>Disable: </b>do not use any menu effects.</p>\n"
							"<p><b>Animate: </b>Do some animation.</p>\n"
							"<p><b>Fade: </b>Fade in menus using alpha-blending.</p>\n"
							"<b>Make Translucent: </b>Alpha-blend menus for a see-through effect. (KDE styles only)") );
	QWhatsThis::add( cbMenuShadow, i18n( "When enabled, all popup menus will have a drop-shadow, otherwise "
							"drop-shadows will not be displayed. At present, only KDE styles can have this "
							"effect enabled.") );
	QWhatsThis::add( comboMenuEffectType, i18n( "<p><b>Software Tint: </b>Alpha-blend using a flat color.</p>\n"
							"<p><b>Software Blend: </b>Alpha-blend using an image.</p>\n"
							"<b>XRender Blend: </b>Use the XFree RENDER extension for image blending (if available). "
							"This method may be slower than the Software routines on non-accelerated displays, "
							"but may however improve performance on remote displays.</p>\n") );
	QWhatsThis::add( slOpacity, i18n("By adjusting this slider you can control the menu effect opacity.") );

	// Page3
	QWhatsThis::add( page3, i18n("<b>Note:</b> that all widgets in this combobox "
							"do not apply to Qt-only applications.") );
	QWhatsThis::add( cbHoverButtons, i18n("If this option is selected, toolbar buttons will change "
							"their color when the mouse cursor is moved over them." ) );
	QWhatsThis::add( cbTransparentToolbars, i18n("If you check this box, the toolbars will be "
							"transparent when moving them around.") );
	QWhatsThis::add( cbEnableTooltips, i18n( "If you check this option, the KDE application "
							"will offer tooltips when the cursor remains over items in the toolbar." ) );
	QWhatsThis::add( comboToolbarIcons, i18n( "<p><b>Icons only:</b> Shows only icons on toolbar buttons. "
							"Best option for low resolutions.</p>"
							"<p><b>Text only: </b>Shows only text on toolbar buttons.</p>"
							"<p><b>Text alongside icons: </b> Shows icons and text on toolbar buttons. "
							"Text is aligned alongside the icon.</p>"
							"<b>Text under icons: </b> Shows icons and text on toolbar buttons. "
							"Text is aligned below the icon.") );
	QWhatsThis::add( cbIconsOnButtons, i18n( "If you enable this option, KDE Applications will "
							"show small icons alongside some important buttons.") );
	QWhatsThis::add( cbTearOffHandles, i18n( "If you enable this option some pop-up menus will "
							"show so called tear-off handles. If you click them, you get the menu "
							"inside a widget. This can be very helpful when performing "
							"the same action multiple times.") );
}
示例#5
0
void KCMStyle::styleSpecificConfig()
{
	QString libname = styleEntries[currentStyle()]->configPage;

	// Use KLibLoader to get the library, handling
	// any errors that arise
	KLibLoader* loader = KLibLoader::self();

	KLibrary* library = loader->library( QFile::encodeName(libname) );
	if (!library)
	{
		KMessageBox::detailedError(this,
			i18n("There was an error loading the configuration dialog for this style."),
			loader->lastErrorMessage(),
			i18n("Unable to Load Dialog"));
		return;
	}

	void* allocPtr = library->symbol("allocate_kstyle_config");

	if (!allocPtr)
	{
		KMessageBox::detailedError(this,
			i18n("There was an error loading the configuration dialog for this style."),
			loader->lastErrorMessage(),
			i18n("Unable to Load Dialog"));
		return;
	}

	//Create the container dialog
	StyleConfigDialog* dial = new StyleConfigDialog(this, styleEntries[currentStyle()]->name);
	dial->enableButtonSeparator(true);

	typedef QWidget*(* factoryRoutine)( QWidget* parent );

	//Get the factory, and make the widget.
	factoryRoutine factory      = (factoryRoutine)(allocPtr); //Grmbl. So here I am on my
	//"never use C casts" moralizing streak, and I find that one can't go void* -> function ptr
	//even with a reinterpret_cast.

	QWidget*       pluginConfig = factory( dial );

	//Insert it in...
	dial->setMainWidget( pluginConfig );

	//..and connect it to the wrapper
	connect(pluginConfig, SIGNAL(changed(bool)), dial, SLOT(setDirty(bool)));
	connect(dial, SIGNAL(defaults()), pluginConfig, SLOT(defaults()));
	connect(dial, SIGNAL(save()), pluginConfig, SLOT(save()));

	if (dial->exec() == QDialog::Accepted  && dial->isDirty() ) {
		// Force re-rendering of the preview, to apply settings
		switchStyle(currentStyle(), true);

		//For now, ask all KDE apps to recreate their styles to apply the setitngs
		KIPC::sendMessageAll(KIPC::StyleChanged);

		// We call setStyleDirty here to make sure we force style re-creation
		setStyleDirty();
	}

	delete dial;
}
示例#6
0
QString ApmConfig::quickHelp() const
{
  return i18n("<h1>APM Setup</h1>This module allows you to configure APM for your system");
}
示例#7
0
文件: plugin.cpp 项目: KDE/kdots
 QString Plugin::description() const
 {
   return i18n("Playing with the simple AI");
 }
示例#8
0
QString Launcher::name() const
{
    return i18n("Valgrind");
}
示例#9
0
QString
KAboutData::aboutTranslationTeam()
{
    return i18n("replace this with information about your translation team");
}
// public
void kpMainWindow::addImageOrSelectionCommand (kpCommand *cmd,
    bool addSelCreateCmdIfSelAvail,
    bool addSelPullCmdIfSelAvail)
{
#if DEBUG_KP_MAIN_WINDOW && 1
    kdDebug () << "kpMainWindow::addImageOrSelectionCommand()"
               << " addSelCreateCmdIfSelAvail=" << addSelCreateCmdIfSelAvail
               << " addSelPullCmdIfSelAvail=" << addSelPullCmdIfSelAvail
               << endl;
#endif

    if (!m_document)
    {
        kdError () << "kpMainWindow::addImageOrSelectionCommand() without doc" << endl;
        return;
    }


    if (m_viewManager)
        m_viewManager->setQueueUpdates ();


    kpSelection *sel = m_document->selection ();
#if DEBUG_KP_MAIN_WINDOW && 1
    kdDebug () << "\tsel=" << sel
               << " sel->pixmap=" << (sel ? sel->pixmap () : 0)
               << endl;
#endif
    if (addSelCreateCmdIfSelAvail && sel && !sel->pixmap ())
    {
        // create selection region
        kpCommand *createCommand = new kpToolSelectionCreateCommand (
            i18n ("Selection: Create"),
            *sel,
            this);

        if (kpToolSelectionCreateCommand::nextUndoCommandIsCreateBorder (commandHistory ()))
            commandHistory ()->setNextUndoCommand (createCommand);
        else
            commandHistory ()->addCommand (createCommand,
                                           false/*no exec - user already dragged out sel*/);
    }


    if (addSelPullCmdIfSelAvail && sel && !sel->pixmap ())
    {
        kpMacroCommand *macroCmd = new kpMacroCommand (cmd->name (), this);

        macroCmd->addCommand (new kpToolSelectionPullFromDocumentCommand (
            QString::null/*uninteresting child of macro cmd*/,
            this));

        macroCmd->addCommand (cmd);

        m_commandHistory->addCommand (macroCmd);
    }
    else
    {
        m_commandHistory->addCommand (cmd);
    }


    if (m_viewManager)
        m_viewManager->restoreQueueUpdates ();
}
示例#11
0
QString Launcher::description() const
{
    return i18n("Profile application with Valgrind");
}
示例#12
0
void CommitWidget::enableCommit()
{
	ui->commitErrorLabel->setText(error() ? i18n("You have %1.", m_errorMessage) : QString());
	ui->commitButton->setEnabled(!error());
}
示例#13
0
void HostListItem::paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align )
{
  QColorGroup m_cg( cg );

  // TODO: reuse icons?
  if( column == HostListItem::Video )
  {
    if( m_video ) { // video ?
      if( m_read_only )
        setPixmap( HostListItem::Video, SmallIcon("nmm_option_on_readonly")  );
      else
        setPixmap( HostListItem::Video, SmallIcon("nmm_option_on")  );
    }
    else
      if( ! m_read_only)
        setPixmap( HostListItem::Video, SmallIcon("nmm_option_off") );
  }
  else if( column == HostListItem::Audio )
  {
    if( m_audio ) {// audio ?
      if( m_read_only )
        setPixmap( HostListItem::Audio, SmallIcon("nmm_option_on_readonly")  );
      else
        setPixmap( HostListItem::Audio, SmallIcon("nmm_option_on")  );
    }
    else
      if( ! m_read_only)
        setPixmap( HostListItem::Audio, SmallIcon("nmm_option_off") );
  }
  else if( column ==  HostListItem::Status )
  {
    QFont font( p->font() );
    if( ! m_status  ) // Unknown
    {
      font.setBold( false );
      setText( HostListItem::Status , i18n("Unknown") );
    }
    else if( m_status == NmmEngine::STATUS_OK )
    {
      font.setBold( false );
      m_cg.setColor( QColorGroup::Text, Qt::darkGreen );
      setText( HostListItem::Status , i18n("OK") );
    }
    else { // error
      font.setBold( true );
      m_cg.setColor( QColorGroup::Text, Qt::red );
      setText( HostListItem::Status , i18n("Failed") );
    }
    p->setFont( font );
  }
  else if( column == HostListItem::Volume )
  {
    QPixmap buf( width, height() );
    QColor bg = listView()->viewport()->backgroundColor();
    buf.fill( bg );

    bitBlt( &buf, 0, 0, pixmapVolume( PixInset ) );

    // Draw gradient
    static int padding = 7;
    static int vol; // pixelposition
    if( this == ((HostList*)listView())->m_hoveredVolume )
    {
      vol = listView()->viewportToContents( listView()->viewport()->mapFromGlobal( QCursor::pos() ) ).x();
      vol -= listView()->header()->sectionPos( HostListItem::Volume );
    }
    else
      vol = (m_volume / 2) + 56;

    //std::cerr << "rel vol = " << vol << std::endl;

    static int center = 56;
    if( vol > center ) {
      bitBlt( &buf, 0, 0, pixmapVolume( PixRight ), 0, 0, vol + 1 /* TODO: why + 1??? */ );
    }
    else if ( vol < center ) {
      bitBlt( &buf, vol, 0, pixmapVolume( PixLeft ), vol, 0, 56 );
    }
    else
    {}

    // Calculate actual volume string from pixelposition
    vol = volumeAtPosition( vol );
    QString vol_text;
    if( vol > 0 )
      vol_text = "+";
    vol_text += QString::number( vol );
    vol_text += '%';

    // Draw relative volume number
    QPainter p_number(&buf);
    p_number.setPen( cg.buttonText() );
    QFont font;
    font.setPixelSize( 9 );
    p_number.setFont( font );
    const QRect rect( 40, 0, 34, 15 );
    p_number.drawText( rect, Qt::AlignRight | Qt::AlignVCenter, vol_text );
    p_number.end();
    //bitBlt( p_number.device(), 0, 0, &buf );

    p->drawPixmap( 0, 0, buf );
    return;
  }

  KListViewItem::paintCell(p, m_cg, column, width, align);
}
KisSobelFilter::KisSobelFilter() : KisFilter(id(), categoryEdgeDetection(), i18n("&Sobel..."))
{
    setSupportsPainting(false);
    setSupportsThreading(false); // TODO Sobel doesn't support threading on image with height > 512
}
示例#15
0
QString PlaylistsModel::descr() const
{
    return i18n("Standard playlists");
}
示例#16
0
QString
KAboutData::license() const
{
    return i18n("This program is distributed under the terms of the GPL v2.");
}
示例#17
0
QVariant PlaylistsModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid()) {
        switch (role) {
        case Cantata::Role_TitleText:
            return title();
        case Cantata::Role_SubText:
            return descr();
        case Qt::DecorationRole:
            return icon();
        }
        return QVariant();
    }

    #ifndef ENABLE_UBUNTU
    if (Qt::TextAlignmentRole==role) {
        return alignments[index.column()];
    }
    #endif

    Item *item=static_cast<Item *>(index.internalPointer());

    if (item->isPlaylist()) {
        PlaylistItem *pl=static_cast<PlaylistItem *>(item);

        switch(role) {
        #ifdef ENABLE_UBUNTU
        case Cantata::Role_Image:
            return QString();
        #endif
        case Cantata::Role_ListImage:
            return false;
        case Cantata::Role_IsCollection:
            return true;
        case Cantata::Role_CollectionId:
            return pl->key;
        case Cantata::Role_Key:
            return 0;
        case Cantata::Role_SongWithRating:
        case Cantata::Role_Song: {
            QVariant var;
            var.setValue<Song>(Song());
            return var;
        }
        case Cantata::Role_AlbumDuration:
            return pl->totalTime();
        case Cantata::Role_SongCount:
            if (!pl->loaded) {
                pl->loaded=true;
                emit playlistInfo(pl->name);
            }
            return pl->songs.count();
        case Cantata::Role_CurrentStatus:
        case Cantata::Role_Status:
            return (int)GroupedView::State_Default;
        case Qt::FontRole:
            if (multiCol) {
                QFont font;
                font.setBold(true);
                return font;
            }
            return QVariant();
        case Cantata::Role_TitleText:
        case Cantata::Role_MainText:
        case Qt::DisplayRole:
            if (multiCol) {
                switch (index.column()) {
                case COL_TITLE:
                    return pl->visibleName();
                case COL_ARTIST:
                case COL_ALBUM:
                    return QVariant();
                case COL_LENGTH:
                    if (!pl->loaded) {
                        pl->loaded=true;
                        emit playlistInfo(pl->name);
                    }
                    return pl->loaded && !pl->isSmartPlaylist ? Utils::formatTime(pl->totalTime()) : QVariant();
                case COL_YEAR:
                case COL_GENRE:
                    return QVariant();
                default:
                    break;
                }
            }
            return pl->visibleName();
        case Qt::ToolTipRole:
            if (!Settings::self()->infoTooltips()) {
                return QVariant();
            }
            if (!pl->loaded) {
                pl->loaded=true;
                emit playlistInfo(pl->name);
            }
            return 0==pl->songs.count()
                ? pl->visibleName()
                : pl->visibleName()+"\n"+Plurals::tracksWithDuration(pl->songs.count(), Utils::formatTime(pl->totalTime()));
        #ifndef ENABLE_UBUNTU
        case Qt::DecorationRole:
            return multiCol ? QVariant() : (pl->isSmartPlaylist ? Icons::self()->dynamicRuleIcon : Icons::self()->playlistListIcon);
        #endif
        case Cantata::Role_SubText:
            if (!pl->loaded) {
                pl->loaded=true;
                emit playlistInfo(pl->name);
            }
            if (pl->isSmartPlaylist) {
                return i18n("Smart Playlist");
            }
            return Plurals::tracksWithDuration(pl->songs.count(), Utils::formatTime(pl->totalTime()));
        case Cantata::Role_TitleActions:
            return true;
        default:
            return ActionModel::data(index, role);
        }
    } else {
        SongItem *s=static_cast<SongItem *>(item);

        switch (role) {
        #ifdef ENABLE_UBUNTU
        case Cantata::Role_Image:
            return QString();
        #endif
        case Cantata::Role_ListImage:
            return true;
        case Cantata::Role_IsCollection:
            return false;
        case Cantata::Role_CollectionId:
            return s->parent->key;
        case Cantata::Role_Key:
            return s->key;
        case Cantata::Role_CoverSong:
        case Cantata::Role_SongWithRating:
        case Cantata::Role_Song: {
            QVariant var;
            var.setValue<Song>(*s);
            return var;
        }
        case Cantata::Role_AlbumDuration: {
            quint32 d=s->time;
            for (int i=index.row()+1; i<s->parent->songs.count(); ++i) {
                const SongItem *song = s->parent->songs.at(i);
                if (song->key!=s->key) {
                    break;
                }
                d+=song->time;
            }
            if (index.row()>1) {
                for (int i=index.row()-1; i<=0; ++i) {
                    const SongItem *song = s->parent->songs.at(i);
                    if (song->key!=s->key) {
                        break;
                    }
                    d+=song->time;
                }
            }
            return d;
        }
        case Cantata::Role_SongCount:{
            quint32 count=1;
            for (int i=index.row()+1; i<s->parent->songs.count(); ++i) {
                const SongItem *song = s->parent->songs.at(i);
                if (song->key!=s->key) {
                    break;
                }
                count++;
            }
            if (index.row()>1) {
                for (int i=index.row()-1; i<=0; ++i) {
                    const SongItem *song = s->parent->songs.at(i);
                    if (song->key!=s->key) {
                        break;
                    }
                    count++;
                }
            }
            return count;
        }
        case Cantata::Role_CurrentStatus:
        case Cantata::Role_Status:
            return (int)GroupedView::State_Default;
        case Qt::DisplayRole:
            if (multiCol) {
                switch (index.column()) {
                case COL_TITLE:
                    return s->trackAndTitleStr(false);
                case COL_ARTIST:
                    return s->artist.isEmpty() ? Song::unknown() : s->artist;
                case COL_ALBUM:
                    if (s->isStream() && s->album.isEmpty()) {
                        QString n=s->name();
                        if (!n.isEmpty()) {
                            return n;
                        }
                    }
                    return s->album;
                case COL_LENGTH:
                    return Utils::formatTime(s->time);
                case COL_YEAR:
                    if (s->year <= 0) {
                        return QVariant();
                    }
                    return s->year;
                case COL_GENRE:
                    return s->displayGenre();
                case COL_COMPOSER:
                    return s->composer();
                case COL_PERFORMER:
                    return s->performer();
                default:
                    break;
                }
            }
            return s->entryName();
        case Qt::ToolTipRole:
            if (!Settings::self()->infoTooltips()) {
                return QVariant();
            }
            return s->toolTip();
        #ifndef ENABLE_UBUNTU
        case Qt::DecorationRole:
            return multiCol ? QVariant() : (s->title.isEmpty() ? Icons::self()->streamIcon : Icons::self()->audioListIcon);
        #endif
        case Cantata::Role_MainText:
            return s->title.isEmpty() ? s->file : s->title;
        case Cantata::Role_SubText:
            return s->artist+QLatin1String(" - ")+s->displayAlbum()+QLatin1String(" - ")+Utils::formatTime(s->time);
        default:
            return ActionModel::data(index, role);
        }
    }

    return QVariant();
}
示例#18
0
LinkLookEditWidget::LinkLookEditWidget(KCModule *module, const QString exTitle, const QString exIcon,
                                       QWidget *parent, const char *name, Qt::WFlags fl)
 : QWidget(parent, name, fl)
{
	QLabel      *label;
	QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());

	m_italic = new QCheckBox(i18n("I&talic"), this);
	layout->addWidget(m_italic);

	m_bold = new QCheckBox(i18n("&Bold"), this);
	layout->addWidget(m_bold);

	QGridLayout *gl = new QGridLayout(layout, /*rows=*//*(look->canPreview() ? 5 : 4)*/5, /*columns=*//*3*/4);
	gl->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 1, /*2*/3);

	m_underlining = new QComboBox(false, this);
	m_underlining->insertItem(i18n("Always"));
	m_underlining->insertItem(i18n("Never"));
	m_underlining->insertItem(i18n("On mouse hovering"));
	m_underlining->insertItem(i18n("When mouse is outside"));
	label = new QLabel(m_underlining, i18n("&Underline:"), this);
	gl->addWidget(label,         0, 0);
	gl->addWidget(m_underlining, 0, 1);

	m_color = new KColorCombo2(QRgb(), this);
	label = new QLabel(m_color, i18n("Colo&r:"), this);
	gl->addWidget(label,   1, 0);
	gl->addWidget(m_color, 1, 1);

	m_hoverColor = new KColorCombo2(QRgb(), this);
	label = new QLabel(m_hoverColor, i18n("&Mouse hover color:"), this);
	gl->addWidget(label,        2, 0);
	gl->addWidget(m_hoverColor, 2, 1);

	QHBoxLayout *icoLay = new QHBoxLayout(/*parent=*/0L, /*margin=*/0, KDialog::spacingHint());
	m_iconSize = new IconSizeCombo(false, this);
	icoLay->addWidget(m_iconSize);
	label = new QLabel(m_iconSize, i18n("&Icon size:"), this);
	gl->addWidget(label,  3, 0);
	gl->addItem(  icoLay, 3, 1);

	m_preview = new QComboBox(false, this);
	m_preview->insertItem(i18n("None"));
	m_preview->insertItem(i18n("Icon size"));
	m_preview->insertItem(i18n("Twice the icon size"));
	m_preview->insertItem(i18n("Three times the icon size"));
	m_label = new QLabel(m_preview, i18n("&Preview:"), this);
	m_hLabel = new HelpLabel(
		i18n("You disabled preview but still see images?"),
		i18n("<p>This is normal because there are several type of notes.<br>"
		     "This setting only applies to file and local link notes.<br>"
		     "The images you see are image notes, not file notes.<br>"
		     "File notes are generic documents, whereas image notes are pictures you can draw in.</p>"
		     "<p>When dropping files to baskets, %1 detects their type and shows you the content of the files.<br>"
		     "For instance, when dropping image or text files, image and text notes are created for them.<br>"
		     "For type of files %2 does not understand, they are shown as generic file notes with just an icon or file preview and a filename.</p>"
		     "<p>If you do not want the application to create notes depending on the content of the files you drop, "
		     "go to the \"General\" page and uncheck \"Image or animation\" in the \"View Content of Added Files for the Following Types\" group.</p>",
		// TODO: Note: you can resize down maximum size of images...
			KGlobal::mainComponent().aboutData()->programName(), KGlobal::mainComponent().aboutData()->programName()),
		this);
	gl->addWidget(m_label,   4, 0);
	gl->addWidget(m_preview, 4, 1);
	gl->addMultiCellWidget(m_hLabel, /*fromRow=*/5, /*toRow=*/5, /*fromCol=*/1, /*toCol*/2);

	QGroupBox *gb = new QGroupBox(i18n("Example"), this);
	QHBoxLayout* gbLayout = new QHBoxLayout;
	gb->setLayout(gbLayout);

	m_exLook = new LinkLook;
	m_example = new LinkLabel(exTitle, exIcon, m_exLook, 1, 1);
	gbLayout->addWidget(m_example);
	m_example->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	m_example->setCursor(QCursor(Qt::PointingHandCursor));
	layout->addWidget(gb);
	m_exTitle = exTitle;
	m_exIcon  = exIcon;

	connect( m_italic,      SIGNAL(stateChanged(int)),      this,   SLOT(slotChangeLook()) );
	connect( m_bold,        SIGNAL(stateChanged(int)),      this,   SLOT(slotChangeLook()) );
	connect( m_underlining, SIGNAL(activated(int)),         this,   SLOT(slotChangeLook()) );
	connect( m_color,       SIGNAL(activated(const QColor&)), this,   SLOT(slotChangeLook()) );
	connect( m_hoverColor,  SIGNAL(activated(const QColor&)), this,   SLOT(slotChangeLook()) );
	connect( m_iconSize,    SIGNAL(activated(int)),         this,   SLOT(slotChangeLook()) );
	connect( m_preview,     SIGNAL(activated(int)),         this,   SLOT(slotChangeLook()) );

	connect( m_italic,      SIGNAL(stateChanged(int)),      module, SLOT(changed())        );
	connect( m_bold,        SIGNAL(stateChanged(int)),      module, SLOT(changed())        );
	connect( m_underlining, SIGNAL(activated(int)),         module, SLOT(changed())        );
	connect( m_color,       SIGNAL(activated(const QColor&)), module, SLOT(changed())        );
	connect( m_hoverColor,  SIGNAL(activated(const QColor&)), module, SLOT(changed())        );
	connect( m_iconSize,    SIGNAL(activated(int)),         module, SLOT(changed())        );
	connect( m_preview,     SIGNAL(activated(int)),         module, SLOT(changed())        );
}
示例#19
0
ApmConfig::ApmConfig (QWidget * parent, const char *name)
  : KCModule(parent, name)
{
    KGlobal::locale()->insertCatalogue("klaptopdaemon"); // For translation of klaptopdaemon messages

    config =  new KConfig("kcmlaptoprc");

    QVBoxLayout *top_layout = new QVBoxLayout( this, KDialog::marginHint(),
					       KDialog::spacingHint() );

    QLabel *tmp_label = new QLabel( i18n("This panel lets you configure your APM system and lets "
					"you have access to some of the extra features provided by it"), this );
    tmp_label->setAlignment( Qt::WordBreak );
    top_layout->addWidget( tmp_label );
    
    tmp_label = new QLabel( i18n("NOTE: some APM implementations have buggy suspend/standby "
				"implementations. You should test these features very gingerly - save "
				"all your work, check them on and try a suspend/standby from "
				"the popup menu on the battery icon in the panel if it fails to come "
				"back successfully uncheck the box again."), this );
    tmp_label->setAlignment( Qt::WordBreak );
    top_layout->addWidget( tmp_label );

    tmp_label = new QLabel( i18n("Some changes made on this page may require you to quit the laptop panel "
				"and start it again to take effect"), this );
    tmp_label->setAlignment( Qt::WordBreak );
    top_layout->addWidget( tmp_label );

    bool can_enable = laptop_portable::has_apm(1);	// is helper ready
    enableStandby = new QCheckBox( i18n("Enable standby"), this );
    top_layout->addWidget( enableStandby );
    QToolTip::add( enableStandby, i18n( "If checked this box enables transitions to the 'standby' state - a temporary powered down state" ) );
    enableStandby->setEnabled(can_enable);
    connect( enableStandby, SIGNAL(clicked()), this, SLOT(configChanged()) );

    enableSuspend = new QCheckBox( i18n("Enable &suspend"), this );
    top_layout->addWidget( enableSuspend );
    QToolTip::add( enableSuspend, i18n( "If checked this box enables transitions to the 'suspend' state - a semi-powered down state, sometimes called 'suspend-to-ram'" ) );
    enableSuspend->setEnabled(can_enable);
    connect( enableSuspend, SIGNAL(clicked()), this, SLOT(configChanged()) );
    apm_name = "/usr/bin/apm";
    if (::access(apm_name, F_OK) != 0 && ::access("/usr/sbin/apm", F_OK) == 0) 
	    apm_name = "/usr/sbin/apm";

    tmp_label = new QLabel(i18n("If the above boxes are disabled then there is no 'helper' "
				"application set up to help change APM states, there are two "
				"ways you can enable this application, either make the file "
				"/proc/apm writeable by anyone every time your system boots "
				"or use the button below to make the %1 application "
				"set-uid root").arg(apm_name), this );
    tmp_label->setAlignment( Qt::WordBreak );
    top_layout->addWidget( tmp_label );
    QHBoxLayout *ll = new QHBoxLayout(top_layout);
    QPushButton *setupButton = new QPushButton(i18n("Setup Helper Application"), this);
    connect( setupButton, SIGNAL(clicked()), this, SLOT(setupHelper()) );
    QToolTip::add( setupButton, i18n( "This button can be used to enable the APM helper application" ) );
    ll->addStretch(2);
    ll->addWidget(setupButton);
    ll->addStretch(8);
    if (laptop_portable::has_software_suspend()) {
	tmp_label = new QLabel( i18n("Your system seems to have 'Software Suspend' installed, this can "
				"be used to hibernate or 'suspend to disk' your system if you want "
				"to use this for hibernation check the box below"), this );
	tmp_label->setAlignment( Qt::WordBreak );
	top_layout->addWidget( tmp_label );
     	enableSoftwareSuspendHibernate = new QCheckBox( i18n("Enable software suspend for hibernate"), this );
    	top_layout->addWidget( enableSoftwareSuspendHibernate );
    	QToolTip::add( enableSoftwareSuspendHibernate, i18n( "If checked this box enables transitions to the 'hibernate' state using the 'Software Suspend' mechanism" ) );
    	enableSoftwareSuspendHibernate->setEnabled(laptop_portable::has_software_suspend(2));
    	connect( enableSoftwareSuspendHibernate, SIGNAL(clicked()), this, SLOT(configChanged()) );
	tmp_label = new QLabel( i18n("If the above box is disabled then you need to be logged in "
				"as root or need a helper application to invoke the Software "
				"Suspend utility - KDE provides a utility to do this, if you "
				"wish to use it you must make it set-uid root, the button "
				"below will do this for you"), this );
	tmp_label->setAlignment( Qt::WordBreak );
	top_layout->addWidget( tmp_label );
        ll = new QHBoxLayout(this);
        QPushButton *setupSSButton = new QPushButton(i18n("Setup SS Helper Application"), this);
        connect( setupSSButton, SIGNAL(clicked()), this, SLOT(setupHelper2()) );
        QToolTip::add( setupSSButton, i18n( "This button can be used to enable the Software Suspend helper application" ) );
        ll->addStretch(2);
        ll->addWidget(setupSSButton);
        ll->addStretch(8);
    } else {
	enableSoftwareSuspendHibernate = 0;
    }


    top_layout->addStretch(1);
    top_layout->addWidget( new QLabel( i18n("Version: %1").arg(LAPTOP_VERSION), this), 0, Qt::AlignRight );


    load();      
}
示例#20
0
bool DataObject::loadInputs() {
  bool rc = true;
  QList<QPair<QString,QString> >::Iterator i;

  // FIXME:
#if 0
  vectorList.lock().readLock();
  for (i = _inputVectorLoadQueue.begin(); i != _inputVectorLoadQueue.end(); ++i) {
    VectorList::Iterator it = vectorList.findTag((*i).second);
    if (it != vectorList.end()) {
      assert(*it);
      _inputVectors.insert((*i).first, *it);
    } else {
      Debug::self()->log(i18n("Unable to find required vector [%1] for data object %2.").arg((*i).second).arg(tagName()), Debug::Error);
      rc = false;
    }
  }
  vectorList.lock().unlock();

  scalarList.lock().readLock();
  for (i = _inputScalarLoadQueue.begin(); i != _inputScalarLoadQueue.end(); ++i) {
    ScalarList::Iterator it = scalarList.findTag((*i).second);
    if (it != scalarList.end()) {
      _inputScalars.insert((*i).first, *it);
    } else {
      Debug::self()->log(i18n("Unable to find required scalar [%1] for data object %2.").arg((*i).second).arg(tagName()), Debug::Error);
      rc = false;
    }
  }
  scalarList.lock().unlock();

  stringList.lock().readLock();
  for (i = _inputStringLoadQueue.begin(); i != _inputStringLoadQueue.end(); ++i) {
    StringList::Iterator it = stringList.findTag((*i).second);
    if (it != stringList.end()) {
      _inputStrings.insert((*i).first, *it);
    } else {
      Debug::self()->log(i18n("Unable to find required string [%1] for data object %2.").arg((*i).second).arg(tagName()), Debug::Error);
      rc = false;
    }
  }
  stringList.lock().unlock();

  matrixList.lock().readLock();
  for (i = _inputMatrixLoadQueue.begin(); i != _inputMatrixLoadQueue.end(); ++i) {
    MatrixList::Iterator it = matrixList.findTag((*i).second);
    if (it != matrixList.end()) {
      _inputMatrices.insert((*i).first, *it);
    } else {
      Debug::self()->log(i18n("Unable to find required matrix [%1] for data object %2.").arg((*i).second).arg(tagName()), Debug::Error);
      rc = false;
    }
  }
  matrixList.lock().unlock();
#endif

  _inputVectorLoadQueue.clear();
  _inputScalarLoadQueue.clear();
  _inputStringLoadQueue.clear();
  _inputMatrixLoadQueue.clear();

  setDirty();

  _isInputLoaded = true;
  return rc;
}
示例#21
0
void SystemTray::mousePressEvent(QMouseEvent *event)
{
	if (event->button() & Qt::LeftButton) {          // Prepare drag
		m_pressPos = event->globalPos();
		m_canDrag  = true;
		event->accept();
	} else if (event->button() & Qt::MidButton) {    // Paste
		Global::bnpView->currentBasket()->setInsertPopupMenu();
		Global::bnpView->currentBasket()->pasteNote(QClipboard::Selection);
		Global::bnpView->currentBasket()->cancelInsertPopupMenu();
		if (Settings::usePassivePopup())
			Global::bnpView->showPassiveDropped(i18n("Pasted selection to basket <i>%1</i>"));
		event->accept();
	} else if (event->button() & Qt::RightButton) { // Popup menu
		KMenu menu(this);
		menu.addTitle( SmallIcon("basket"), KGlobal::mainComponent().aboutData()->programName() );

		Global::bnpView->actNewBasket->plug(&menu);
		Global::bnpView->actNewSubBasket->plug(&menu);
		Global::bnpView->actNewSiblingBasket->plug(&menu);
		menu.insertSeparator();
		Global::bnpView->m_actPaste->plug(&menu);
		Global::bnpView->m_actGrabScreenshot->plug(&menu);
		Global::bnpView->m_actColorPicker->plug(&menu);

		if(!Global::bnpView->isPart())
		{
			KAction* action;

			menu.insertSeparator();

			action = Global::bnpView->actionCollection()->action("options_configure_global_keybinding");
			if(action)
				action->plug(&menu);

			action = Global::bnpView->actionCollection()->action("options_configure");
			if(action)
				action->plug(&menu);

			menu.insertSeparator();

			// Minimize / restore : since we manage the popup menu by ourself, we should do that work :
			action = Global::bnpView->actionCollection()->action("minimizeRestore");
			if(action)
			{
				if (Global::mainWindow()->isVisible())
					action->setText(i18n("&Minimize"));
				else
					action->setText(i18n("&Restore"));
				action->plug(&menu);
			}

			action = Global::bnpView->actionCollection()->action("file_quit");
			if(action)
				action->plug(&menu);
		}

		Global::bnpView->currentBasket()->setInsertPopupMenu();
		connect( &menu, SIGNAL(aboutToHide()), Global::bnpView->currentBasket(), SLOT(delayedCancelInsertPopupMenu()) );
		menu.exec(event->globalPos());
		event->accept();
	} else
		event->ignore();
}
示例#22
0
void DataObject::writeLockInputsAndOutputs() const {
  Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);

  #ifdef LOCKTRACE
  qDebug() << (void*)this << " (" << this->type() << ": " << this->tag().tagString() << ") DataObject::writeLockInputsAndOutputs() by tid=" << (int)QThread::currentThread() << endl;
  #endif

  QList<PrimitivePtr> inputs;
  QList<PrimitivePtr> outputs;

  QList<StringPtr> sl = _inputStrings.values();
  for (QList<StringPtr>::Iterator i = sl.begin(); i != sl.end(); ++i) {
    inputs += (*i).data();
  }
  sl = _outputStrings.values();
  for (QList<StringPtr>::Iterator i = sl.begin(); i != sl.end(); ++i) {
    outputs += (*i).data();
  }

  QList<ScalarPtr> sc = _inputScalars.values();
  for (QList<ScalarPtr>::Iterator i = sc.begin(); i != sc.end(); ++i) {
    inputs += (*i).data();
  }
  sc = _outputScalars.values();
  for (QList<ScalarPtr>::Iterator i = sc.begin(); i != sc.end(); ++i) {
    outputs += (*i).data();
  }

  QList<VectorPtr> vl = _inputVectors.values();
  for (QList<VectorPtr>::Iterator i = vl.begin(); i != vl.end(); ++i) {
    inputs += (*i).data();
  }
  vl = _outputVectors.values();
  for (QList<VectorPtr>::Iterator i = vl.begin(); i != vl.end(); ++i) {
    outputs += (*i).data();
  }

  QList<MatrixPtr> ml = _inputMatrices.values();
  for (QList<MatrixPtr>::Iterator i = ml.begin(); i != ml.end(); ++i) {
    inputs += (*i).data();
  }
  ml = _outputMatrices.values();
  for (QList<MatrixPtr>::Iterator i = ml.begin(); i != ml.end(); ++i) {
    outputs += (*i).data();
  }

  qSort(inputs);
  qSort(outputs);

  QList<PrimitivePtr>::ConstIterator inputIt = inputs.begin();
  QList<PrimitivePtr>::ConstIterator outputIt = outputs.begin();

  while (inputIt != inputs.end() || outputIt != outputs.end()) {
    if (inputIt != inputs.end() && (outputIt == outputs.end() || (void*)(*inputIt) < (void*)(*outputIt))) {
      // do input
      if (!(*inputIt)) {
        qWarning() << "Input for data object " << this->tag().displayString() << " is invalid." << endl;
      }
#ifdef LOCKTRACE
      qDebug() << (void*)this << " (" << this->type() << ": " << this->tag().tagString() << ") DataObject::writeLockInputsAndOutputs() by tid=" << (int)QThread::currentThread() << ": write locking input \"" << (*inputIt)->tag().tagString() << "\" (" << (void*)((KstRWLock*)*inputIt) << ")" << endl;
#endif
      (*inputIt)->writeLock();
      ++inputIt;
    } else {
      // do output
      if (!(*outputIt)) {
        qWarning() << "Output for data object " << this->tag().displayString() << " is invalid." << endl;
      }
#ifdef LOCKTRACE
      qDebug() << (void*)this << " (" << this->type() << ": " << this->tag().tagString() << ") DataObject::writeLockInputsAndOutputs() by tid=" << (int)QThread::currentThread() << ": write locking output \"" << (*outputIt)->tag().tagString() << "\" (" << (void*)((KstRWLock*)*outputIt) << ")" << endl;
#endif
      if ((*outputIt)->provider() != this) {
        Debug::self()->log(i18n("(%1) DataObject::writeLockInputsAndOutputs() by tid=%2: write locking output %3 (not provider) -- this is probably an error. Please email [email protected] with details.").arg(this->type()).arg(reinterpret_cast<qint64>(QThread::currentThread())).arg((*outputIt)->tag().tagString()), Debug::Error);
      }
      (*outputIt)->writeLock();
      ++outputIt;
    }
  }
}
示例#23
0
KCMStyle::KCMStyle( QWidget* parent, const char* name )
	: KCModule( parent, name ), appliedStyle(NULL)
{
    setQuickHelp( i18n("<h1>Style</h1>"
			"This module allows you to modify the visual appearance "
			"of user interface elements, such as the widget style "
			"and effects."));

	m_bEffectsDirty = false;
	m_bStyleDirty= false;
	m_bToolbarsDirty = false;

	KGlobal::dirs()->addResourceType("themes",
		KStandardDirs::kde_default("data") + "kstyle/themes");

	KAboutData *about =
		new KAboutData( I18N_NOOP("kcmstyle"),
						I18N_NOOP("KDE Style Module"),
						0, 0, KAboutData::License_GPL,
						I18N_NOOP("(c) 2002 Karol Szwed, Daniel Molkentin"));

	about->addAuthor("Karol Szwed", 0, "*****@*****.**");
	about->addAuthor("Daniel Molkentin", 0, "*****@*****.**");
	about->addAuthor("Ralf Nolden", 0, "*****@*****.**");
	setAboutData( about );

	// Setup pages and mainLayout
	mainLayout = new QVBoxLayout( this );
	tabWidget  = new QTabWidget( this );
	mainLayout->addWidget( tabWidget );

	page1 = new QWidget( tabWidget );
	page1Layout = new QVBoxLayout( page1, KDialog::marginHint(), KDialog::spacingHint() );
	page2 = new QWidget( tabWidget );
	page2Layout = new QVBoxLayout( page2, KDialog::marginHint(), KDialog::spacingHint() );
	page3 = new QWidget( tabWidget );
	page3Layout = new QVBoxLayout( page3, KDialog::marginHint(), KDialog::spacingHint() );

	// Add Page1 (Style)
	// -----------------
	gbWidgetStyle = new QGroupBox( i18n("Widget Style"), page1, "gbWidgetStyle" );
	gbWidgetStyle->setColumnLayout( 0, Qt::Vertical );
	gbWidgetStyle->layout()->setMargin( KDialog::marginHint() );
	gbWidgetStyle->layout()->setSpacing( KDialog::spacingHint() );

	gbWidgetStyleLayout = new QVBoxLayout( gbWidgetStyle->layout() );
	gbWidgetStyleLayout->setAlignment( Qt::AlignTop );
	hbLayout = new QHBoxLayout( KDialog::spacingHint(), "hbLayout" );

	cbStyle = new KComboBox( gbWidgetStyle, "cbStyle" );
	cbStyle->setEditable( FALSE );
	hbLayout->addWidget( cbStyle );

	pbConfigStyle = new QPushButton( i18n("Con&figure..."), gbWidgetStyle );
	pbConfigStyle->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum );
	pbConfigStyle->setEnabled( FALSE );
	hbLayout->addWidget( pbConfigStyle );

	gbWidgetStyleLayout->addLayout( hbLayout );

	lblStyleDesc = new QLabel( gbWidgetStyle );
	lblStyleDesc->setTextFormat(Qt::RichText);
	gbWidgetStyleLayout->addWidget( lblStyleDesc );

	cbIconsOnButtons = new QCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbIconsOnButtons );
	cbEnableTooltips = new QCheckBox( i18n("E&nable tooltips"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbEnableTooltips );
	cbTearOffHandles = new QCheckBox( i18n("Show tear-off handles in &popup menus"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbTearOffHandles );
	cbTearOffHandles->hide(); // reenable when the corresponding Qt method is virtual and properly reimplemented

    QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ), page1 );
	gbPreview->setColumnLayout( 0, Vertical );
	gbPreview->layout()->setMargin( 0 );
	gbPreview->layout()->setSpacing( KDialog::spacingHint() );
	gbPreview->setFlat( true );
	stylePreview = new StylePreview( gbPreview );
	gbPreview->layout()->add( stylePreview );

	page1Layout->addWidget( gbWidgetStyle );
	page1Layout->addWidget( gbPreview );

	// Connect all required stuff
	connect( cbStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) );
	connect( cbStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton()));
	connect( pbConfigStyle, SIGNAL(clicked()), this, SLOT(styleSpecificConfig()));

	// Add Page2 (Effects)
	// -------------------
	cbEnableEffects = new QCheckBox( i18n("&Enable GUI effects"), page2 );
	containerFrame = new QFrame( page2 );
	containerFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
	containerFrame->setMargin(0);
	containerLayout = new QGridLayout( containerFrame, 1, 1,	// rows, columns
		KDialog::marginHint(), KDialog::spacingHint() );

	comboComboEffect = new QComboBox( FALSE, containerFrame );
	comboComboEffect->insertItem( i18n("Disable") );
	comboComboEffect->insertItem( i18n("Animate") );
	lblComboEffect = new QLabel( i18n("Combobo&x effect:"), containerFrame );
	lblComboEffect->setBuddy( comboComboEffect );
	containerLayout->addWidget( lblComboEffect, 0, 0 );
	containerLayout->addWidget( comboComboEffect, 0, 1 );

	comboTooltipEffect = new QComboBox( FALSE, containerFrame );
	comboTooltipEffect->insertItem( i18n("Disable") );
	comboTooltipEffect->insertItem( i18n("Animate") );
	comboTooltipEffect->insertItem( i18n("Fade") );
	lblTooltipEffect = new QLabel( i18n("&Tool tip effect:"), containerFrame );
	lblTooltipEffect->setBuddy( comboTooltipEffect );
	containerLayout->addWidget( lblTooltipEffect, 1, 0 );
	containerLayout->addWidget( comboTooltipEffect, 1, 1 );

	comboMenuEffect = new QComboBox( FALSE, containerFrame );
	comboMenuEffect->insertItem( i18n("Disable") );
	comboMenuEffect->insertItem( i18n("Animate") );
	comboMenuEffect->insertItem( i18n("Fade") );
	comboMenuEffect->insertItem( i18n("Make Translucent") );
	lblMenuEffect = new QLabel( i18n("&Menu effect:"), containerFrame );
	lblMenuEffect->setBuddy( comboMenuEffect );
	containerLayout->addWidget( lblMenuEffect, 2, 0 );
	containerLayout->addWidget( comboMenuEffect, 2, 1 );

	comboMenuHandle = new QComboBox( FALSE, containerFrame );
	comboMenuHandle->insertItem( i18n("Disable") );
	comboMenuHandle->insertItem( i18n("Application Level") );
//	comboMenuHandle->insertItem( i18n("Enable") );
	lblMenuHandle = new QLabel( i18n("Me&nu tear-off handles:"), containerFrame );
	lblMenuHandle->setBuddy( comboMenuHandle );
	containerLayout->addWidget( lblMenuHandle, 3, 0 );
	containerLayout->addWidget( comboMenuHandle, 3, 1 );

	cbMenuShadow = new QCheckBox( i18n("Menu &drop shadow"), containerFrame );
	containerLayout->addWidget( cbMenuShadow, 4, 0 );

	// Push the [label combo] to the left.
	comboSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	containerLayout->addItem( comboSpacer, 1, 2 );

	// Separator.
	QFrame* hline = new QFrame ( page2 );
	hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );

	// Now implement the Menu Transparency container.
	menuContainer = new QFrame( page2 );
	menuContainer->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
	menuContainer->setMargin(0);
	menuContainerLayout = new QGridLayout( menuContainer, 1, 1,    // rows, columns
		KDialog::marginHint(), KDialog::spacingHint() );

	menuPreview = new MenuPreview( menuContainer, /* opacity */ 90, MenuPreview::Blend );

	comboMenuEffectType = new QComboBox( FALSE, menuContainer );
	comboMenuEffectType->insertItem( i18n("Software Tint") );
	comboMenuEffectType->insertItem( i18n("Software Blend") );
#ifdef HAVE_XRENDER
	comboMenuEffectType->insertItem( i18n("XRender Blend") );
#endif

	// So much stuffing around for a simple slider..
	sliderBox = new QVBox( menuContainer );
	sliderBox->setSpacing( KDialog::spacingHint() );
	sliderBox->setMargin( 0 );
	slOpacity = new QSlider( 0, 100, 5, /*opacity*/ 90, Qt::Horizontal, sliderBox );
	slOpacity->setTickmarks( QSlider::Below );
	slOpacity->setTickInterval( 10 );
	QHBox* box1 = new QHBox( sliderBox );
	box1->setSpacing( KDialog::spacingHint() );
	box1->setMargin( 0 );
	QLabel* lbl = new QLabel( i18n("0%"), box1 );
	lbl->setAlignment( AlignLeft );
	lbl = new QLabel( i18n("50%"), box1 );
	lbl->setAlignment( AlignHCenter );
	lbl = new QLabel( i18n("100%"), box1 );
	lbl->setAlignment( AlignRight );

	lblMenuEffectType = new QLabel( comboMenuEffectType, i18n("Menu trans&lucency type:"), menuContainer );
	lblMenuEffectType->setAlignment( AlignBottom | AlignLeft );
	lblMenuOpacity    = new QLabel( slOpacity, i18n("Menu &opacity:"), menuContainer );
	lblMenuOpacity->setAlignment( AlignBottom | AlignLeft );

	menuContainerLayout->addWidget( lblMenuEffectType, 0, 0 );
	menuContainerLayout->addWidget( comboMenuEffectType, 1, 0 );
	menuContainerLayout->addWidget( lblMenuOpacity, 2, 0 );
	menuContainerLayout->addWidget( sliderBox, 3, 0 );
	menuContainerLayout->addMultiCellWidget( menuPreview, 0, 3, 1, 1 );

	// Layout page2.
	page2Layout->addWidget( cbEnableEffects );
	page2Layout->addWidget( containerFrame );
	page2Layout->addWidget( hline );
	page2Layout->addWidget( menuContainer );

	QSpacerItem* sp1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
	page2Layout->addItem( sp1 );

	// Data flow stuff.
	connect( cbEnableEffects,     SIGNAL(toggled(bool)), containerFrame, SLOT(setEnabled(bool)) );
	connect( cbEnableEffects,     SIGNAL(toggled(bool)), this, SLOT(menuEffectChanged(bool)) );
	connect( slOpacity,           SIGNAL(valueChanged(int)),menuPreview, SLOT(setOpacity(int)) );
	connect( comboMenuEffect,     SIGNAL(activated(int)), this, SLOT(menuEffectChanged()) );
	connect( comboMenuEffect,     SIGNAL(highlighted(int)), this, SLOT(menuEffectChanged()) );
	connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(menuEffectTypeChanged()) );
	connect( comboMenuEffectType, SIGNAL(highlighted(int)), this, SLOT(menuEffectTypeChanged()) );

	// Add Page3 (Miscellaneous)
	// -------------------------
	cbHoverButtons = new QCheckBox( i18n("High&light buttons under mouse"), page3 );
	cbTransparentToolbars = new QCheckBox( i18n("Transparent tool&bars when moving"), page3 );

	QWidget * dummy = new QWidget( page3 );
	
	QHBoxLayout* box2 = new QHBoxLayout( dummy, 0, KDialog::spacingHint() );
	lbl = new QLabel( i18n("Text pos&ition:"), dummy );
	comboToolbarIcons = new QComboBox( FALSE, dummy );
	comboToolbarIcons->insertItem( i18n("Icons Only") );
	comboToolbarIcons->insertItem( i18n("Text Only") );
	comboToolbarIcons->insertItem( i18n("Text Alongside Icons") );
	comboToolbarIcons->insertItem( i18n("Text Under Icons") );
	lbl->setBuddy( comboToolbarIcons );

	box2->addWidget( lbl );
	box2->addWidget( comboToolbarIcons );
	QSpacerItem* sp2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	box2->addItem( sp2 );
	
	page3Layout->addWidget( cbHoverButtons );
	page3Layout->addWidget( cbTransparentToolbars );
	page3Layout->addWidget( dummy );
	
	// Layout page3.
	QSpacerItem* sp3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
	page3Layout->addItem( sp3 );

	// Load settings
	load();

	// Do all the setDirty connections.
	connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	// Page2
	connect( cbEnableEffects,     SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbEnableEffects,     SIGNAL(toggled(bool)),    this, SLOT(setStyleDirty()));
	connect( comboTooltipEffect,  SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
	connect( comboComboEffect,    SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
	connect( comboMenuEffect,     SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( comboMenuHandle,     SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( slOpacity,           SIGNAL(valueChanged(int)),this, SLOT(setStyleDirty()));
	connect( cbMenuShadow,        SIGNAL(toggled(bool)),    this, SLOT(setStyleDirty()));
	// Page3
	connect( cbHoverButtons,        SIGNAL(toggled(bool)),    this, SLOT(setToolbarsDirty()));
	connect( cbTransparentToolbars, SIGNAL(toggled(bool)),    this, SLOT(setToolbarsDirty()));
	connect( cbEnableTooltips,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbIconsOnButtons,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbTearOffHandles,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( comboToolbarIcons,     SIGNAL(activated(int)), this, SLOT(setToolbarsDirty()));

	addWhatsThis();

	// Insert the pages into the tabWidget
	tabWidget->insertTab( page1, i18n("&Style"));
	tabWidget->insertTab( page2, i18n("&Effects"));
	tabWidget->insertTab( page3, i18n("&Toolbar"));

	//Enable/disable the button for the initial style
	updateConfigButton();
}
示例#24
0
QString CommentedTime::comment() const          {
    return (c.isEmpty() ? i18n("Marker") : c);
}
示例#25
0
void KCMStyle::save()
{
	// Don't do anything if we don't need to.
	if ( !(m_bToolbarsDirty | m_bEffectsDirty | m_bStyleDirty ) )
		return;

	bool allowMenuTransparency = false;
	bool allowMenuDropShadow   = false;

	// Read the KStyle flags to see if the style writer
	// has enabled menu translucency in the style.
	if (appliedStyle && appliedStyle->inherits("KStyle"))
	{
		allowMenuDropShadow = true;
		KStyle* style = dynamic_cast<KStyle*>(appliedStyle);
		if (style) {
			KStyle::KStyleFlags flags = style->styleFlags();
			if (flags & KStyle::AllowMenuTransparency)
				allowMenuTransparency = true;
		}
	}

	QString warn_string( i18n("<qt>Selected style: <b>%1</b><br><br>"
		"One or more effects that you have chosen could not be applied because the selected "
		"style does not support them; they have therefore been disabled.<br>"
		"<br>" ).arg( cbStyle->currentText()) );
	bool show_warning = false;

	// Warn the user if they're applying a style that doesn't support
	// menu translucency and they enabled it.
    if ( (!allowMenuTransparency) &&
		(cbEnableEffects->isChecked()) &&
		(comboMenuEffect->currentItem() == 3) )	// Make Translucent
    {
		warn_string += i18n("Menu translucency is not available.<br>");
		comboMenuEffect->setCurrentItem(0);    // Disable menu effect.
		show_warning = true;
	}

	if (!allowMenuDropShadow && cbMenuShadow->isChecked())
	{
		warn_string += i18n("Menu drop-shadows are not available.");
		cbMenuShadow->setChecked(false);
		show_warning = true;
	}

	// Tell the user what features we could not apply on their behalf.
	if (show_warning)
		KMessageBox::information(this, warn_string);


	// Save effects.
	KConfig config( "kdeglobals" );
	config.setGroup("KDE");

	config.writeEntry( "EffectsEnabled", cbEnableEffects->isChecked());
	int item = comboComboEffect->currentItem();
	config.writeEntry( "EffectAnimateCombo", item == 1 );
	item = comboTooltipEffect->currentItem();
	config.writeEntry( "EffectAnimateTooltip", item == 1);
	config.writeEntry( "EffectFadeTooltip", item == 2 );
	item = comboMenuHandle->currentItem();
	config.writeEntry( "InsertTearOffHandle", item );
	item = comboMenuEffect->currentItem();
	config.writeEntry( "EffectAnimateMenu", item == 1 );
	config.writeEntry( "EffectFadeMenu", item == 2 );

	// Handle KStyle's menu effects
	QString engine("Disabled");
	if (item == 3 && cbEnableEffects->isChecked())	// Make Translucent
		switch( comboMenuEffectType->currentItem())
		{
			case 1: engine = "SoftwareBlend"; break;
			case 2: engine = "XRender"; break;
			default:
			case 0: engine = "SoftwareTint"; break;
		}

	{	// Braces force a QSettings::sync()
		QSettings settings;	// Only for KStyle stuff
		settings.writeEntry("/KStyle/Settings/MenuTransparencyEngine", engine);
		settings.writeEntry("/KStyle/Settings/MenuOpacity", slOpacity->value()/100.0);
 		settings.writeEntry("/KStyle/Settings/MenuDropShadow",
					   		cbEnableEffects->isChecked() && cbMenuShadow->isChecked() );
	}

	// Misc page
	config.writeEntry( "ShowIconsOnPushButtons", cbIconsOnButtons->isChecked(), true, true );
	config.writeEntry( "EffectNoTooltip", !cbEnableTooltips->isChecked(), true, true );

	config.setGroup("General");
	config.writeEntry( "widgetStyle", currentStyle() );

	config.setGroup("Toolbar style");
	config.writeEntry( "Highlighting", cbHoverButtons->isChecked(), true, true );
	config.writeEntry( "TransparentMoving", cbTransparentToolbars->isChecked(), true, true );
	QString tbIcon;
	switch( comboToolbarIcons->currentItem() )
	{
		case 1: tbIcon = "TextOnly"; break;
		case 2: tbIcon = "IconTextRight"; break;
		case 3: tbIcon = "IconTextBottom"; break;
		case 0:
		default: tbIcon = "IconOnly"; break;
	}
	config.writeEntry( "IconText", tbIcon, true, true );
	config.sync();

	// Export the changes we made to qtrc, and update all qt-only
	// applications on the fly, ensuring that we still follow the user's
	// export fonts/colors settings.
	if (m_bStyleDirty | m_bEffectsDirty)	// Export only if necessary
	{
		uint flags = KRdbExportQtSettings;
		KConfig kconfig("kcmdisplayrc", true /*readonly*/, false /*no globals*/);
		kconfig.setGroup("X11");
		bool exportKDEColors = kconfig.readBoolEntry("exportKDEColors", true);
		if (exportKDEColors)
			flags |= KRdbExportColors;
		runRdb( flags );
	}

	// Now allow KDE apps to reconfigure themselves.
	if ( m_bStyleDirty )
		KIPC::sendMessageAll(KIPC::StyleChanged);

	if ( m_bToolbarsDirty )
		// ##### FIXME - Doesn't apply all settings correctly due to bugs in
		// KApplication/KToolbar
		KIPC::sendMessageAll(KIPC::ToolbarStyleChanged);

	if (m_bEffectsDirty) {
		KIPC::sendMessageAll(KIPC::SettingsChanged);
		kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
	}
        //update kicker to re-used tooltips kicker parameter otherwise, it overwritted
        //by style tooltips parameters.
        QByteArray data;
        kapp->dcopClient()->send( "kicker", "kicker", "configure()", data );

	// Clean up
	m_bEffectsDirty  = false;
	m_bToolbarsDirty = false;
	m_bStyleDirty    = false;
	emit changed( false );
}
示例#26
0
QString CommentedTime::hash() const
{
    return QString::number(type) + ":" + (c.isEmpty() ? i18n("Marker") : c);
}
示例#27
0
文件: walk.c 项目: cglinden/autocook
static void
implications_of_file(graph_recipe_list_nrc_ty *walk, graph_file_ty *gfp,
    int uptodate)
{
    size_t          k;
    graph_recipe_ty *grp2;

    trace(("implications_of_file(walk=%08lX, gfp=%08lX)\n{\n", (long)walk,
        (long)gfp));
    gfp->input_satisfied++;
    if (uptodate)
        gfp->input_uptodate++;
    trace(("walked \"%s\" file (%ldth of %ld recipes)\n",
        gfp->filename->str_text, (long)gfp->input_satisfied,
        (long)gfp->input->nrecipes));
    if (gfp->input_satisfied < gfp->input->nrecipes)
    {
        if (!uptodate)
        {
            /*
             * If a file is constructed by more than one
             * recipe, the mod-time will be updated, making
             * the rest of the recipes (potentially) decide
             * they have nothing to do.  Set their "force"
             * flag to make sure they do something.
             */
            for (k = 0; k < gfp->input->nrecipes; ++k)
            {
                grp2 = gfp->input->recipe[k];
                assert(grp2);
                grp2->multi_forced = 1;
            }
        }

        trace(("...come back later\n"));
        trace(("}\n"));
        return;
    }

    /*
     * All of the input to the file are
     * satisfied.  Are all of the inputs to
     * the implied recipes satisfied?
     */
    trace(("check %ld recipe outputs\n", (long)gfp->output->nrecipes));
    for (k = 0; k < gfp->output->nrecipes; ++k)
    {
        grp2 = gfp->output->recipe[k];
        assert(grp2);
        grp2->input_satisfied++;
        if (gfp->input_uptodate == gfp->input_satisfied)
            grp2->input_uptodate++;
        trace(("walked %s:%d recipe (%ldth of %ld files)\n",
            (grp2->rp->pos.pos_name ? grp2->rp->pos.pos_name->str_text : ""),
            (int)grp2->rp->pos.pos_line,
            (long)grp2->input_satisfied,
            (long)grp2->input->nfiles));
        if (grp2->input_satisfied < grp2->input->nfiles)
        {
            trace(("...come back later\n"));
            continue;
        }

        /*
         * You always push the recipe, even if you think
         * everything is up-to-date.  It may have a
         * use-clause, it may be a script or some other
         * traversal.  Always push.
         */
        trace(("recipe ingredients satisfied, push %08lX\n", (long)grp2));
        graph_recipe_list_nrc_append(walk, grp2);
    }

    /*
     * Print a nice warm fuzzy message when a top-level target
     * needs no work.
     */
    if
    (
        gfp->primary_target
    &&
        gfp->input_uptodate >= gfp->input->nrecipes
    &&
        !option_test(OPTION_SILENT)
    )
    {
        sub_context_ty  *scp;

        scp = sub_context_new();
        sub_var_set_string(scp, "File_Name", gfp->filename);
        error_intl(scp, i18n("$filename: already up to date"));
        sub_context_delete(scp);
    }
    trace(("}\n"));
}
示例#28
0
QString PlaylistsModel::title() const
{
    return i18n("Stored Playlists");
}
示例#29
0
KisLsOverlayFilter::KisLsOverlayFilter(Mode mode)
    : KisLayerStyleFilter(KoID("lsoverlay", i18n("Overlay (style)"))),
      m_mode(mode)
{
}
示例#30
0
/**
 * Return wind direction svg element to display in applet when given a wind direction.
 */
QString IonInterface::getWindDirectionIcon(const QMap<QString, WindDirections> &windDirList, const QString& windDirection) const
{
    switch (windDirList[windDirection.toLower()]) {
    case N:
        return i18n("N");
    case NNE:
        return i18n("NNE");
    case NE:
        return i18n("NE");
    case ENE:
        return i18n("ENE");
    case E:
        return i18n("E");
    case SSE:
        return i18n("SSE");
    case SE:
        return i18n("SE");
    case ESE:
        return i18n("ESE");
    case S:
        return i18n("S");
    case NNW:
        return i18n("NNW");
    case NW:
        return i18n("NW");
    case WNW:
        return i18n("WNW");
    case W:
        return i18n("W");
    case SSW:
        return i18n("SSW");
    case SW:
        return i18n("SW");
    case WSW:
        return i18n("WSW");
    case VR:
        return i18n("N/A"); // For now, we'll make a variable wind icon later on
    }

    // No icon available, use 'X'
    return i18n("N/A");
}