Logo Search packages:      
Sourcecode: kbfx version File versions  Download package

kbfxconfigdlgbutton.ui.h

/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/

void KbfxConfigDlgButton::init()
{
  connect(this, SIGNAL(KbfxConfigDlgButtonChanged(const char *, const QString &)),
          this, SLOT(ChangeForm(const char *, const QString &)));
}

/* actions performed when url is selected */
void KbfxConfigDlgButton::KbfxURLRequesterNormalUrlSelected(const QString &selected_img_path)
{
  emit KbfxConfigDlgButtonChanged("normal", selected_img_path);
  kdDebug() << "Sending: normal + " << selected_img_path << endl;
}

void KbfxConfigDlgButton::KbfxURLRequesterPressedUrlSelected(const QString &selected_img_path)
{
  emit KbfxConfigDlgButtonChanged("pressed", selected_img_path);
  kdDebug() << "Sending: pressed + " << selected_img_path << endl;
}

void KbfxConfigDlgButton::KbfxURLRequesterHoverUrlSelected(const QString &selected_img_path)
{
  emit KbfxConfigDlgButtonChanged("hover", selected_img_path);
  kdDebug() << "Sending: hover + " << selected_img_path << endl;
}

void KbfxConfigDlgButton::KbfxButtonToggled(bool)
{
  if(KbfxButton->state() == 2)
    KbfxButton->setPixmap(ConfigInit().m_KbfxPressedButtonPath);

  if(KbfxButton->state() == 0)
    KbfxButton->setPixmap(ConfigInit().m_KbfxNormalButtonPath);
}

/* url processing */
void KbfxConfigDlgButton::ChangeForm(const char *name, const QString &path)
{
  kdDebug() << "Received: "  << name << " + " << path << endl;

  QString tmppath = path;
  if(tmppath.startsWith("file://")) tmppath.remove( "file://" );

  QImage tmp(tmppath);

  QString tmpname = name;
  if(tmpname == "pressed")
  {
    if(tmp.isNull())
    {
      KMessageBox::error(0,
                         tr2i18n("Image cannot be used as a pressed button skin!"
                                 "\nWill use default pressed button skin."),
                         tr2i18n("Error loading image"));
      tmppath = ConfigInit().m_KbfxPressedButtonPathDefault;
    }

    kdDebug() << tmpname << " :: " << tmppath << endl;

    KbfxURLRequesterPressed->setURL(tmppath);
    KbfxPixmapLabelPressed->setPixmap(tmppath);
    ConfigInit().m_KbfxPressedButtonPath = tmppath;

    if(KbfxButton->state() == 2)
      KbfxButton->setPixmap(ConfigInit().m_KbfxPressedButtonPath);
  }

  if(tmpname == "normal")
  {
    if(tmp.isNull())
    {
      KMessageBox::error(0,
                         tr2i18n("Image cannot be used as a normal button skin!"
                                 "\nWill use default normal button skin."),
                         tr2i18n("Error loading image"));
      tmppath = ConfigInit().m_KbfxNormalButtonPathDefault;
    }

    kdDebug() << tmpname << " :: "  << tmppath << endl;

    KbfxURLRequesterNormal->setURL(tmppath);
    KbfxPixmapLabelNormal->setPixmap(tmppath);
    ConfigInit().m_KbfxNormalButtonPath = tmppath;

    if(KbfxButton->state() == 0)
      KbfxButton->setPixmap(ConfigInit().m_KbfxNormalButtonPath);
  }

  if (tmpname == "hover")
  {
    if(tmp.isNull())
    {
      KMessageBox::error(0,
                         tr2i18n("Image cannot be used as a hover button skin!"
                                 "\nWill use default hover button skin."),
                         tr2i18n("Error loading image"));
      tmppath = ConfigInit().m_KbfxHoverButtonPathDefault;
    }

    kdDebug() << tmpname << " :: " << tmppath << endl;

    KbfxURLRequesterHover->setURL(tmppath);
    KbfxPixmapLabelHover->setPixmap(tmppath);
    ConfigInit().m_KbfxHoverButtonPath = tmppath;
  }
}

/* initialize Button page at the beginning or after "Default" pressed */
void KbfxConfigDlgButton::ChangeForm()
{
  KbfxURLRequesterNormal->setURL(ConfigInit().m_KbfxNormalButtonPath);
  KbfxURLRequesterPressed->setURL(ConfigInit().m_KbfxPressedButtonPath);
  KbfxURLRequesterHover->setURL(ConfigInit().m_KbfxHoverButtonPath);
  KbfxPixmapLabelNormal->setPixmap(ConfigInit().m_KbfxNormalButtonPath);
  KbfxPixmapLabelPressed->setPixmap(ConfigInit().m_KbfxPressedButtonPath);
  KbfxPixmapLabelHover->setPixmap(ConfigInit().m_KbfxHoverButtonPath);
  KbfxButtonToggled(1);
  
  if(ConfigInit().m_ToolBarResize == TRUE && KbfxResizeKicker->state() == 0)
    KbfxResizeKicker->toggle();
  if(ConfigInit().m_ToolBarResize == FALSE && KbfxResizeKicker->state() == 2)
    KbfxResizeKicker->toggle();
}


void KbfxConfigDlgButton::KbfxResizeKickerToggled( bool )
{
  if(KbfxResizeKicker->state() == 2)
  {
    KbfxResizeKicker->setText(tr2i18n("Toolbar Resize 'ON'"));
    ConfigInit().m_ToolBarResize = TRUE;
  }

  if(KbfxResizeKicker->state() == 0)
  {
    KbfxResizeKicker->setText(tr2i18n("Toolbar Resize 'OFF'"));
    ConfigInit().m_ToolBarResize = FALSE;
  }

  kdDebug() << "Toolbar Resize is: "
            << ConfigInit().m_ToolBarResize
            << endl;

}

Generated by  Doxygen 1.6.0   Back to index