Example #1
0
MapEditorWidget::MapEditorWidget(QWidget * parent)
  : QWidget(parent)
{
  
  int width = 700;
  int height = 350;
  plotArea = QRectF(70,15,width-85,height-35);
  pointSize = QSize(11, 11);
  currentIndex = -1;
  pointPen = QPen(QColor("#26466D"), 1);
  connectionPen = QPen(QColor("#B2DFEE"), 4);
  pointBrush = QBrush(QColor(0x1fb2dfee));
  setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
  setMinimumSize(width,height);
  popup = NULL;
  setToolTip("<p>Drag,left,right and double click to move,insert, delete"
	     " and change value of a point.</p>");
  connect(this, SIGNAL(pointsChanged(const QPolygonF &)),
	  this, SLOT(update()));  
}
void
PlayableItemWidget::setStation(const RadioStation& rs, const QString& title, const QString& description)
{
    // disconnect from recieving any previous signals
    disconnect( this, 0 );

    m_rs = rs;
    m_rs.setTitle( title );
    setText( title.isEmpty() ? tr( "A Radio Station" ) :  title );
    setToolTip( tr( "Play %1" ).arg( text() ) );

    m_description = description;

    connect( &RadioService::instance(), SIGNAL(tuningIn(RadioStation)), SLOT(onRadioChanged(RadioStation)) );
    connect( &RadioService::instance(), SIGNAL(trackSpooled(Track)), SLOT(onRadioChanged()));

    connect( this, SIGNAL(clicked()), SLOT(play()));

    update();
}
//!
//! Process hover enter events.
//!
void ConnectionGraphicsItem::hoverEnterEvent ( QGraphicsSceneHoverEvent *event )
{
    m_hovered = true;
    if (m_connection) {
        Parameter *sourceParameter = m_connection->getSourceParameter();
        Parameter *targetParameter = m_connection->getTargetParameter();
        if (sourceParameter && targetParameter) {
            Node *sourceNode = sourceParameter->getNode();
            Node *targetNode = targetParameter->getNode();
            if (sourceNode && targetNode) {
                QString sourceNodeName = sourceNode->getName();
                QString targetNodeName = targetNode->getName();
                QString sourceParameterName = sourceParameter->getName();
                QString targetParameterName = targetParameter->getName();
                setToolTip(sourceNodeName + "." + sourceParameterName + " --> " + targetNodeName + "." + targetParameterName);
            }
        }
    }
    update();
}
MappingDouble::MappingDouble(MappingWidget* parent, ControllerEmu::NumericSetting<double>* setting)
    : QDoubleSpinBox(parent), m_setting(*setting)
{
  setRange(m_setting.GetMinValue(), m_setting.GetMaxValue());
  setDecimals(2);

  if (const auto ui_suffix = m_setting.GetUISuffix())
    setSuffix(QStringLiteral(" ") + tr(ui_suffix));

  if (const auto ui_description = m_setting.GetUIDescription())
    setToolTip(tr(ui_description));

  connect(this, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
          [this, parent](double value) {
            m_setting.SetValue(value);
            parent->SaveSettings();
          });

  connect(parent, &MappingWidget::ConfigChanged, this, &MappingDouble::ConfigChanged);
}
Example #5
0
bool FileOrganiserWidget::viewportEvent(QEvent *pEvent)
{
    if (pEvent->type() == QEvent::ToolTip) {
        // We need to show a tool tip, so make sure that it's up to date by
        // setting it to the path of the current file item or to nothing if we
        // are dealing with a folder item

        QHelpEvent *helpEvent = static_cast<QHelpEvent *>(pEvent);
        QStandardItem *crtItem = mModel->itemFromIndex(indexAt(helpEvent->pos()));

        if (crtItem)
            setToolTip(QDir::toNativeSeparators(crtItem->data(Item::Folder).toBool()?
                                                    "":
                                                    crtItem->data(Item::Path).toString()));
    }

    // Default handling of the event

    return TreeViewWidget::viewportEvent(pEvent);
}
Example #6
0
///namespace KGraphViewer
///{
//
// PannerView
//
PannerView::PannerView(DotGraphView * parent, const char * name)
  : QGraphicsView(parent), m_drawContents(true), m_parent(parent)
{
  m_movingZoomRect = false;

  // why doesn't this avoid flicker ?
  // viewport()->setBackgroundMode(Qt::NoBackground);
  ///setBackgroundMode(Qt::NoBackground);
  setAttribute(Qt::WA_NoSystemBackground);

  // if there are ever graphic glitches to be found, remove this again
  setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing | QGraphicsView::DontClipPainter |
                        QGraphicsView::DontSavePainterState);

  setToolTip("View of the complete graph. Click and drag to move the visible part.");
  setWhatsThis("<h1>View of the Complete Graph</h1>"
    "<p>Single clicking somewhere without the red square will move the center of the "
    "view to where the mouse was clicked.</p><p>Clicking and dragging within the red square "
    "will cause the view to follow the movement.</p>");
}
Example #7
0
CardItem::CardItem(const Card *card)
    :Pixmap(card->getPixmapPath(), false), card(card), filtered_card(card), auto_back(true),
      is_pending(false)
{
    Q_ASSERT(card != NULL);

    suit_pixmap.load(QString("image/system/suit/%1.png").arg(card->getSuitString()));
    icon_pixmap.load(card->getIconPath());
    setTransformOriginPoint(pixmap.width()/2, pixmap.height()/2);

    setToolTip(card->getDescription());
    setAcceptHoverEvents(true);

    QPixmap frame_pixmap("image/system/frame/good.png");
    frame = new QGraphicsPixmapItem(frame_pixmap, this);
    frame->setPos(-6, -6);
    frame->hide();

    avatar = NULL;
}
Example #8
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0)
{
    setToolTip("Seafile");
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

#if defined(Q_WS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Example #9
0
UrsusTrayIcon::UrsusTrayIcon(const QString &icon, KXmlGuiWindow *parent, UrsusPlayer *player_) : KSystemTrayIcon(icon, parent){
// 	qDebug() << this << "constructor()";
	player=player_;

	QMenu *cm=contextMenu();
	cm->addAction(parent->actionCollection()->action("mute"));
	cm->addSeparator();
	cm->addAction(parent->actionCollection()->action("previous"));
	cm->addAction(parent->actionCollection()->action("play"));
	cm->addAction(parent->actionCollection()->action("pause"));
	cm->addAction(parent->actionCollection()->action("stop"));
	cm->addAction(parent->actionCollection()->action("next"));

	setToolTip("Ursus Music Player");

	connect(
		player->Object(),	SIGNAL(stateChanged(Phonon::State, Phonon::State)),
		this,				SLOT(setStateIcon(Phonon::State, Phonon::State))
	);
}
Example #10
0
void PluginCreator::load()
      {
      if (path.isEmpty())
            return;
      QFile f(path);
      QFileInfo fi(f);
      if (f.open(QIODevice::ReadOnly)) {
            textEdit->setPlainText(f.readAll());
            run->setEnabled(true);
            f.close();
            }
      else {
            path = QString();
            }
      created = false;
      setState(PCState::CLEAN);
      setTitle( fi.baseName() );
      setToolTip(path);
      raise();
      }
    ExplorerFunctionTreeItem::ExplorerFunctionTreeItem(QTreeWidgetItem *parent,MongoDatabase *database, const MongoFunction &function) :
        BaseClass(parent),
        _function(function),
        _database(database)
    {

        QAction *dropFunction = new QAction("Remove Function", this);
        connect(dropFunction, SIGNAL(triggered()), SLOT(ui_dropFunction()));

        QAction *editFunction = new QAction("Edit Function", this);
        connect(editFunction, SIGNAL(triggered()), SLOT(ui_editFunction()));

        BaseClass::_contextMenu->addAction(editFunction);
        BaseClass::_contextMenu->addAction(dropFunction);

        setText(0, QtUtils::toQString(_function.name()));
        setIcon(0, GuiRegistry::instance().functionIcon());
        setToolTip(0, buildToolTip(_function));
        setExpanded(false);
    }
QVariant QColorTransferFunctionGraphicalViewNode::itemChange(GraphicsItemChange change, const QVariant &value)
{
    if (change == ItemPositionChange)
    {
        // value is the new position
        QPointF newPosition = value.toPointF();
        newPosition.setY(0.0);
        setToolTip(QString("%1").arg(newPosition.x()));
        return newPosition;
    }
    else if (change == ItemPositionHasChanged)
    {
        m_view->requestBackgroundUpdate();
        return value;
    }
    else
    {
        return QGraphicsItem::itemChange(change, value);
    }
}
Example #13
0
void Deskfolder::init()
{
    setFixedSize(100, 50);
    zoom = false;
    selected = false;
    setToolTip(dir_path);
    pix = QPixmap(d_folder_pix); // set default pixmap
    main_menu = new QMenu(this);
    // show the Category apps list for open the file
    open_menu = main_menu->addMenu(QIcon(open_with_pix), tr("Open with"));

    QList <QMenu *> menu_list = cat_menu->get_menus();
    for (int i = 0; i <  menu_list.size(); ++i)
    {
        open_menu->addMenu(menu_list.at(i));
    }

    delete_folder = main_menu->addAction(QIcon(delete_link_pix), tr("Delete link"));
    connect(delete_folder, SIGNAL(triggered()), this, SLOT(del_folder()));
}
Example #14
0
ClientRegion::ClientRegion(const QString& name) : Region(15) {
  this->name = name;

  setToolTip(name);

  QBrush brush(Qt::FDiagPattern);
  brush.setColor(Qt::magenta);

  QPen pen;
  pen.setColor(Qt::magenta);
  pen.setWidthF(1);

  setBrush(brush);
  setPen(pen);

  //setAcceptDrops(true);
  setFlag(QGraphicsItem::ItemIsSelectable, true);
  setFlag(QGraphicsItem::ItemIsMovable, false);
  setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
}
OrchestratorChooser::OrchestratorChooser(GuiHelper *guiHelper, SourcesOrchestatorAbstract *orchestrator, QWidget *parent) :
    QComboBox(parent),
    orchestrator(orchestrator),
    guiHelper(guiHelper)
{

    addItem(tr("Select IO type"));
    QStandardItem * item = qobject_cast<QStandardItemModel *>(model())->item(0); // there is one and only one item right now
    item->setEnabled( false );
    addItems(SourcesOrchestatorAbstract::OrchestratorsList);

    setToolTip(tr("Select a configuration"));

    if (orchestrator != nullptr) {
        setCurrentIndex(orchestrator->getType());
    }

    //connect(this, qOverload<int>(&OrchestratorChooser::currentIndexChanged), this, &OrchestratorChooser::onSelection);
    connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelection(int)));
}
Example #16
0
ShapedClock::ShapedClock(QWidget *parent)
    : QWidget(parent, Qt::FramelessWindowHint |
              //Qt::WindowStaysOnTopHint |
              Qt::Tool )
{
    //QAction *quitAction = new QAction(tr("E&xit"), this);
    //quitAction->setShortcut(tr("Ctrl+Q"));
    //connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    //addAction(quitAction);

    //setContextMenuPolicy(Qt::ActionsContextMenu);
    setToolTip( "双击显示或隐藏最近未查看客户悬浮窗口。" );
    setWindowTitle( "" );

    setStyleSheet( "background-color: rgb(255, 0, 0);" );
    bVisible = false;

    nCaptionButtonWidth = GetSystemMetrics( SM_CXSIZE );
    nCaptionButtonHeight = GetSystemMetrics( SM_CYSIZE );
}
Example #17
0
MountButton::MountButton(QWidget * parent, RazorPanel *panel) :
    QToolButton(parent),
    mPopup(this),
    m_panel(panel),
    mDevAction(DevActionInfo),
    mPopupHideDelay(5000)
{
    if (!QDBusConnection::systemBus().isConnected())
    {
        qWarning() << "Can't connect to dbus daemon. Some functions will be omited";
    }

    setIcon(XdgIcon::fromTheme(QStringList() << "device-notifier" << "drive-removable-media-usb"));
    setToolTip(tr("Removable media/devices manager"));

    initialScanDevices();

    QDBusConnection conn = QDBusConnection::systemBus();
    // TODO: Check for connection, timer for reconect
    /*bool connected =*/ conn.connect("org.freedesktop.UDisks",
                                  "/org/freedesktop/UDisks",
                                  "org.freedesktop.UDisks",
                                  "DeviceChanged",
                                  this,
                                  SLOT(onDbusDeviceChangesMessage(QDBusObjectPath)));


    connect(&mPopup, SIGNAL(visibilityChanged(bool)), this, SLOT(setDown(bool)));

    connect(m_panel, SIGNAL(positionChanged()), &mPopup, SLOT(hide()));

    connect(this, SIGNAL(clicked()), this, SLOT(showHidePopup()));

    connect(&_dm, SIGNAL(deviceConnected(DiskInfo)),
            this, SLOT(onDiskAdded(DiskInfo)));

    connect(&_dm, SIGNAL(deviceDisconnected(DiskInfo)),
            this, SLOT(onDiskRemoved(DiskInfo)));

    _dm.start();
}
//闪动图标
//Flash the icon
void SystemTrayIconBase::showFlash(const QIcon &icon, const QString &toolTip, QMenu *menu,
                                   int millisecondsTimeoutHint) {
    
    qDebug()<<"----SystemTrayIconBase::showFlash(const QIcon &icon, ...)";
    
    
        
    this->m_currentData.setToolTip(toolTip);
    this->m_currentData.setMenu(menu);
    this->m_currentData.settrayIconType(TrayIconData::TRAYICON_Flash);
    this->m_currentData.setFirstIcon(icon);
    
    
    disconnect(timer, SIGNAL(timeout()), 0, 0);
    timer->stop();
    
    iconQueue.append(icon);
    setIcon(icon);
    setToolTip(toolTip);
    
    
    
    connect(timer, SIGNAL(timeout()), this, SLOT(slotShowFlash()));
    timer->setInterval(millisecondsTimeoutHint);
    timer->start();
    
    if (menu) {
        QMenu *trayMenu = contextMenu();
        if (!trayMenu) {
            setContextMenu(menu);
        } else {
            trayMenu->addMenu(menu);
        }
    }
    
    
    
    
    qDebug()<<"~~ timer->isActive():"<<timer->isActive();
    
}
Example #19
0
TextBoxContent::TextBoxContent(QGraphicsScene * scene, QGraphicsItem * parent)
    : AbstractContent(scene, parent, false)
    , m_text(0)
    , m_shadowText(0)
    , m_textRect(0, 0, 0, 0)
    , m_textMargin(4)
    , m_lastModelRev(0)
{
	DEBUG_TSTART();
	m_dontSyncToModel = true;

	setFrame(0);
	setFrameTextEnabled(false);
	setToolTip(tr("Right click to Edit the text"));
	// create a text document
	m_text = new QTextDocument(this);
	// for drawing the shadow
	m_shadowText = new QTextDocument(this);

	#if QT_VERSION >= 0x040500
		m_textMargin = (int)m_text->documentMargin();
	#endif
	// template text
	QFont font;
	#ifdef Q_OS_WIN
		font.setFamily("Arial");
	#endif
	font.setPointSize(16);
	m_text->setDefaultFont(font);

	//connect(this, SIGNAL(resized()), this, SLOT(delayContentsResized()));
	for(int i=0;i<m_cornerItems.size();i++)
		m_cornerItems.at(i)->setDefaultLeftOp(CornerItem::Scale);

	m_zoomAnimationTimer = new QTimer(this);
	connect(m_zoomAnimationTimer, SIGNAL(timeout()), this, SLOT(animateZoom()));
	
	m_dontSyncToModel = false;
	
	//qDebug() << "TextBoxContent(): \t \t Elapsed:"<<(((double)total.elapsed())/1000.0)<<" sec";
}
Example #20
0
InfoIndicator::InfoIndicator(int widgetWidth, int widgetHeight, QWidget *parent)
    : QWidget(parent), indWidth(widgetWidth), indHeight(widgetHeight), showAll(false)
{
    setContextMenuPolicy(Qt::ActionsContextMenu);
    setToolTip(tr("Drag the info indicator with the left mouse button.\n"
        "Use the right mouse button to open the Settings and Profile Widgets."));
    setWindowTitle(tr("Info Indicator"));

    setWindowOpacity(GUI_OPACITY);
    QPalette pal;
    pal.setColor(QPalette::Background, MIDAS_GREY);
    setAutoFillBackground(true);
    setPalette(pal);
    setWindowFlags(Qt::WindowStaysOnTopHint  | Qt::X11BypassWindowManagerHint);

    layout = new QHBoxLayout;
    //layout->setSpacing(WIDGET_BUFFER);
    layout->setMargin(0);
    
    setLayout(layout);

    QFont timesFont("Times", 9, QFont::Bold);
    stateLabel = new QLabel();
    stateLabel->setFont(timesFont);

    button = new QPushButton("+", this);
    button->setText(getShowAllString());
    button->setFixedWidth(widgetHeight - 4); // Modify this line if getShowAllString has more than just a single character
    button->setFixedHeight(widgetHeight - 4);
    QFont timesSmall("Times", 8, QFont::DemiBold);
    button->setFont(timesSmall);
    connect(button, SIGNAL(released()), this, SLOT(handleButton()));

    layout->addSpacerItem(new QSpacerItem(6, 6));
    layout->addWidget(stateLabel, 1, Qt::AlignLeft);
    layout->addWidget(button, 0, Qt::AlignRight);
    layout->addSpacerItem(new QSpacerItem(2, 2));

	setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    setMinimumSize(indWidth, indHeight);
}
Example #21
0
// ---------------------------------------------------------------------
void Form::set(string p,string v)
{
  if (p=="enable") {
    setEnabled(remquotes(v)!="0");
  } else if (p=="font") {
    setFont((Font(v)).font);
  } else if (p=="invalid") {
    update();
  } else if (p=="show"||p=="visible") {
    setVisible(remquotes(v)!="0");
  } else if (p=="stylesheet") {
    setStyleSheet(s2q(remquotes(v)));
  } else if (p=="taborder") {
    settaborder(v);
  } else if (p=="tooltip") {
    setToolTip(s2q(remquotes(v)));
  } else if (p=="wh") {
    wdsetwh(this,v);
  } else
    error("set command not recognized: " + p + " " + v);
}
KCheckGmailTray::KCheckGmailTray(QWidget *parent)
    : KSystemTrayIcon(parent),
      mMailCount(0)
{
    mPixGmail = KSystemTrayIcon::loadIcon("kcheckgmail").pixmap(KIconLoader::SizeSmallMedium);
    mLightIconImage = mIconEffect.apply(mPixGmail,
                                        KIconEffect::ToGamma,
                                        0.90,
                                        Qt::red,
                                        false).toImage();
    setIcon(mPixGmail);

    mLoginAnim = new QTimer(this);
    connect(mLoginAnim, SIGNAL(timeout()),
            this, SLOT(slotToggleLoginAnim()));

    setToolTip(i18n("KCheckGMail"));

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason)));
}
KexiSmallToolButton::KexiSmallToolButton(QAction* action, QWidget* parent)
        : QToolButton(parent)
        , d(new Private)
{
    d->action = action;
    init();
    if (d->action) {
        connect(d->action, SIGNAL(changed()), this, SLOT(slotActionChanged()));
        update(d->action->text(), d->action->icon(), false);
        setEnabled(d->action->isEnabled());
        setToolTip(d->action->toolTip());
        setWhatsThis(d->action->whatsThis());
        setCheckable(d->action->isCheckable());
        if (d->action->menu()) {
            setPopupMode(QToolButton::MenuButtonPopup);
            setMenu(d->action->menu());
        } else {
            connect(this, SIGNAL(toggled(bool)), this, SLOT(slotButtonToggled(bool)));
            connect(d->action, SIGNAL(toggled(bool)), this, SLOT(slotActionToggled(bool)));
        }
    }
Example #24
0
//-----------------------------------------------------------------------------
// Function: AddressSpaceGapItem()
//-----------------------------------------------------------------------------
AddressSpaceGapItem::AddressSpaceGapItem(AddressSpaceGapItem::AddressPosition addrPos,
                                         QString const& addressSpaceWidth,
                                         QSharedPointer<ExpressionParser> expressionParser,
										 QGraphicsItem* parent):
AddressSpaceVisualizationItem(addressSpaceWidth, expressionParser, parent),
start_(0),
end_(0),
addrPosition_(addrPos) 
{
    setDefaultBrush(QBrush(Qt::white));
    if (addrPos == AddressSpaceGapItem::ALIGN_LEFT)
    {
        setNamePosition(VisualizerItem::NAME_LEFT_ALIGN, VisualizerItem::NAME_MIDDLE);
    }
    else //if (addrPos == AddressSpaceGapItem::ALIGN_RIGHT)
    {
        setNamePosition(VisualizerItem::NAME_RIGHT_ALIGN, VisualizerItem::NAME_MIDDLE);
    }
	setName("...");
    setToolTip("This memory block is unassigned.");
}
Example #25
0
/**
* Public method called to display an image loaded locally from disk
* @param path - The path and filename of the image to load from disk
*/
void eVisImageDisplayWidget::displayImage( const QString& path )
{
  mImageLoaded = mImage->load( path, nullptr, Qt::AutoColor );
  setToolTip( path );

  mCurrentZoomStep = 0;
  pbtnZoomOut->setEnabled( false );
  pbtnZoomFull->setEnabled( false );
  if ( mImageLoaded )
  {
    pbtnZoomIn->setEnabled( true );
  }
  else
  {
    pbtnZoomIn->setEnabled( false );
  }

  setScalers();

  displayImage();
}
void RegisterNotifierIcon::onRegisterCountChanged(int count)
{
	if(count == 0)
	{
		//setEnabled(false);
		m_RegisterMovie->stop();
		setPixmap(m_Icon);
	}
	else
	{
		//setEnabled(true);
//		QPoint currentPos = pos();
//		if(parent() != NULL)
//			currentPos += ( (QWidget*)parent() )->pos();
//		QToolTip::showText(currentPos, tr("еÄ×¢²áÇëÇó"));
		m_RegisterMovie->start();
		setMovie(m_RegisterMovie);
	}
	setToolTip(tr("×¢²áÇëÇóÊý:") + QString::number(count));
	m_UnhandledCount = count;
}
Example #27
0
SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
                        QWidget *parent )
           : QLabel( text, parent ), p_intf( _p_intf )
{
    setToolTip( qtr( "Current playback speed.\nClick to adjust" ) );

    /* Create the Speed Control Widget */
    speedControl = new SpeedControlWidget( p_intf, this );
    speedControlMenu = new QMenu( this );

    QWidgetAction *widgetAction = new QWidgetAction( speedControl );
    widgetAction->setDefaultWidget( speedControl );
    speedControlMenu->addAction( widgetAction );

    /* Change the SpeedRate in the Status Bar */
    CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );

    CONNECT( THEMIM, inputChanged( input_thread_t * ),
             speedControl, activateOnState() );

}
Example #28
0
void video::conversionFinished()
{
    this->_progressBar->setMaximum(1);
    this->_progressBar->setValue(1);
    this->_progressBar->setFormat(tr("Finished"));
    this->_finished = true;
    if (!this->_converter->target.isEmpty())
    {
        this->_targetPath = this->_converter->target;
    }
    setToolTip("<strong>" + tr("Finished!") + "</strong>");

    handler->clearDownloads();
	if (this->downloadFile)
	{
		this->downloadFile->deleteLater();

	}
    emit conversionFinished(this);

}
Example #29
0
StateWidget::StateWidget(IChatStates *AChatStates, IMessageWindow *AWindow, QWidget *AParent) : QToolButton(AParent)
{
	FWindow = AWindow;
	FChatStates = AChatStates;
	FMultiWindow = qobject_cast<IMultiUserChatWindow *>(AWindow->instance());

	FMenu = new Menu(this);
	QActionGroup *actionGroup = new QActionGroup(FMenu);
	connect(actionGroup,SIGNAL(triggered(QAction*)),SLOT(onStatusActionTriggered(QAction*)));
	setMenu(FMenu);

	Action *permitDefault = new Action(FMenu);
	permitDefault->setCheckable(true);
	permitDefault->setText(tr("Default"));
	permitDefault->setData(ADR_PERMIT_STATUS, IChatStates::StatusDefault);
	permitDefault->setActionGroup(actionGroup);
	FMenu->addAction(permitDefault);

	Action *permitEnable = new Action(FMenu);
	permitEnable->setCheckable(true);
	permitEnable->setText(tr("Always send my chat activity"));
	permitEnable->setData(ADR_PERMIT_STATUS, IChatStates::StatusEnable);
	permitEnable->setActionGroup(actionGroup);
	FMenu->addAction(permitEnable);

	Action *permitDisable = new Action(FMenu);
	permitDisable->setCheckable(true);
	permitDisable->setText(tr("Never send my chat activity"));
	permitDisable->setData(ADR_PERMIT_STATUS, IChatStates::StatusDisable);
	permitDisable->setActionGroup(actionGroup);
	FMenu->addAction(permitDisable);

	connect(FChatStates->instance(),SIGNAL(permitStatusChanged(const Jid &, int)),SLOT(onPermitStatusChanged(const Jid &, int)));
	connect(FWindow->address()->instance(),SIGNAL(addressChanged(const Jid &, const Jid &)),SLOT(onWindowAddressChanged(const Jid &, const Jid &)));

	if (FMultiWindow == NULL)
	{
		setToolTip(tr("User activity in chat"));
		connect(FChatStates->instance(),SIGNAL(userChatStateChanged(const Jid &, const Jid &, int)),SLOT(onUserChatStateChanged(const Jid &, const Jid &, int)));
	}
Example #30
0
void DjWidget::updateView()
{
    // Filter description and count update

    // update Labels
    setToolTip(tr("This Dj plays: ") + p->dj->description());
    QString strCase = (p->dj->filters().count() > 1) ? tr("cases") : tr("case");

    ui->lblDesciption->setText(QString::number(p->dj->filters().count()) + " " + strCase + "    "
        + QString::number(p->dj->countTracks()) + " " + tr("tracks") + "    "
        + Track::prettyTime(p->dj->lengthTracks(), true) + " " + tr("hours"));

    // active/passive look differentiation
    QString activeStyle;
    if (p->isActive) {
        activeStyle = "color:#ff6464;'>";
        this->setStyleSheet("#frameDj{	background: qlineargradient("
                            "x1:0, y1:0, x2:0, y2:1,"
                            "stop: 0.01 #202020,"
                            "stop:0.11 #505050,"
                            "stop:1 #505050"
                            ");}");
    } else {
        activeStyle = "color:#eeeeee;'>";
        this->setStyleSheet("#frameDj{		background: qlineargradient("
                            "x1:0, y1:0, x2:0, y2:1,"
                            "stop: 0.01 #202020,"
                            "stop:0.11 #404040,"
                            "stop:1 #404040"
                            ");}");
    }

    ui->lblName->setText("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN' 'http://www.w3.org/TR/REC-html40/strict.dtd'>"
                         "<html><head><meta name='qrichtext' content='1' /><style type='text/css'>p, li { white-space: pre-wrap; }"
                         "</style></head><body style='font-size:8.25pt; font-weight:400; font-style:normal;'><p style=' margin-top:0px; "
                         "margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;'>"
                         "<a href='fdadfaf'><span style=' font-size:12pt;font-style:normal;font-weight:bold; text-decoration: underline; "
        + activeStyle
        + p->dj->name + "</span></a></p></body></html>");
}