1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 02:49:55 +00:00
openmw-tes3mp/apps/opencs/view/widget/scenetoolrun.cpp
2014-09-06 16:11:06 +02:00

35 lines
1,002 B
C++

#include "scenetoolrun.hpp"
void CSVWidget::SceneToolRun::adjustToolTips()
{
QString toolTip = mToolTip;
if (mCurrentIndex==-1)
toolTip += "<p>No debug profile selected (function disabled)";
else
toolTip += "<p>Debug profile: " + QString::fromUtf8 (mProfiles[mCurrentIndex].c_str());
setToolTip (toolTip);
}
void CSVWidget::SceneToolRun::updateIcon()
{
setIcon (QIcon (mCurrentIndex==-1 ? mIconDisabled : mIcon));
}
CSVWidget::SceneToolRun::SceneToolRun (SceneToolbar *parent, const QString& toolTip,
const QString& icon, const QString& iconDisabled, const std::vector<std::string>& profiles)
: SceneTool (parent, Type_TopAction), mProfiles (profiles),
mCurrentIndex (profiles.empty() ? -1 : 0), mToolTip (toolTip), mIcon (icon),
mIconDisabled (iconDisabled)
{
updateIcon();
adjustToolTips();
}
void CSVWidget::SceneToolRun::showPanel (const QPoint& position)
{
if (mCurrentIndex!=-1)
emit runRequest (mProfiles[mCurrentIndex]);
}