Example #1
0
void EnfuseStackItem::setProcessedIcon(const QIcon& icon)
{
    setIcon(1, icon);
    setIcon(0, QIcon(d->thumb));
}
	void PlaylistWidget::SetSortOrderButton ()
	{
		auto sortButton = new QToolButton;
		sortButton->setIcon (Core::Instance ().GetProxy ()->GetIcon ("view-sort-ascending"));
		sortButton->setPopupMode (QToolButton::InstantPopup);

		auto menu = new QMenu (tr ("Sorting"));
		sortButton->setMenu (menu);

		auto getInts = [] (const QList<SortingCriteria>& crit) -> QVariantList
		{
			QVariantList result;
			std::transform (crit.begin (), crit.end (), std::back_inserter (result),
					[] (decltype (crit.front ()) item) { return static_cast<int> (item); });
			return result;
		};

		typedef QPair<QString, QList<SortingCriteria>> SortPair_t;
		QList<SortPair_t> stdSorts;
		stdSorts << SortPair_t (tr ("Artist / Year / Album / Track number"),
					{
						SortingCriteria::Artist,
						SortingCriteria::Year,
						SortingCriteria::Album,
						SortingCriteria::TrackNumber
					});
		stdSorts << SortPair_t (tr ("Artist / Track title"),
					{
						SortingCriteria::Artist,
						SortingCriteria::TrackTitle
					});
		stdSorts << SortPair_t (tr ("File path"),
					{
						SortingCriteria::DirectoryPath,
						SortingCriteria::FileName
					});
		stdSorts << SortPair_t (tr ("No sort"), {});

		const auto& currentCriteria = Player_->GetSortingCriteria ();

		auto sortGroup = new QActionGroup (this);
		bool wasChecked = false;
		Q_FOREACH (const auto& pair, stdSorts)
		{
			auto act = menu->addAction (pair.first);
			act->setProperty ("SortInts", getInts (pair.second));
			act->setCheckable (true);
			sortGroup->addAction (act);
			if (pair.second == currentCriteria)
			{
				act->setChecked (true);
				wasChecked = true;
			}
			else
				act->setChecked (false);

			connect (act,
					SIGNAL (triggered ()),
					this,
					SLOT (handleStdSort ()));
		}
ToiletItem::ToiletItem(int id) : PlaceableItem(id, ToiletTile::_id) {
	setNameID("toiletItem");
	setIcon("itemtoilet", 0);
}
/* UIActionSimple stuff: */
UIActionSimple::UIActionSimple(QObject *pParent, const QString &strIcon, const QString &strIconDis)
    : UIAction(pParent, UIActionType_Simple)
{
    if (!strIcon.isNull())
        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
}
Example #5
0
ChatWindow::ChatWindow(ICQChat *_chat)
        : QMainWindow(NULL)
{
    logFile = NULL;
    bConnected = false;

    setWFlags(WDestructiveClose);
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);

    QToolBar *toolbar = new QToolBar(this);

    btnSave = new QToolButton(toolbar);
    btnSave->setIconSet(Icon("save_all"));
    btnSave->setTextLabel(i18n("Save"));
    connect(btnSave, SIGNAL(clicked()), this, SLOT(openLog()));

    toolbar->addSeparator();

    btnBold = new QToolButton(toolbar);
    btnBold->setIconSet(Icon("text_bold"));
    btnBold->setTextLabel(i18n("Bold"));
    btnBold->setToggleButton(true);
    connect(btnBold, SIGNAL(toggled(bool)), this, SLOT(toggleBold(bool)));

    btnItalic = new QToolButton(toolbar);
    btnItalic->setIconSet(Icon("text_italic"));
    btnItalic->setTextLabel(i18n("Italic"));
    btnItalic->setToggleButton(true);
    connect(btnItalic, SIGNAL(toggled(bool)), this, SLOT(toggleItalic(bool)));

    btnUnderline = new QToolButton(toolbar);
    btnUnderline->setIconSet(Icon("text_under"));
    btnUnderline->setTextLabel(i18n("Underline"));
    btnUnderline->setToggleButton(true);
    connect(btnUnderline, SIGNAL(toggled(bool)), this, SLOT(toggleUnderline(bool)));

    btnFgColor = new QToolButton(toolbar);
    btnFgColor->setTextLabel(i18n("Text color"));
    btnFgColor->setIconSet(Icon("fgcolor"));
    connect(btnFgColor, SIGNAL(clicked()), this, SLOT(setFgColor()));

    chat = _chat;
    bInit = false;
    pClient->cancelMessage(chat, false);
    bInit = true;

    CUser u(chat->getUin());
    setCaption(u.name());
    setIcon(Pict("chat"));

    QSplitter *splitter = new QSplitter(this);
    setCentralWidget(splitter);
    QFrame *frm = new QFrame(splitter);
    lstUsers = new QListBox(splitter);
    splitter->setResizeMode(lstUsers, QSplitter::KeepSize);
    QVBoxLayout *lay = new QVBoxLayout(frm);
    txtChat = new TextShow(frm);
    txtChat->setTextFormat(QTextEdit::RichText);
    lay->addWidget(txtChat);
    lay->addSpacing(2);
    edtChat = new QTextEdit(frm);
    edtChat->setTextFormat(QTextEdit::RichText);
    edtChat->setWordWrap(QTextEdit::NoWrap);
    QFontMetrics fm(edtChat->font());
    int h = fm.height();
#if QT_VERSION < 300
    if ( style() == WindowsStyle && h < 26 )
        h = 22;
#endif
    if ( h < QApplication::globalStrut().height())
        h = QApplication::globalStrut().height();

    edtChat->setFixedHeight(h);
    edtChat->setHScrollBarMode(QScrollView::AlwaysOff);
    edtChat->setVScrollBarMode(QScrollView::AlwaysOff);
    lay->addWidget(edtChat);

    connect(edtChat, SIGNAL(returnPressed()), this, SLOT(sendLine()));

    CUser owner(pClient);
    new ChatUserItem(lstUsers, owner.name(), 0);

    if (pMain->ChatWidth() && pMain->ChatHeight())
        resize(pMain->ChatWidth(), pMain->ChatHeight());
    baseColor = txtChat->color();
    bClientMode = false;
}
/*!
 * Function create visual objects and connect slots.
 */
void
CatalogForm::init()
{

	ListView = new aListView(centralWidget(), "listView");
	ListView->setGeometry(30,30,400,300);
	ListView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
	LineEdit = new aLineEdit(centralWidget(), "lineEdit");
	ListHint = new aListBox(centralWidget(), "listBox");
	StatusFrame = new Q3Frame(centralWidget(), "statusFrame");

	ListView->setRootIsDecorated( true );

	StatusFrame->setGeometry( QRect( 0, 0, 50,5 ) );
	StatusFrame->setFrameShape( Q3Frame::StyledPanel );
	StatusFrame->setFrameShadow( Q3Frame::Raised );
	StatusFrame->hide();

	GridLayout = new Q3GridLayout(centralWidget(), 1, 1, 11, 6, "GridLayout");
	GridLayout->addMultiCellWidget( ListView, 2,3, 0 , 0 );
	GridLayout->addWidget( LineEdit, 1, 0 );
	GridLayout->addWidget( bCancel, 3, 1 );
	QLabel *lb = new QLabel(tr("Search"),centralWidget());
	lb->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, lb->sizePolicy().hasHeightForWidth() ) );
	GridLayout->addWidget( lb ,0,0);
	QSpacerItem* spacer = new QSpacerItem( 20, 390, QSizePolicy::Minimum, QSizePolicy::Expanding );
	GridLayout->addMultiCell( spacer, 0,2,1, 1);

 	QPixmap  pix= rcIcon("cat.png");
	if(pix.isNull())
	{
		aLog::print(aLog::Info, tr("Catalog Form image cat.png not loaded"));
	}
	else
	{
		setIcon( pix );
	}
 	//setFocusPolicy();
  //  connect(this, 	SIGNAL	(destoyed()),
//	    this,	SLOT	(close());

    connect(ListView, 	SIGNAL	(newItemRequest(Q3ListViewItem*)),
	    this,	SLOT	(new_item(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(newGroupRequest(Q3ListViewItem*)),
	    this, 	SLOT	(new_group(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(delItemRequest(Q3ListViewItem*)),
	    this, 	SLOT	(del_item(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(markDeletedRequest(Q3ListViewItem*)),
	    this, 	SLOT	(mark_deleted(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(undoMarkDeletedRequest(Q3ListViewItem*)),
	    this, 	SLOT	(undo_mark_deleted(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(editRequest(Q3ListViewItem*, int)),
	    this, 	SLOT	(edit(Q3ListViewItem*, int)));

    connect(ListView, 	SIGNAL	(selectRequest(Q3ListViewItem*)),
	    this, 	SLOT	(select(Q3ListViewItem*)));

    connect(LineEdit, 	SIGNAL	(delayTextChanged(const QString&)),
	    this, 	SLOT	(find(const QString&)));

    connect(LineEdit, 	SIGNAL	(keyArrowPressed()),
	    this, 	SLOT	(pressArrow()));

    connect(LineEdit, 	SIGNAL	(keyEnterPressed()),
	    this, 	SLOT	(go()));

    connect(ListView,	SIGNAL	(expanded ( Q3ListViewItem *)),
	    this,	SLOT	(onLoadElements( Q3ListViewItem *)));

    connect(ListHint, 	SIGNAL	(lostFocus()),
	    LineEdit, 	SLOT	(setFocus()));

    connect(ListHint, 	SIGNAL	(lostFocus()),
	   StatusFrame,	SLOT	(hide()));

    connect(ListHint, 	SIGNAL	(lostFocus()),
     ListHint,  SLOT (hide()));

    connect(ListHint,  SIGNAL (keyArrowLRPressed()),
     LineEdit,  SLOT (setFocus()));

    connect(ListHint,  SIGNAL (keyArrowLRPressed(const QString&)),
     this,  SLOT (setText(const QString&)));

    connect(ListHint,  SIGNAL (keyEnterPressed()),
     this,  SLOT (go()));

    connect(ListHint,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    connect(ListView,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    connect(LineEdit,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    LineEdit->setFocus();
}
Example #7
0
int main(int argc, char ** argv)
{
#ifdef WIN32
    SetUnhandledExceptionFilter( UnhandledExceptionProc );
#endif

    for(int i = 1; i < argc;) {
        int ret = argsHandler(argc, argv, i);
        if(!ret) {
            // ignore unknown arg
            i++;
        }
    }

    if ( cg_printVersion ) {
        printf( "%s\n", PACKAGE_STRING );
        return 0;
    }

    if ( cg_printHelp ) {
        printHelp( argv[0] );
        return 0;
    }


    std::unique_ptr<SplashWindow> splashWindow;

    try {

        // start recording backtrace
        spades::reflection::Backtrace::StartBacktrace();
        SPADES_MARK_FUNCTION();

        // show splash window
        // NOTE: splash window uses image loader, which assumes backtrace is already initialized.
        splashWindow.reset(new SplashWindow());
        auto showSplashWindowTime = SDL_GetTicks();
        auto pumpEvents = [&splashWindow] { splashWindow->PumpEvents(); };

        // initialize threads
        spades::Thread::InitThreadSystem();
        spades::DispatchQueue::GetThreadQueue()->MarkSDLVideoThread();

        SPLog("Package: " PACKAGE_STRING);
        // setup user-specific default resource directories
#ifdef WIN32
        static wchar_t buf[4096];
        GetModuleFileNameW(NULL, buf, 4096);
        std::wstring appdir = buf;
        appdir = appdir.substr(0, appdir.find_last_of(L'\\')+1);

        if(SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, buf))) {
            std::wstring datadir = buf;
            datadir += L"\\OpenSpades\\Resources";
            spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(Utf8FromWString(datadir.c_str()), true));
        }

        spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(Utf8FromWString((appdir + L"Resources").c_str()), false));

        //fltk has a console window on windows (can disable while building, maybe use a builtin console for a later release?)
        HWND hCon = GetConsoleWindow();
        if( NULL != hCon ) {
            setIcon( hCon );
        }

#elif defined(__APPLE__)
        std::string home = getenv("HOME");
        spades::FileManager::AddFileSystem
        (new spades::DirectoryFileSystem("./Resources", false));

        // OS X application is made of Bundle, which contains its own Resources directory.
        {
            char *baseDir = SDL_GetBasePath();
            if(baseDir) {
                spades::FileManager::AddFileSystem
                (new spades::DirectoryFileSystem(baseDir, false));
                SDL_free(baseDir);
            }
        }

        spades::FileManager::AddFileSystem
        (new spades::DirectoryFileSystem(home+"/Library/Application Support/OpenSpades/Resources", true));
#else
        std::string home = getenv("HOME");

        spades::FileManager::AddFileSystem
        (new spades::DirectoryFileSystem("./Resources", false));

        spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(CMAKE_INSTALL_PREFIX "/" OPENSPADES_INSTALL_RESOURCES, false));

        std::string xdg_data_home = home+"/.local/share";

        if (getenv("XDG_DATA_HOME") == NULL) {
            SPLog("XDG_DATA_HOME not defined. Assuming that XDG_DATA_HOME is ~/.local/share");
        }
        else {
            std::string xdg_data_home = getenv("XDG_DATA_HOME");
            SPLog("XDG_DATA_HOME is %s", xdg_data_home.c_str());
        }

        struct stat info;

        if ( stat((xdg_data_home+"/openspades").c_str(), &info ) != 0 ) {
            if ( stat((home+"/.openspades").c_str(), &info ) != 0) { }
            else if( info.st_mode & S_IFDIR ) {
                SPLog("Openspades directory in XDG_DATA_HOME not found, though old directory exists. Trying to resolve compatibility problem.");

                if (rename( (home+"/.openspades").c_str() , (xdg_data_home+"/openspades").c_str() ) != 0) {
                    SPLog("Failed to move old directory to new.");
                } else {
                    SPLog("Successfully moved old directory.");

                    if (mkdir((home+"/.openspades").c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0) {
                        SDL_RWops *io = SDL_RWFromFile((home+"/.openspades/CONTENT_MOVED_TO_NEW_DIR").c_str(), "wb");
                        if (io != NULL) {
                            const char* text = ("Content of this directory moved to "+xdg_data_home+"/openspades").c_str();
                            io->write(io, text, strlen(text), 1);
                            io->close(io);
                        }
                    }
                }
            }
        }

        spades::FileManager::AddFileSystem
        (new spades::DirectoryFileSystem(xdg_data_home+"/openspades/Resources", true));

#endif

        // start log output to SystemMessages.log
        try {
            spades::StartLog();
        } catch(const std::exception& ex) {
            SDL_InitSubSystem(SDL_INIT_VIDEO);
            auto msg = spades::Format("Failed to start recording log because of the following error:\n{0}\n\n"
                                      "OpenSpades will continue to run, but any critical events are not logged.", ex.what());
            if(SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING,
                                        "OpenSpades Log System Failure",
                                        msg.c_str(), splashWindow->GetWindow())) {
                // showing dialog failed.
            }
        }
        SPLog("Log Started.");

        // load preferences.
        spades::Settings::GetInstance()->Load();
        pumpEvents();

        // dump CPU info (for debugging?)
        {
            spades::CpuID cpuid;
            SPLog("---- CPU Information ----");
            SPLog("Vendor ID: %s", cpuid.GetVendorId().c_str());
            SPLog("Brand ID: %s", cpuid.GetBrand().c_str());
            SPLog("Supports MMX: %s", cpuid.Supports(spades::CpuFeature::MMX)?"YES":"NO");
            SPLog("Supports SSE: %s", cpuid.Supports(spades::CpuFeature::SSE)?"YES":"NO");
            SPLog("Supports SSE2: %s", cpuid.Supports(spades::CpuFeature::SSE2)?"YES":"NO");
            SPLog("Supports SSE3: %s", cpuid.Supports(spades::CpuFeature::SSE3)?"YES":"NO");
            SPLog("Supports SSSE3: %s", cpuid.Supports(spades::CpuFeature::SSSE3)?"YES":"NO");
            SPLog("Supports FMA: %s", cpuid.Supports(spades::CpuFeature::FMA)?"YES":"NO");
            SPLog("Supports AVX: %s", cpuid.Supports(spades::CpuFeature::AVX)?"YES":"NO");
            SPLog("Supports AVX2: %s", cpuid.Supports(spades::CpuFeature::AVX2)?"YES":"NO");
            SPLog("Supports AVX512F: %s", cpuid.Supports(spades::CpuFeature::AVX512F)?"YES":"NO");
            SPLog("Supports AVX512CD: %s", cpuid.Supports(spades::CpuFeature::AVX512CD)?"YES":"NO");
            SPLog("Supports AVX512ER: %s", cpuid.Supports(spades::CpuFeature::AVX512ER)?"YES":"NO");
            SPLog("Supports AVX512PF: %s", cpuid.Supports(spades::CpuFeature::AVX512PF)?"YES":"NO");
            SPLog("Simultaneous Multithreading: %s", cpuid.Supports(spades::CpuFeature::SimultaneousMT)?"YES":"NO");
            SPLog("Misc:");
            SPLog("%s", cpuid.GetMiscInfo().c_str());
            SPLog("-------------------------");
        }

        // register resource directory specified by Makefile (or something)
#if defined(RESDIR_DEFINED)
        spades::FileManager::AddFileSystem(new spades::DirectoryFileSystem(RESDIR, false));
#endif

        // search current file system for .pak files
        {
            std::vector<spades::IFileSystem*> fss;
            std::vector<spades::IFileSystem*> fssImportant;

            std::vector<std::string> files = spades::FileManager::EnumFiles("");

            struct Comparator {
                static int GetPakId(const std::string& str) {
                    if(str.size() >= 4 && str[0] == 'p' &&
                            str[1] == 'a' && str[2] == 'k' &&
                            (str[3] >= '0' && str[3] <= '9')) {
                        return atoi(str.c_str() + 3);
                    } else {
                        return 32767;
                    }
                }
                static bool Compare(const std::string& a,
                                    const std::string& b) {
                    int pa = GetPakId(a);
                    int pb = GetPakId(b);
                    if(pa == pb) {
                        return a < b;
                    } else {
                        return pa < pb;
                    }
                }
            };

            std::sort(files.begin(), files.end(), Comparator::Compare);

            for(size_t i = 0; i < files.size(); i++) {
                std::string name = files[i];

                // check extension
                if(name.size() < 4 ||
                        name.rfind(".pak") != name.size() - 4) {
                    continue;
                }

                if(spades::FileManager::FileExists(name.c_str())) {
                    spades::IStream *stream = spades::FileManager::OpenForReading(name.c_str());
                    spades::ZipFileSystem *fs = new spades::ZipFileSystem(stream);
                    if(name[0] == '_' && false) { // last resort for #198
                        SPLog("Pak Registered: %s (marked as 'important')\n", name.c_str());
                        fssImportant.push_back(fs);
                    } else {
                        SPLog("Pak Registered: %s\n", name.c_str());
                        fss.push_back(fs);
                    }
                }
            }
            for(size_t i = fss.size(); i > 0; i--) {
                spades::FileManager::AppendFileSystem(fss[i - 1]);
            }
            for(size_t i = 0; i < fssImportant.size(); i++) {
                spades::FileManager::PrependFileSystem(fssImportant[i]);
            }
        }
        pumpEvents();

        // initialize localization system
        SPLog("Initializing localization system");
        spades::LoadCurrentLocale();
        _Tr("Main", "Localization System Loaded");
        pumpEvents();

        // parse args

        // initialize AngelScript
        SPLog("Initializing script engine");
        spades::ScriptManager::GetInstance();
        pumpEvents();

        ThreadQuantumSetter quantumSetter;
        (void)quantumSetter; // suppress "unused variable" warning

        SDL_InitSubSystem(SDL_INIT_VIDEO);

        // we want to show splash window at least for some time...
        pumpEvents();
        auto ticks = SDL_GetTicks();
        if(ticks < showSplashWindowTime + 1500) {
            SDL_Delay(showSplashWindowTime + 1500 - ticks);
        }
        pumpEvents();

        // everything is now ready!
        if( !cg_autoConnect ) {
            if(!((int)cl_showStartupWindow != 0 ||
                    splashWindow->IsStartupScreenRequested())) {
                splashWindow.reset();

                SPLog("Starting main screen");
                spades::StartMainScreen();
            } else {
                splashWindow.reset();

                SPLog("Starting startup window");
                ::spades::gui::StartupScreen::Run();
            }
        } else {
            splashWindow.reset();

            spades::ServerAddress host(cg_lastQuickConnectHost.CString(), (int)cg_protocolVersion == 3 ? spades::ProtocolVersion::v075 : spades::ProtocolVersion::v076 );
            spades::StartClient(host, cg_playerName);
        }

        spades::Settings::GetInstance()->Flush();

    } catch(const ExitRequestException&) {
        // user changed his mind.
    } catch(const std::exception& ex) {

        try {
            splashWindow.reset(nullptr);
        } catch(...) {
        }

        std::string msg = ex.what();
        msg = _Tr("Main", "A serious error caused OpenSpades to stop working:\n\n{0}\n\nSee SystemMessages.log for more details.", msg);

        SPLog("[!] Terminating due to the fatal error: %s", ex.what());

        SDL_InitSubSystem(SDL_INIT_VIDEO);
        if(SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, _Tr("Main", "OpenSpades Fatal Error").c_str(), msg.c_str(), nullptr)) {
            // showing dialog failed.
            // TODO: do appropriate action
        }

    }

    return 0;
}
UIActionSimple::UIActionSimple(UIActionPool *pParent,
                               const QIcon& icon)
    : UIAction(pParent, UIActionType_Simple)
{
    setIcon(icon);
}
Example #9
0
/*!
  \obsolete

  Use setIcon() instead.
*/
void QToolButton::setOffIconSet(const QIcon& set)
{
    setIcon(set);
}
Example #10
0
void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
{
    // load styles used by all widgets
    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "color")
            setColor(node->value<Color>());
        else if(node->tag() == "x")
            setX(node->value<int>());
        else if(node->tag() == "y")
            setY(node->value<int>());
        else if(node->tag() == "pos")
            setPosition(node->value<Point>());
        else if(node->tag() == "width")
            setWidth(node->value<int>());
        else if(node->tag() == "height")
            setHeight(node->value<int>());
        else if(node->tag() == "rect")
            setRect(node->value<Rect>());
        else if(node->tag() == "background")
            setBackgroundColor(node->value<Color>());
        else if(node->tag() == "background-color")
            setBackgroundColor(node->value<Color>());
        else if(node->tag() == "background-offset-x")
            setBackgroundOffsetX(node->value<int>());
        else if(node->tag() == "background-offset-y")
            setBackgroundOffsetY(node->value<int>());
        else if(node->tag() == "background-offset")
            setBackgroundOffset(node->value<Point>());
        else if(node->tag() == "background-width")
            setBackgroundWidth(node->value<int>());
        else if(node->tag() == "background-height")
            setBackgroundHeight(node->value<int>());
        else if(node->tag() == "background-size")
            setBackgroundSize(node->value<Size>());
        else if(node->tag() == "background-rect")
            setBackgroundRect(node->value<Rect>());
        else if(node->tag() == "icon")
            setIcon(stdext::resolve_path(node->value(), node->source()));
        else if(node->tag() == "icon-source")
            setIcon(stdext::resolve_path(node->value(), node->source()));
        else if(node->tag() == "icon-color")
            setIconColor(node->value<Color>());
        else if(node->tag() == "icon-offset-x")
            setIconOffsetX(node->value<int>());
        else if(node->tag() == "icon-offset-y")
            setIconOffsetY(node->value<int>());
        else if(node->tag() == "icon-offset")
            setIconOffset(node->value<Point>());
        else if(node->tag() == "icon-width")
            setIconWidth(node->value<int>());
        else if(node->tag() == "icon-height")
            setIconHeight(node->value<int>());
        else if(node->tag() == "icon-size")
            setIconSize(node->value<Size>());
        else if(node->tag() == "icon-rect")
            setIconRect(node->value<Rect>());
        else if(node->tag() == "opacity")
            setOpacity(node->value<float>());
        else if(node->tag() == "enabled")
            setEnabled(node->value<bool>());
        else if(node->tag() == "visible")
            setVisible(node->value<bool>());
        else if(node->tag() == "checked")
            setChecked(node->value<bool>());
        else if(node->tag() == "dragable")
            setChecked(node->value<bool>());
        else if(node->tag() == "on")
            setOn(node->value<bool>());
        else if(node->tag() == "focusable")
            setFocusable(node->value<bool>());
        else if(node->tag() == "phantom")
            setPhantom(node->value<bool>());
        else if(node->tag() == "size")
            setSize(node->value<Size>());
        else if(node->tag() == "fixed-size")
            setFixedSize(node->value<bool>());
        else if(node->tag() == "clipping")
            setClipping(node->value<bool>());
        else if(node->tag() == "border") {
            auto split = stdext::split(node->value(), " ");
            if(split.size() == 2) {
                setBorderWidth(stdext::safe_cast<int>(split[0]));
                setBorderColor(stdext::safe_cast<Color>(split[1]));
            } else
                throw OTMLException(node, "border param must have its width followed by its color");
        }
        else if(node->tag() == "border-width")
            setBorderWidth(node->value<int>());
        else if(node->tag() == "border-width-top")
            setBorderWidthTop(node->value<int>());
        else if(node->tag() == "border-width-right")
            setBorderWidthRight(node->value<int>());
        else if(node->tag() == "border-width-bottom")
            setBorderWidthBottom(node->value<int>());
        else if(node->tag() == "border-width-left")
            setBorderWidthLeft(node->value<int>());
        else if(node->tag() == "border-color")
            setBorderColor(node->value<Color>());
        else if(node->tag() == "border-color-top")
            setBorderColorTop(node->value<Color>());
        else if(node->tag() == "border-color-right")
            setBorderColorRight(node->value<Color>());
        else if(node->tag() == "border-color-bottom")
            setBorderColorBottom(node->value<Color>());
        else if(node->tag() == "border-color-left")
            setBorderColorLeft(node->value<Color>());
        else if(node->tag() == "margin-top")
            setMarginTop(node->value<int>());
        else if(node->tag() == "margin-right")
            setMarginRight(node->value<int>());
        else if(node->tag() == "margin-bottom")
            setMarginBottom(node->value<int>());
        else if(node->tag() == "margin-left")
            setMarginLeft(node->value<int>());
        else if(node->tag() == "margin") {
            std::string marginDesc = node->value();
            std::vector<std::string> split;
            boost::split(split, marginDesc, boost::is_any_of(std::string(" ")));
            if(split.size() == 4) {
                setMarginTop(stdext::safe_cast<int>(split[0]));
                setMarginRight(stdext::safe_cast<int>(split[1]));
                setMarginBottom(stdext::safe_cast<int>(split[2]));
                setMarginLeft(stdext::safe_cast<int>(split[3]));
            } else if(split.size() == 3) {
                int marginTop = stdext::safe_cast<int>(split[0]);
                int marginHorizontal = stdext::safe_cast<int>(split[1]);
                int marginBottom = stdext::safe_cast<int>(split[2]);
                setMarginTop(marginTop);
                setMarginRight(marginHorizontal);
                setMarginBottom(marginBottom);
                setMarginLeft(marginHorizontal);
            } else if(split.size() == 2) {
                int marginVertical = stdext::safe_cast<int>(split[0]);
                int marginHorizontal = stdext::safe_cast<int>(split[1]);
                setMarginTop(marginVertical);
                setMarginRight(marginHorizontal);
                setMarginBottom(marginVertical);
                setMarginLeft(marginHorizontal);
            } else if(split.size() == 1) {
                int margin = stdext::safe_cast<int>(split[0]);
                setMarginTop(margin);
                setMarginRight(margin);
                setMarginBottom(margin);
                setMarginLeft(margin);
            }
        }
        else if(node->tag() == "padding-top")
            setPaddingTop(node->value<int>());
        else if(node->tag() == "padding-right")
            setPaddingRight(node->value<int>());
        else if(node->tag() == "padding-bottom")
            setPaddingBottom(node->value<int>());
        else if(node->tag() == "padding-left")
            setPaddingLeft(node->value<int>());
        else if(node->tag() == "padding") {
            std::string paddingDesc = node->value();
            std::vector<std::string> split;
            boost::split(split, paddingDesc, boost::is_any_of(std::string(" ")));
            if(split.size() == 4) {
                setPaddingTop(stdext::safe_cast<int>(split[0]));
                setPaddingRight(stdext::safe_cast<int>(split[1]));
                setPaddingBottom(stdext::safe_cast<int>(split[2]));
                setPaddingLeft(stdext::safe_cast<int>(split[3]));
            } else if(split.size() == 3) {
                int paddingTop = stdext::safe_cast<int>(split[0]);
                int paddingHorizontal = stdext::safe_cast<int>(split[1]);
                int paddingBottom = stdext::safe_cast<int>(split[2]);
                setPaddingTop(paddingTop);
                setPaddingRight(paddingHorizontal);
                setPaddingBottom(paddingBottom);
                setPaddingLeft(paddingHorizontal);
            } else if(split.size() == 2) {
                int paddingVertical = stdext::safe_cast<int>(split[0]);
                int paddingHorizontal = stdext::safe_cast<int>(split[1]);
                setPaddingTop(paddingVertical);
                setPaddingRight(paddingHorizontal);
                setPaddingBottom(paddingVertical);
                setPaddingLeft(paddingHorizontal);
            } else if(split.size() == 1) {
                int padding = stdext::safe_cast<int>(split[0]);
                setPaddingTop(padding);
                setPaddingRight(padding);
                setPaddingBottom(padding);
                setPaddingLeft(padding);
            }
        }
        // layouts
        else if(node->tag() == "layout") {
            std::string layoutType;
            if(node->hasValue())
                layoutType = node->value();
            else
                layoutType = node->valueAt<std::string>("type", "");

            if(!layoutType.empty()) {
                UILayoutPtr layout;
                if(layoutType == "horizontalBox")
                    layout = UIHorizontalLayoutPtr(new UIHorizontalLayout(asUIWidget()));
                else if(layoutType == "verticalBox")
                    layout = UIVerticalLayoutPtr(new UIVerticalLayout(asUIWidget()));
                else if(layoutType == "grid")
                    layout = UIGridLayoutPtr(new UIGridLayout(asUIWidget()));
                else if(layoutType == "anchor")
                    layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
                else
                    throw OTMLException(node, "cannot determine layout type");
                setLayout(layout);
            }

            if(node->hasChildren())
                m_layout->applyStyle(node);
        }
        // anchors
        else if(boost::starts_with(node->tag(), "anchors.")) {
            UIWidgetPtr parent = getParent();
            if(!parent) {
                if(m_firstOnStyle)
                    throw OTMLException(node, "cannot create anchor, there is no parent widget!");
                else
                    continue;
            }

            UIAnchorLayoutPtr anchorLayout = parent->getLayout()->asUIAnchorLayout();
            if(!anchorLayout)
                throw OTMLException(node, "cannot create anchor, the parent widget doesn't use anchor layout!");

            std::string what = node->tag().substr(8);
            if(what == "fill") {
                fill(node->value());
            } else if(what == "centerIn") {
                centerIn(node->value());
            } else {
                Fw::AnchorEdge anchoredEdge = Fw::translateAnchorEdge(what);

                if(node->value() == "none") {
                    removeAnchor(anchoredEdge);
                } else {
                    std::vector<std::string> split = stdext::split(node->value(), ".");
                    if(split.size() != 2)
                        throw OTMLException(node, "invalid anchor description");

                    std::string hookedWidgetId = split[0];
                    Fw::AnchorEdge hookedEdge = Fw::translateAnchorEdge(split[1]);

                    if(anchoredEdge == Fw::AnchorNone)
                        throw OTMLException(node, "invalid anchor edge");

                    if(hookedEdge == Fw::AnchorNone)
                        throw OTMLException(node, "invalid anchor target edge");

                    addAnchor(anchoredEdge, hookedWidgetId, hookedEdge);
                }
            }
            // lua functions
        } else if(boost::starts_with(node->tag(), "@")) {
            // load once
            if(m_firstOnStyle) {
                std::string funcName = node->tag().substr(1);
                std::string funcOrigin = "@" + node->source() + "[" + node->tag() + "]";
                g_lua.loadFunction(node->value(), funcOrigin);
                luaSetField(funcName);
            }
            // lua fields value
        } else if(boost::starts_with(node->tag(), "&")) {
            std::string fieldName = node->tag().substr(1);
            std::string fieldOrigin = "@" + node->source() + "[" + node->tag() + "]";
            g_lua.evaluateExpression(node->value(), fieldOrigin);
            luaSetField(fieldName);
        }
    }
}
Example #11
0
void WeatherPlugin::element_end(const char *el)
{
    if (!strcmp(el, "obst")){
        setLocation(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "lsup")){
        setUpdated(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "sunr") && (m_day == 0)){
        setSun_raise(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "suns") && (m_day == 0)){
        setSun_set(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "vis") && m_bCC){
        setVisibility(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "tmp") && m_bCC){
        setTemperature(atol(m_data.c_str()));
        m_data = "";
        return;
    }
    if (!strcmp(el, "flik") && m_bCC){
        setFeelsLike(atol(m_data.c_str()));
        m_data = "";
        return;
    }
    if (!strcmp(el, "devp") && m_bCC){
        setDewPoint(atol(m_data.c_str()));
        m_data = "";
        return;
    }
    if (!strcmp(el, "hmid") && m_bCC){
        setHumidity(atol(m_data.c_str()));
        m_data = "";
        return;
    }
    if (!strcmp(el, "low") && m_day){
        setMinT(m_day, m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "hi") && m_day){
        setMaxT(m_day, m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "t")){
        if (!m_bBar && !m_bWind && !m_bUv){
            if (m_bCC){
                setConditions(m_data.c_str());
            }else{
                setDayConditions(m_day, m_data.c_str());
            }
        }
        if (m_bWind && m_bCC)
            setWind(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "icon")){
        if (m_bCC){
            setIcon(atol(m_data.c_str()));
        }else{
            setDayIcon(m_day, m_data.c_str());
        }
        m_data = "";
        return;
    }
    if (!strcmp(el, "ut")){
        setUT(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "up")){
        setUP(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "us")){
        setUS(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "ud")){
        setUD(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "gust") && m_bCC){
        setWindGust(atol(m_data.c_str()));
        m_data = "";
        return;
    }
    if (!strcmp(el, "bar")){
        m_bBar = false;
        return;
    }
    if (!strcmp(el, "cc")){
        m_bCC = false;
        return;
    }
    if (!strcmp(el, "r") && m_bBar && m_bCC){
        unsigned long v = 0;
        for (const char *p = m_data.c_str(); *p; p++){
            if (*p == '.')
                break;
            if (*p == ',')
                continue;
            v = (v * 10) + (*p - '0');
        }
        setPressure(v);
        return;
    }
    if (!strcmp(el, "d") && m_bBar && m_bCC){
        setPressureD(m_data.c_str());
        m_data = "";
        return;
    }
    if (!strcmp(el, "wind")){
        m_bWind = false;
        return;
    }
    if (!strcmp(el, "s") && m_bWind && m_bCC){
        setWind_speed(atol(m_data.c_str()));
        return;
    }
    if (!strcmp(el, "uv")){
        m_bUv = false;
        return;
    }
}
Example #12
0
void QgsDataDefinedButton::updateGui()
{
  QString oldDef = mCurrentDefinition;
  QString newDef( "" );
  bool hasExp = !getExpression().isEmpty();
  bool hasField = !getField().isEmpty();

  if ( useExpression() && !hasExp )
  {
    setActive( false );
    setUseExpression( false );
  }
  else if ( !useExpression() && !hasField )
  {
    setActive( false );
  }

  QIcon icon = mIconDataDefine;
  QString deftip = tr( "undefined" );
  if ( useExpression() && hasExp )
  {
    icon = isActive() ? mIconDataDefineExpressionOn : mIconDataDefineExpression;
    newDef = deftip = getExpression();

    QgsExpression exp( getExpression() );
    if ( exp.hasParserError() )
    {
      setActive( false );
      icon = mIconDataDefineExpressionError;
      deftip = tr( "Parse error: %1" ).arg( exp.parserErrorString() );
      newDef = "";
    }
  }
  else if ( !useExpression() && hasField )
  {
    icon = isActive() ? mIconDataDefineOn : mIconDataDefine;
    newDef = deftip = getField();

    if ( !mFieldNameList.contains( getField() ) )
    {
      setActive( false );
      icon = mIconDataDefineError;
      deftip = tr( "'%1' field missing" ).arg( getField() );
      newDef = "";
    }
  }

  setIcon( icon );

  // update and emit current definition
  if ( newDef != oldDef )
  {
    mCurrentDefinition = newDef;
    emit dataDefinedChanged( mCurrentDefinition );
  }

  // build full description for tool tip and popup dialog
  mFullDescription = tr( "<b><u>Data defined override</u></b><br>" );

  mFullDescription += tr( "<b>Active: </b>%1&nbsp;&nbsp;&nbsp;<i>(ctrl|right-click toggles)</i><br>" ).arg( isActive() ? tr( "yes" ) : tr( "no" ) );

  if ( !mUsageInfo.isEmpty() )
  {
    mFullDescription += tr( "<b>Usage:</b><br>%1<br>" ).arg( mUsageInfo );
  }

  if ( !mInputDescription.isEmpty() )
  {
    mFullDescription += tr( "<b>Expected input:</b><br>%1<br>" ).arg( mInputDescription );
  }

  if ( !mDataTypesString.isEmpty() )
  {
    mFullDescription += tr( "<b>Valid input types:</b><br>%1<br>" ).arg( mDataTypesString );
  }

  QString deftype( "" );
  if ( deftip != tr( "undefined" ) )
  {
    deftype = QString( " (%1)" ).arg( useExpression() ? tr( "expression" ) : tr( "field" ) );
  }

  // truncate long expressions, or tool tip may be too wide for screen
  if ( deftip.length() > 75 )
  {
    deftip.truncate( 75 );
    deftip.append( "..." );
  }

  mFullDescription += tr( "<b>Current definition %1:</b><br>%2" ).arg( deftype ).arg( deftip );

  setToolTip( mFullDescription );

}
Example #13
0
void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels)
{
    CSFML_CALL(renderWindow, setIcon(width, height, pixels));
}
Example #14
0
int InstallBranch::setInfo(DesuraId id, bool selectBranch)
{
	m_bSelectBranch = selectBranch;
	UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(id);

	if (!pItemInfo)
		return 1;

	m_bIsMod = id.getType() == DesuraId::TYPE_MOD;
	m_bIsExpansion = m_bIsMod == false && pItemInfo->getParentId().getType() == DesuraId::TYPE_GAME;

	m_Item = id;

	gcWString parName;
	gcWString itemName = pItemInfo->getName();
	
	DesuraId par = pItemInfo->getParentId();
	UserCore::Item::ItemInfoI *parInfo = NULL;
	if (par.isOk())
	{
		parInfo = GetUserCore()->getItemManager()->findItemInfo(par);

		if (parInfo)
			parName = gcWString(parInfo->getName());
	}

	fixName(parName);
	fixName(itemName);

	if (selectBranch == false && m_bIsMod)
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND"), itemName, parName));
		m_labInfo->Wrap( 350 );
	}
	else if (selectBranch == false && m_bIsExpansion)
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND_GAME"), itemName, parName));
		m_labInfo->Wrap( 350 );
	}
	else
	{
		m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_BRANCHINFO"), itemName));
		m_labInfo->Wrap( 350 );
	}

	uint32 count = 0;
	uint32 full = -1;
	uint32 fullReadyCount = 0;
	m_bBuy = true;

	UserCore::Item::ItemInfoI *i = pItemInfo;

	bool isCheckingParent = (m_bIsMod || m_bIsExpansion) && !selectBranch;

	if (isCheckingParent)
	{
		if (!parInfo)
		{
			gcMessageBox(GetParent(), Managers::GetString(L"#IF_IIPARENT"), Managers::GetString(L"#IF_IIERRTITLE"));
			return 1;
		}

		i = parInfo;
	}

	std::vector<UserCore::Item::BranchInfoI*> bList;

	for (uint32 x=0; x<i->getBranchCount(); x++)
	{
		UserCore::Item::BranchInfoI* bi = i->getBranch(x);

		if (!bi)
			continue;

		uint32 flags = bi->getFlags();

		bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES);
		bool isPreorder = bi->isPreOrder();
		bool isDemo = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_DEMO);
		bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT);
		bool locked = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_MEMBERLOCK|UserCore::Item::BranchInfoI::BF_REGIONLOCK);
		bool test = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_TEST);
		bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE);

		if (noRelease && !isPreorder)
			continue;

		if (!onAccount && locked)
			continue;
		
		if (!selectBranch && (isDemo || test))
			continue;

		if ((free || onAccount) && isPreorder && !selectBranch)
			continue;

		bool globalFound = false;

		for (size_t x=0; x<bList.size(); x++)
		{
			if (bList[x]->getGlobalId() == bi->getGlobalId())
			{
				globalFound = true;
				break;
			}
		}

		if (globalFound)
			continue;

		if (isDemo || test)
		{
		}
		else if (full == -1 || ((!m_bBuy || onAccount) && !free))
		{
			if (full == -1 || m_bBuy)
			{
				//if this is the first full game or this is the first full game that you dont have to buy
				m_bBuy = (!onAccount && !free);
				full = count;
			}
			
			if (onAccount || free)
				fullReadyCount++;
		}

		bList.push_back(bi);
		count++;
	}

	for (size_t x=0; x<bList.size(); x++)
	{
		UserCore::Item::BranchInfoI* bi = bList[x];
		gcString name = bi->getName();
		gcWString title;
		
		uint32 flags = bi->getFlags();

		bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES);
		bool isPreorder = bi->isPreOrder();
		bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT);
		bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE);

		if (!free)
			title = gcString("{0} - {1}", name, Managers::GetString("#IF_BROUGHT"));
		else
			title = gcString("{0} - {1}", name, Managers::GetString("#IF_FREE"));
		
		if (!free && !onAccount)
		{
			gcWString cost(bi->getCost());

			if (cost == "")
				cost = gcString(Managers::GetString("#TBA"));

			title = gcString("{0} - {1}", name, cost.c_str());
		}
		else if (isPreorder)
		{
			if (noRelease)
				title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED_NORELEASE"));
			else
				title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED"));
		}

		m_cbBranchList->Append(title, new BranchData(bi->getBranchId(), bi->getGlobalId()));
	}

	count = bList.size();

	if (full == -1)
		full = 0;

#ifdef WIN32
	if (HasAnyFlags(i->getStatus(), UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER))
		m_cbBranchList->Append(Managers::GetString("#IF_ONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-1), MCFBranch::BranchFromInt(-1)));
	else
		m_cbBranchList->Append(Managers::GetString("#IF_FINDONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-2), MCFBranch::BranchFromInt(-2)));
#endif

	m_cbBranchList->SetSelection(full);

	if (pItemInfo->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(pItemInfo->getIcon())))
		setIcon(pItemInfo->getIcon());

	SetTitle(gcWString(Managers::GetString(L"#IF_BRANCHTITLE"), itemName));


	uint32 ret = 0;

	if (count == 0)
	{
		if (!isCheckingParent)
			gcMessageBox(GetParent(), Managers::GetString(L"#IF_IINOBRANCHES"), Managers::GetString(L"#IF_IIERRTITLE"));
		else if (selectBranch)
			ret = 1;
	}
	else if ((count == 1 || fullReadyCount == 1) && !m_bBuy)
	{	
		ret =  1;
	}
	else
	{
		wxCommandEvent e;
		onChoice(e);
	}

	return ret;
}
Example #15
0
AnalyzerRunControl::AnalyzerRunControl(RunConfiguration *runConfiguration, Core::Id runMode)
    : RunControl(runConfiguration, runMode)
{
    setIcon(Icons::ANALYZER_CONTROL_START);
}
Example #16
0
/*
 *  Constructs a BezierWidgetBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
BezierWidgetBase::BezierWidgetBase( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    QImage img;
    img.loadFromData( image0_data, sizeof( image0_data ), "PNG" );
    image0 = img;
    if ( !name )
	setName( "bezierwidgetbase" );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
    setMinimumSize( QSize( 910, 540 ) );
    setIcon( image0 );
    setMouseTracking( TRUE );
    bezierwidgetbaseLayout = new QGridLayout( this, 1, 1, 11, 6, "bezierwidgetbaseLayout"); 

    layout15 = new QHBoxLayout( 0, 0, 6, "layout15"); 
    spacer5_2 = new QSpacerItem( 170, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout15->addItem( spacer5_2 );

    textLabel3 = new QLabel( this, "textLabel3" );
    textLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel3->sizePolicy().hasHeightForWidth() ) );
    textLabel3->setMinimumSize( QSize( 500, 10 ) );
    textLabel3->setMaximumSize( QSize( 32767, 15 ) );
    layout15->addWidget( textLabel3 );
    spacer5 = new QSpacerItem( 220, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout15->addItem( spacer5 );

    bezierwidgetbaseLayout->addLayout( layout15, 0, 0 );

    layout13 = new QVBoxLayout( 0, 0, 6, "layout13"); 

    qbezier = new Qbezier( this, "qbezier" );
    qbezier->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, qbezier->sizePolicy().hasHeightForWidth() ) );
    qbezier->setMinimumSize( QSize( 0, 220 ) );
    qbezier->setMouseTracking( TRUE );
    layout13->addWidget( qbezier );

    bezierScroll = new QScrollBar( this, "bezierScroll" );
    bezierScroll->setMaxValue( 0 );
    bezierScroll->setLineStep( 1 );
    bezierScroll->setOrientation( QScrollBar::Horizontal );
    layout13->addWidget( bezierScroll );

    bezierwidgetbaseLayout->addLayout( layout13, 2, 0 );

    layout24 = new QHBoxLayout( 0, 0, 6, "layout24"); 

    groupBox1 = new QGroupBox( this, "groupBox1" );
    groupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1->sizePolicy().hasHeightForWidth() ) );

    textLabel1_2 = new QLabel( groupBox1, "textLabel1_2" );
    textLabel1_2->setGeometry( QRect( 10, 20, 59, 20 ) );

    ChkEnableScroll = new QCheckBox( groupBox1, "ChkEnableScroll" );
    ChkEnableScroll->setGeometry( QRect( 10, 80, 101, 21 ) );

    GridScale = new QLineEdit( groupBox1, "GridScale" );
    GridScale->setEnabled( FALSE );
    GridScale->setGeometry( QRect( 80, 50, 50, 21 ) );

    textLabel1_2_3 = new QLabel( groupBox1, "textLabel1_2_3" );
    textLabel1_2_3->setEnabled( FALSE );
    textLabel1_2_3->setGeometry( QRect( 10, 50, 50, 20 ) );

    FormGridWidth = new QLineEdit( groupBox1, "FormGridWidth" );
    FormGridWidth->setGeometry( QRect( 80, 20, 50, 21 ) );
    layout24->addWidget( groupBox1 );

    groupBox1_2 = new QGroupBox( this, "groupBox1_2" );
    groupBox1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1_2->sizePolicy().hasHeightForWidth() ) );

    textLabel1_3 = new QLabel( groupBox1_2, "textLabel1_3" );
    textLabel1_3->setGeometry( QRect( 10, 20, 66, 20 ) );

    textLabel1_2_2 = new QLabel( groupBox1_2, "textLabel1_2_2" );
    textLabel1_2_2->setGeometry( QRect( 10, 50, 50, 20 ) );

    ReverseSeek = new QCheckBox( groupBox1_2, "ReverseSeek" );
    ReverseSeek->setGeometry( QRect( 10, 80, 101, 21 ) );

    FormMinPos = new QLineEdit( groupBox1_2, "FormMinPos" );
    FormMinPos->setGeometry( QRect( 70, 50, 50, 21 ) );

    FormMaxPos = new QLineEdit( groupBox1_2, "FormMaxPos" );
    FormMaxPos->setGeometry( QRect( 70, 20, 50, 21 ) );
    layout24->addWidget( groupBox1_2 );

    groupBox7 = new QGroupBox( this, "groupBox7" );
    groupBox7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, groupBox7->sizePolicy().hasHeightForWidth() ) );
    groupBox7->setMinimumSize( QSize( 478, 0 ) );
    groupBox7->setColumnLayout(0, Qt::Vertical );
    groupBox7->layout()->setSpacing( 6 );
    groupBox7->layout()->setMargin( 11 );
    groupBox7Layout = new QGridLayout( groupBox7->layout() );
    groupBox7Layout->setAlignment( Qt::AlignTop );

    splitter1 = new QSplitter( groupBox7, "splitter1" );
    splitter1->setOrientation( QSplitter::Horizontal );

    listRegOut = new QListView( splitter1, "listRegOut" );
    listRegOut->addColumn( tr( "Td" ) );
    listRegOut->addColumn( tr( "Pos" ) );
    listRegOut->addColumn( tr( "Tin" ) );
    listRegOut->addColumn( tr( "Tout" ) );
    listRegOut->setMaximumSize( QSize( 500, 32767 ) );
    listRegOut->setResizeMode( QListView::AllColumns );

    listRegOutHex = new QListView( splitter1, "listRegOutHex" );
    listRegOutHex->addColumn( tr( "Td" ) );
    listRegOutHex->addColumn( tr( "Pos" ) );
    listRegOutHex->addColumn( tr( "Tin" ) );
    listRegOutHex->addColumn( tr( "Tout" ) );
    listRegOutHex->setResizeMode( QListView::AllColumns );

    groupBox7Layout->addMultiCellWidget( splitter1, 0, 1, 0, 0 );

    btnOSSend = new QPushButton( groupBox7, "btnOSSend" );
    btnOSSend->setMaximumSize( QSize( 60, 32767 ) );

    groupBox7Layout->addWidget( btnOSSend, 1, 1 );

    servoList = new QListView( groupBox7, "servoList" );
    servoList->addColumn( tr( "sv" ) );
    servoList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, servoList->sizePolicy().hasHeightForWidth() ) );
    servoList->setMinimumSize( QSize( 60, 60 ) );
    servoList->setMaximumSize( QSize( 60, 66 ) );
    servoList->setVScrollBarMode( QListView::AlwaysOn );
    servoList->setHScrollBarMode( QListView::AlwaysOff );

    groupBox7Layout->addWidget( servoList, 0, 1 );
    layout24->addWidget( groupBox7 );
    spacer3_2 = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout24->addItem( spacer3_2 );

    ServoSim = new QServo( this, "ServoSim" );
    ServoSim->setMinimumSize( QSize( 110, 110 ) );
    ServoSim->setMaximumSize( QSize( 110, 110 ) );
    layout24->addWidget( ServoSim );

    bezierwidgetbaseLayout->addLayout( layout24, 1, 0 );

    layout11 = new QHBoxLayout( 0, 0, 6, "layout11"); 

    layout19 = new QHBoxLayout( 0, 0, 6, "layout19"); 

    layout18 = new QVBoxLayout( 0, 0, 6, "layout18"); 

    textLabel2_2 = new QLabel( this, "textLabel2_2" );
    textLabel2_2->setMinimumSize( QSize( 75, 16 ) );
    layout18->addWidget( textLabel2_2 );

    label = new QLabel( this, "label" );
    label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, label->sizePolicy().hasHeightForWidth() ) );
    label->setMinimumSize( QSize( 75, 16 ) );
    label->setMaximumSize( QSize( 50, 32767 ) );
    layout18->addWidget( label );
    layout19->addLayout( layout18 );

    layout17 = new QVBoxLayout( 0, 0, 6, "layout17"); 

    textLabel2 = new QLabel( this, "textLabel2" );
    textLabel2->setMinimumSize( QSize( 75, 16 ) );
    layout17->addWidget( textLabel2 );

    FormTimePos = new QLabel( this, "FormTimePos" );
    FormTimePos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormTimePos->sizePolicy().hasHeightForWidth() ) );
    FormTimePos->setMinimumSize( QSize( 75, 16 ) );
    FormTimePos->setMaximumSize( QSize( 50, 32767 ) );
    layout17->addWidget( FormTimePos );
    layout19->addLayout( layout17 );

    layout16 = new QVBoxLayout( 0, 0, 6, "layout16"); 

    textLabel2_3 = new QLabel( this, "textLabel2_3" );
    textLabel2_3->setMinimumSize( QSize( 75, 16 ) );
    textLabel2_3->setAlignment( int( QLabel::AlignCenter ) );
    layout16->addWidget( textLabel2_3 );

    FormMotorPos = new QLabel( this, "FormMotorPos" );
    FormMotorPos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormMotorPos->sizePolicy().hasHeightForWidth() ) );
    FormMotorPos->setMinimumSize( QSize( 75, 16 ) );
    FormMotorPos->setMaximumSize( QSize( 50, 32767 ) );
    layout16->addWidget( FormMotorPos );
    layout19->addLayout( layout16 );

    layout15_2 = new QVBoxLayout( 0, 0, 6, "layout15_2"); 

    textLabel2_3_2 = new QLabel( this, "textLabel2_3_2" );
    textLabel2_3_2->setMinimumSize( QSize( 75, 16 ) );
    textLabel2_3_2->setAlignment( int( QLabel::AlignCenter ) );
    layout15_2->addWidget( textLabel2_3_2 );

    FormMotorSpeed = new QLabel( this, "FormMotorSpeed" );
    FormMotorSpeed->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormMotorSpeed->sizePolicy().hasHeightForWidth() ) );
    FormMotorSpeed->setMinimumSize( QSize( 75, 16 ) );
    FormMotorSpeed->setMaximumSize( QSize( 50, 32767 ) );
    layout15_2->addWidget( FormMotorSpeed );
    layout19->addLayout( layout15_2 );
    layout11->addLayout( layout19 );

    layout10 = new QGridLayout( 0, 1, 1, 0, 6, "layout10"); 

    textLabel2_4 = new QLabel( this, "textLabel2_4" );

    layout10->addWidget( textLabel2_4, 0, 1 );

    textLabel2_4_2 = new QLabel( this, "textLabel2_4_2" );
    textLabel2_4_2->setMinimumSize( QSize( 40, 0 ) );
    textLabel2_4_2->setMaximumSize( QSize( 40, 32767 ) );

    layout10->addWidget( textLabel2_4_2, 1, 1 );

    textLabel1_4 = new QLabel( this, "textLabel1_4" );
    textLabel1_4->setMinimumSize( QSize( 15, 15 ) );
    textLabel1_4->setMaximumSize( QSize( 15, 15 ) );
    textLabel1_4->setPaletteBackgroundColor( QColor( 0, 170, 0 ) );

    layout10->addWidget( textLabel1_4, 1, 0 );

    textLabel1 = new QLabel( this, "textLabel1" );
    textLabel1->setMinimumSize( QSize( 15, 15 ) );
    textLabel1->setMaximumSize( QSize( 15, 15 ) );
    textLabel1->setPaletteBackgroundColor( QColor( 255, 0, 0 ) );

    layout10->addWidget( textLabel1, 0, 0 );
    layout11->addLayout( layout10 );
    spacer8 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout11->addItem( spacer8 );

    groupBox4 = new QGroupBox( this, "groupBox4" );
    groupBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox4->sizePolicy().hasHeightForWidth() ) );
    groupBox4->setMinimumSize( QSize( 10, 45 ) );
    groupBox4->setMaximumSize( QSize( 32767, 100 ) );

    FormGridDel = new QPushButton( groupBox4, "FormGridDel" );
    FormGridDel->setGeometry( QRect( 70, 20, 50, 21 ) );

    FormGridAdd = new QPushButton( groupBox4, "FormGridAdd" );
    FormGridAdd->setGeometry( QRect( 10, 20, 50, 21 ) );
    layout11->addWidget( groupBox4 );

    groupBox5 = new QGroupBox( this, "groupBox5" );
    groupBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox5->sizePolicy().hasHeightForWidth() ) );
    groupBox5->setMinimumSize( QSize( 10, 45 ) );

    FormBtnSimStart = new QPushButton( groupBox5, "FormBtnSimStart" );
    FormBtnSimStart->setGeometry( QRect( 11, 20, 61, 20 ) );

    FormBtnSimPause = new QPushButton( groupBox5, "FormBtnSimPause" );
    FormBtnSimPause->setGeometry( QRect( 193, 20, 66, 20 ) );

    ServoSimLoop = new QCheckBox( groupBox5, "ServoSimLoop" );
    ServoSimLoop->setGeometry( QRect( 76, 20, 50, 20 ) );

    FormBtnSimStop = new QPushButton( groupBox5, "FormBtnSimStop" );
    FormBtnSimStop->setGeometry( QRect( 128, 20, 59, 20 ) );
    layout11->addWidget( groupBox5 );

    groupBox6 = new QGroupBox( this, "groupBox6" );
    groupBox6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox6->sizePolicy().hasHeightForWidth() ) );
    groupBox6->setMinimumSize( QSize( 10, 45 ) );
    groupBox6->setMaximumSize( QSize( 55, 32767 ) );

    lblDebug = new QLabel( groupBox6, "lblDebug" );
    lblDebug->setGeometry( QRect( 10, 21, 40, 20 ) );
    layout11->addWidget( groupBox6 );

    bezierwidgetbaseLayout->addLayout( layout11, 3, 0 );
    languageChange();
    resize( QSize(910, 540).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( FormGridWidth, SIGNAL( textChanged(const QString&) ), this, SLOT( gridTimeChange(const QString&) ) );
    connect( FormMaxPos, SIGNAL( textChanged(const QString&) ), this, SLOT( servoMaxPosChange(const QString&) ) );
    connect( FormMinPos, SIGNAL( textChanged(const QString&) ), this, SLOT( servoMinPosChange(const QString&) ) );
    connect( FormBtnSimStart, SIGNAL( clicked() ), this, SLOT( BtnSimStart() ) );
    connect( FormBtnSimStop, SIGNAL( clicked() ), this, SLOT( BtnSimStop() ) );
    connect( FormBtnSimPause, SIGNAL( clicked() ), this, SLOT( BtnSimPause() ) );
    connect( FormGridAdd, SIGNAL( clicked() ), this, SLOT( BtnGridAdd() ) );
    connect( FormGridDel, SIGNAL( clicked() ), this, SLOT( BtnGridDel() ) );
    connect( bezierScroll, SIGNAL( valueChanged(int) ), this, SLOT( FormBezierScroll(int) ) );
    connect( qbezier, SIGNAL( setXY(int,int) ), this, SLOT( setLabelXY(int,int) ) );
    connect( qbezier, SIGNAL( calcparams() ), this, SLOT( UpdateRegisters() ) );
    connect( ChkEnableScroll, SIGNAL( toggled(bool) ), this, SLOT( enableScroll(bool) ) );
    connect( qbezier, SIGNAL( setInfo(QString&) ), this, SLOT( infoUpdate(QString&) ) );
    connect( btnOSSend, SIGNAL( clicked() ), this, SLOT( BtnOSsendCurve() ) );
    connect( servoList, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( servoChanged(QListViewItem*) ) );

    // tab order
    setTabOrder( FormGridWidth, FormBtnSimStart );
    setTabOrder( FormBtnSimStart, ChkEnableScroll );
    setTabOrder( ChkEnableScroll, GridScale );
    setTabOrder( GridScale, ReverseSeek );
    setTabOrder( ReverseSeek, FormMinPos );
    setTabOrder( FormMinPos, FormMaxPos );
    setTabOrder( FormMaxPos, listRegOut );
    setTabOrder( listRegOut, FormGridAdd );
    setTabOrder( FormGridAdd, FormGridDel );
    setTabOrder( FormGridDel, FormBtnSimStop );
    setTabOrder( FormBtnSimStop, FormBtnSimPause );
}
Example #17
0
UserInfo::UserInfo(unsigned long uin, unsigned short grpId, int page)
        : UserInfoBase(NULL, "userinfo", WType_TopLevel | WStyle_Dialog| WDestructiveClose)
{
    SET_WNDPROC("userinfo")

    inSave = false;
    setButtonsPict(this);

    m_nUin   = uin;
    m_nGrpId = grpId;

    ICQUser *u = NULL;
    if (uin){
        u = pClient->getUser(uin);
        if (u == NULL) return;
    }
    ICQGroup *g = NULL;
    if (grpId){
        g = pClient->getGroup(grpId);
        if (g == NULL) return;
    }

    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("User info"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    if (u){
        addWidget(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
        if (u->Type == USER_TYPE_ICQ){
            addWidget(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
            addWidget(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
            addWidget(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
            addWidget(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
            addWidget(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
            addWidget(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
        }
        addWidget(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");
    }

    if ((uin == 0) || (u->Type == USER_TYPE_ICQ)){
        itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
        itemMain->setOpen(true);
        addWidget(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
        addWidget(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
        addWidget(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    }
    if (g || (u && (u->Type == USER_TYPE_ICQ))){
        itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
        itemMain->setOpen(true);
        addWidget(p_MsgDialog, SETUP_AR_AWAY,
                  SIMClient::getStatusText(ICQ_STATUS_AWAY), SIMClient::getStatusIcon(ICQ_STATUS_AWAY),
                  ICQ_STATUS_AWAY);
        addWidget(p_MsgDialog, SETUP_AR_NA,
                  SIMClient::getStatusText(ICQ_STATUS_NA), SIMClient::getStatusIcon(ICQ_STATUS_NA),
                  ICQ_STATUS_NA);
        addWidget(p_MsgDialog, SETUP_AR_OCCUPIED,
                  SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), SIMClient::getStatusIcon(ICQ_STATUS_OCCUPIED),
                  ICQ_STATUS_OCCUPIED);
        addWidget(p_MsgDialog, SETUP_AR_DND,
                  SIMClient::getStatusText(ICQ_STATUS_DND), SIMClient::getStatusIcon(ICQ_STATUS_DND),
                  ICQ_STATUS_DND);
        addWidget(p_MsgDialog, SETUP_AR_FREEFORCHAT,
                  SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), SIMClient::getStatusIcon(ICQ_STATUS_FREEFORCHAT),
                  ICQ_STATUS_FREEFORCHAT);
    }
    raiseWidget(page ? page : (u ? SETUP_MAININFO : SETUP_ALERT));

    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(btnSave, SIGNAL(clicked()), this, SLOT(saveInfo()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    if (u && (u->Type == USER_TYPE_ICQ)){
        connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    }else{
        btnUpdate->hide();
    }
    loadInfo();
    setTitle();
    setIcon();
}
Example #18
0
void ControlTrayIcon::setNotConnectedState()
{
  setIcon(m_iconDisabled);
  setText(StringTable::getString(IDS_CONTROL_CLIENT_NOT_CONNECTED));
}
Example #19
0
void Tab::setTabIcon()
{
	setIcon(WebView->icon());
}
Example #20
0
void WExpandedValuableItem::setThingData(const hacc::TDBID &iconID, const QString &name)
{
    setIcon(0, 0, iconID);
    setText(0, 0, name);
}
Example #21
0
GMRemote::GMRemote(FXApp* a,FXObject * tgt,FXSelector msg):FXMainWindow(a,"Goggles Music Manager",nullptr,nullptr,DECOR_BORDER|DECOR_TITLE|DECOR_CLOSE|DECOR_STRETCHABLE,0,0,0,0,3,3,3,3,3,3){
  flags|=FLAG_ENABLED;
  cover=nullptr;

  setTarget(tgt);
  setSelector(msg);

  setIcon(GMIconTheme::instance()->icon_applogo);
  setMiniIcon(GMIconTheme::instance()->icon_applogo_small);

  FXFontDesc fontdescription = getApp()->getNormalFont()->getFontDesc();
  fontdescription.weight = FXFont::Bold;
  fontdescription.size  += 10;
  font_title = new FXFont(getApp(),fontdescription);
  font_title->create();

  img_default = new FXPNGImage(getApp(),about_png);
  img_default->scale(64,64,FOX_SCALE_BEST);
  img_default->blend(getApp()->getBackColor());
  img_default->create();

  cover_label = new FXImageFrame(this,img_default,LAYOUT_SIDE_LEFT|FRAME_SUNKEN|LAYOUT_FIX_WIDTH|JUSTIFY_CENTER_X|JUSTIFY_CENTER_Y|LAYOUT_FILL_Y,0,0,64,64);
  cover_label->setBackColor(getApp()->getBackColor());

  /// Popup Volume Menu
  volumecontrol = new FXPopup(this,POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK|POPUP_SHRINKWRAP);
  volumeslider = new FXSlider(volumecontrol,this,GMRemote::ID_VOLUME_SLIDER,LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH|SLIDER_VERTICAL|SLIDER_TICKS_RIGHT|SLIDER_TICKS_LEFT|SLIDER_INSIDE_BAR,0,0,20,100);
  volumeslider->setTickDelta(10);
  volumeslider->setRange(0,100);
  volumeslider->setIncrement(10);

  FXHorizontalFrame * buttons = new FXHorizontalFrame(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,3,3,0,0);
  new FXButton(buttons,tr("\tShow Browser\tShow Browser"),GMIconTheme::instance()->icon_home,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_SHOW_BROWSER,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  new FXButton(buttons,tr("\tStart Playback\tStart Playback"),GMIconTheme::instance()->icon_play,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_PLAYPAUSEMENU,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXButton(buttons,tr("\tStop Playback\tStop Playback"),GMIconTheme::instance()->icon_stop,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_STOP,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  new FXButton(buttons,tr("\tPlay Previous Track\tPlay previous track."),GMIconTheme::instance()->icon_prev,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_PREV,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXButton(buttons,tr("\tPlay Next Track\tPlay next track."),GMIconTheme::instance()->icon_next,GMPlayerManager::instance()->getMainWindow(),GMWindow::ID_NEXT,BUTTON_TOOLBAR|FRAME_RAISED|ICON_ABOVE_TEXT);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  time_label =new FX7Segment(buttons,"--:--",SEVENSEGMENT_SHADOW|LAYOUT_CENTER_Y);
  time_label->setCellWidth(10);
  time_label->setCellHeight(15);
  time_label->setTarget(this);
  time_label->setSelector(ID_TIME_LABEL);
  new FXVerticalSeparator(buttons,LAYOUT_FILL_Y|SEPARATOR_GROOVE);
  volumebutton = new FXMenuButton(buttons,tr("\tAdjust Volume\tAdjust Volume"),nullptr,volumecontrol,MENUBUTTON_NOARROWS|MENUBUTTON_ATTACH_LEFT|MENUBUTTON_UP|MENUBUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_CENTER_Y);
  volumebutton->setTarget(this);
  volumebutton->setSelector(ID_VOLUME_BUTTON);

  FXVerticalFrame * info = new FXVerticalFrame(this,LAYOUT_CENTER_Y|FRAME_NONE|LAYOUT_FILL_X,0,0,0,0,2,2,2,2,0,0);
  title_label = new FXTextField(info,20,nullptr,0,FRAME_NONE|TEXTFIELD_READONLY,0,0,0,0,0,0,0,0);
  title_label->setBackColor(getApp()->getBaseColor());
  title_label->setFont(font_title);
  title_label->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
  title_label->setDragCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
  title_label->disable();

  artistalbum_label = new FXTextField(info,30,nullptr,0,FRAME_NONE|TEXTFIELD_READONLY,0,0,0,0,0,0,0,0);
  artistalbum_label->setBackColor(getApp()->getBaseColor());
  artistalbum_label->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));

  trackslider = new GMTrackProgressBar(info,this,ID_TIMESLIDER,LAYOUT_FILL_X|LAYOUT_CENTER_Y|FRAME_RAISED,0,0,0,0,0,0,0,0);
  trackslider->setTotal(100000);
  trackslider->setDefaultCursor(GMIconTheme::instance()->cursor_hand);
  trackslider->setDragCursor(GMIconTheme::instance()->cursor_hand);

  getAccelTable()->addAccel(parseAccel("F11"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_SHOW_BROWSER));
  getAccelTable()->addAccel(parseAccel("Ctrl-M"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_SHOW_BROWSER));
  getAccelTable()->addAccel(parseAccel("Ctrl-W"),this,FXSEL(SEL_CLOSE,0));
  getAccelTable()->addAccel(parseAccel("Ctrl-Q"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_QUIT));

  getAccelTable()->addAccel(parseAccel("Ctrl-P"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_PLAYPAUSEMENU));
  getAccelTable()->addAccel(parseAccel("Ctrl-\\"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_STOP));
  getAccelTable()->addAccel(parseAccel("Ctrl-["),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_PREV));
  getAccelTable()->addAccel(parseAccel("Ctrl-]"),GMPlayerManager::instance()->getMainWindow(),FXSEL(SEL_COMMAND,GMWindow::ID_NEXT));

  reset();
  }
Example #22
0
void WExpandedValuableItem::setManufacturerData(const hacc::TDBID &iconID, const QString &name)
{
    setIcon(1, 0, iconID);
    setText(1, 0, name);
}
UIActionSimple::UIActionSimple(QObject *pParent, const QIcon& icon)
    : UIAction(pParent, UIActionType_Simple)
{
    if (!icon.isNull())
        setIcon(icon);
}
Example #24
0
void HomeButton::changeIcon(QPixmap img)
{
    setIcon(img);
    setIconSize( QSize(this->width(), this->height()) );
}
Example #25
0
MainWidget::MainWidget(QWidget *parent)
  :QWidget(parent)
{
  bool skip_db_check=false;
  unsigned schema=0;

  //
  // Force a reasonable default font.
  //
  QFont mfont("helvetica",12,QFont::Normal);
  mfont.setPixelSize(12);
  qApp->setFont(mfont);

  //
  // Load Local Configs
  //
  panel_config=new RDConfig();
  panel_config->load();

  //
  // Load the command-line arguments
  //
  RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcartslots",
				   RDCARTSLOTS_USAGE);
  for(unsigned i=0;i<cmd->keys();i++) {
    if(cmd->key(i)=="--skip-db-check") {
      skip_db_check=true;
    }
  }

  //
  // Create Icons
  //
  lib_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*lib_rivendell_map);

  //
  // Ensure that system daemons are running
  //
  RDInitializeDaemons();

  //
  // Open Database
  //
  QString err;
  QSqlDatabase *db=RDInitDb(&schema,&err);
  if(!db) {
    QMessageBox::warning(this,tr("Can't Connect"),err);
    exit(0);
  }
  if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
    fprintf(stderr,
	    "rdcastmanager: database version mismatch, should be %u, is %u\n",
	    RD_VERSION_DATABASE,schema);
    exit(256);
  }
  new RDDbHeartbeat(panel_config->mysqlHeartbeatInterval(),this);

  //
  // Allocate Global Resources
  //
  panel_station=new RDStation(panel_config->stationName());
  panel_system=new RDSystem();

  //
  // RDAirPlay Configuration
  //
  panel_airplay_conf=new RDAirPlayConf(panel_config->stationName(),"RDAIRPLAY");

  //
  // CAE Connection
  //
  panel_cae=new RDCae(panel_station,panel_config,parent);
  panel_cae->connectHost();

  //
  // RIPC Connection
  //
  panel_ripc=new RDRipc(panel_config->stationName());
  connect(panel_ripc,SIGNAL(userChanged()),this,SLOT(userData()));
  connect(panel_ripc,SIGNAL(rmlReceived(RDMacro *)),
	  this,SLOT(rmlReceivedData(RDMacro *)));

  //
  // User
  //
  panel_user=NULL;

  //
  // Service Picker
  //
  panel_svcs_dialog=new RDListSvcs(tr("RDCartSlots"),this);

  //
  // Macro Player
  //
  panel_player=new RDEventPlayer(panel_ripc,this);

  //
  // Dialogs
  //
  panel_cart_dialog=new RDCartDialog(&panel_filter,&panel_group,
				     &panel_schedcode,panel_cae,panel_ripc,
				     panel_station,panel_system,panel_config,
				     this);
  panel_slot_dialog=new RDSlotDialog(tr("RDCartSlots"),this);
  panel_cue_dialog=new RDCueEditDialog(panel_cae,panel_station->cueCard(),
				       panel_station->cuePort(),
				       tr("RDCartSlots"),this);

  //
  // Cart Slots
  //
  QTimer *timer=new QTimer(this);
  for(int i=0;i<panel_station->cartSlotColumns();i++) {
    for(int j=0;j<panel_station->cartSlotRows();j++) {
      panel_slots.
	push_back(new RDCartSlot(panel_slots.size(),panel_ripc,panel_cae,
				 panel_station,panel_config,panel_svcs_dialog,
				 panel_slot_dialog,panel_cart_dialog,
				 panel_cue_dialog,tr("RDCartSlots"),
				 panel_airplay_conf,this));
      panel_slots.back()->
	setGeometry(10+i*(panel_slots.back()->sizeHint().width()+10),
		    10+j*(panel_slots.back()->sizeHint().height()+5),
		  panel_slots.back()->sizeHint().width(),
		  panel_slots.back()->sizeHint().height());
      connect(timer,SIGNAL(timeout()),
	      panel_slots.back(),SLOT(updateMeters()));
    }
  }
  timer->start(METER_INTERVAL);
  panel_ripc->connectHost("localhost",RIPCD_TCP_PORT,panel_config->password());

  //
  // Fix the Window Size
  //
#ifndef RESIZABLE
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());
#endif  // RESIZABLE
}
    ExplorerCollectionTreeItem::ExplorerCollectionTreeItem(QTreeWidgetItem *parent, ExplorerDatabaseTreeItem *databaseItem, MongoCollection *collection) :
        BaseClass(parent), _collection(collection), _databaseItem(databaseItem)
    {
        QAction *addDocument = new QAction("Insert Document...", this);
        VERIFY(connect(addDocument, SIGNAL(triggered()), SLOT(ui_addDocument())));

        QAction *updateDocument = new QAction("Update Documents...", this);
        VERIFY(connect(updateDocument, SIGNAL(triggered()), SLOT(ui_updateDocument())));
        QAction *removeDocument = new QAction("Remove Documents...", this);
        VERIFY(connect(removeDocument, SIGNAL(triggered()), SLOT(ui_removeDocument())));

        QAction *removeAllDocuments = new QAction("Remove All Documents...", this);
        VERIFY(connect(removeAllDocuments, SIGNAL(triggered()), SLOT(ui_removeAllDocuments())));

        QAction *collectionStats = new QAction("Statistics", this);
        VERIFY(connect(collectionStats, SIGNAL(triggered()), SLOT(ui_collectionStatistics())));

        QAction *storageSize = new QAction("Storage Size", this);
        VERIFY(connect(storageSize, SIGNAL(triggered()), SLOT(ui_storageSize())));

        QAction *totalIndexSize = new QAction("Total Index Size", this);
        VERIFY(connect(totalIndexSize, SIGNAL(triggered()), SLOT(ui_totalIndexSize())));

        QAction *totalSize = new QAction("Total Size", this);
        VERIFY(connect(totalSize, SIGNAL(triggered()), SLOT(ui_totalSize())));
        QAction *shardVersion = new QAction("Shard Version", this);
        VERIFY(connect(shardVersion, SIGNAL(triggered()), SLOT(ui_shardVersion())));

        QAction *shardDistribution = new QAction("Shard Distribution", this);
        VERIFY(connect(shardDistribution, SIGNAL(triggered()), SLOT(ui_shardDistribution())));

        QAction *dropCollection = new QAction("Drop Collection...", this);
        VERIFY(connect(dropCollection, SIGNAL(triggered()), SLOT(ui_dropCollection())));

        QAction *renameCollection = new QAction("Rename Collection...", this);
        VERIFY(connect(renameCollection, SIGNAL(triggered()), SLOT(ui_renameCollection())));
        QAction *duplicateCollection = new QAction("Duplicate Collection...", this);
        VERIFY(connect(duplicateCollection, SIGNAL(triggered()), SLOT(ui_duplicateCollection())));

        // Disabling for 0.8.5 release as this is currently a broken misfeature (see discussion on issue #398)
        // QAction *copyCollectionToDiffrentServer = new QAction("Copy Collection to Database...", this);
        // VERIFY(connect(copyCollectionToDiffrentServer, SIGNAL(triggered()), SLOT(ui_copyToCollectionToDiffrentServer())));

        QAction *viewCollection = new QAction("View Documents", this);
        VERIFY(connect(viewCollection, SIGNAL(triggered()), SLOT(ui_viewCollection())));

        BaseClass::_contextMenu->addAction(viewCollection);
        BaseClass::_contextMenu->addSeparator();
        BaseClass::_contextMenu->addAction(addDocument);
        BaseClass::_contextMenu->addAction(updateDocument);
        BaseClass::_contextMenu->addAction(removeDocument);
        BaseClass::_contextMenu->addAction(removeAllDocuments);
        BaseClass::_contextMenu->addSeparator();
        BaseClass::_contextMenu->addAction(renameCollection);
        BaseClass::_contextMenu->addAction(duplicateCollection);
        // Disabling for 0.8.5 release as this is currently a broken misfeature (see discussion on issue #398)
        // BaseClass::_contextMenu->addAction(copyCollectionToDiffrentServer);
        BaseClass::_contextMenu->addAction(dropCollection);
        BaseClass::_contextMenu->addSeparator();
        BaseClass::_contextMenu->addAction(collectionStats);
        BaseClass::_contextMenu->addSeparator();
        BaseClass::_contextMenu->addAction(shardVersion);
        BaseClass::_contextMenu->addAction(shardDistribution);

        AppRegistry::instance().bus()->subscribe(_databaseItem, LoadCollectionIndexesResponse::Type, this);
        AppRegistry::instance().bus()->subscribe(_databaseItem, DeleteCollectionIndexResponse::Type, this);
        AppRegistry::instance().bus()->subscribe(this, CollectionIndexesLoadingEvent::Type, this);
        
        setText(0, QtUtils::toQString(_collection->name()));
        setIcon(0, GuiRegistry::instance().collectionIcon());

        _indexDir = new ExplorerCollectionDirIndexesTreeItem(this);
        addChild(_indexDir);
        setToolTip(0, buildToolTip(collection));

        setExpanded(false);
        setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
    }
Example #27
0
void VolumeButton::handleStockIconChanged(const QString &iconName)
{
    setIcon(XdgIcon::fromTheme(iconName));
}
Example #28
0
void SketchToolButton::setImage(const QPixmap & pixmap) {
	setIcon(QIcon(pixmap));
}
CoffeeTableItem::CoffeeTableItem(int id, std::string texture, ItemMaterial mat, int tileId) : PlaceableItem(id, tileId) {
	setNameID(texture);
	setIcon(texture, 0);
	this->material = mat;
}
void OSLoadNamePixmapLineEdit::onModelObjectChange()
{
  setIcon();
}