// Constructor. qtractorConnections::qtractorConnections ( QWidget *pParent, Qt::WindowFlags wflags ) : QWidget(pParent, wflags) { // Surely a name is crucial (e.g.for storing geometry settings) QWidget::setObjectName("qtractorConnections"); // Create main inner widget. m_pConnectForm = new qtractorConnectForm(this); // Set proper tab widget icons... QTabWidget *pTabWidget = m_pConnectForm->connectTabWidget(); pTabWidget->setTabIcon(0, QIcon(":/images/trackAudio.png")); pTabWidget->setTabIcon(1, QIcon(":/images/trackMidi.png")); // Prepare the layout stuff. QHBoxLayout *pLayout = new QHBoxLayout(); pLayout->setMargin(0); pLayout->setSpacing(0); pLayout->addWidget(m_pConnectForm); QWidget::setLayout(pLayout); // Some specialties to this kind of dock window... QWidget::setMinimumWidth(480); QWidget::setMinimumHeight(240); // Finally set the default caption and tooltip. const QString& sCaption = tr("Connections") + " - " QTRACTOR_TITLE; QWidget::setWindowTitle(sCaption); QWidget::setWindowIcon(QIcon(":/images/viewConnections.png")); QWidget::setToolTip(sCaption); // Get previously saved splitter sizes, // (with fair default...) qtractorOptions *pOptions = qtractorOptions::getInstance(); if (pOptions) { QList<int> sizes; sizes.append(180); sizes.append(60); sizes.append(180); pOptions->loadSplitterSizes( m_pConnectForm->audioConnectSplitter(), sizes); pOptions->loadSplitterSizes( m_pConnectForm->midiConnectSplitter(), sizes); } }
void Tab::updateIcon(void) { QTabWidget* widget = qobject_cast<QTabWidget*>(parentWidget()->parentWidget()); if(widget) { QIcon icon = _webView->icon(); if(icon.isNull()) { icon = QIcon(":/defaultPageIcon.png"); } widget->setTabIcon(widget->indexOf(this), icon); } }
void ConfigurationManager::initTabIcons() { QTabWidget *tw = ui->tabWidget; if ( !tw->tabIcon(0).isNull() ) return; tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconWrench) ); tw->setTabIcon( tw->indexOf(ui->tabLayout), getIcon("", IconColumns) ); tw->setTabIcon( tw->indexOf(ui->tabHistory), getIcon("", IconListAlt) ); tw->setTabIcon( tw->indexOf(ui->tabItems), getIcon("", IconThList) ); tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) ); tw->setTabIcon( tw->indexOf(ui->tabNotifications), getIcon("", IconInfoCircle) ); tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconKeyboard) ); tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconImage) ); }
int TabWidget::setTabIcon( lua_State * L ) //( int index, const QIcon & icon )void { QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 ); int index = 0; if ( Util::isNum( L, 2 ) ) { if ( Util::toInt( L, 2 )>=0 ) { index = Util::toInt( L, 2 ); } else { Util::error( L, "Invalid Index" ); } } QIcon* icon = ValueInstaller2<QIcon>::check( L, 4 ); obj->setTabIcon( index, *icon ); return 0; }
ConfigurationManager::ConfigurationManager() : QDialog() , ui(new Ui::ConfigurationManager) , m_datfilename() , m_options() , m_theme() , m_commands() { ui->setupUi(this); ui->scrollAreaCommand->hide(); ClipboardBrowser *c = ui->clipboardBrowserPreview; c->addItems( QStringList() << tr("Search string is \"item\".") << tr("Select an item and\n" "press F2 to edit.") << tr("Select items and move them with\n" "CTRL and up or down key.") << tr("Remove item with Delete key.") << tr("Example item %1").arg(1) << tr("Example item %1").arg(2) << tr("Example item %1").arg(3) ); c->filterItems( tr("item") ); #ifdef NO_GLOBAL_SHORTCUTS ui->tabShortcuts->deleteLater(); #endif Command cmd; int i = 0; QMenu *menu = new QMenu(ui->toolButtonAddCommand); ui->toolButtonAddCommand->setMenu(menu); while ( defaultCommand(++i, &cmd) ) { menu->addAction( IconFactory::iconFromFile(cmd.icon), cmd.name.remove('&') ) ->setProperty("COMMAND", i); } /* general options */ m_options["maxitems"] = Option(200, "value", ui->spinBoxItems); m_options["editor"] = Option(DEFAULT_EDITOR, "text", ui->lineEditEditor); m_options["edit_ctrl_return"] = Option(true, "checked", ui->checkBoxEditCtrlReturn); m_options["check_clipboard"] = Option(true, "checked", ui->checkBoxClip); m_options["confirm_exit"] = Option(true, "checked", ui->checkBoxConfirmExit); m_options["vi"] = Option(false, "checked", ui->checkBoxViMode); m_options["always_on_top"] = Option(false, "checked", ui->checkBoxAlwaysOnTop); m_options["tab_position"] = Option(0, "currentIndex", ui->comboBoxTabPosition); m_options["text_wrap"] = Option(true, "checked", ui->checkBoxTextWrap); m_options["tray_items"] = Option(5, "value", ui->spinBoxTrayItems); m_options["tray_commands"] = Option(true, "checked", ui->checkBoxTrayShowCommands); m_options["tray_tab_is_current"] = Option(true, "checked", ui->checkBoxMenuTabIsCurrent); m_options["tray_images"] = Option(true, "checked", ui->checkBoxTrayImages); m_options["tray_tab"] = Option("", "text", ui->comboBoxMenuTab->lineEdit()); // Tooltip to show on command line. ui->comboBoxMenuTab->lineEdit()->setToolTip( ui->comboBoxMenuTab->toolTip() ); /* other options */ m_options["tabs"] = Option(QStringList()); m_options["command_history_size"] = Option(100); m_options["_last_hash"] = Option(0); #ifndef NO_GLOBAL_SHORTCUTS /* shortcuts */ m_options["toggle_shortcut"] = Option("", "text", ui->pushButton); m_options["menu_shortcut"] = Option("", "text", ui->pushButton_2); m_options["edit_clipboard_shortcut"] = Option("", "text", ui->pushButton_3); m_options["edit_shortcut"] = Option("", "text", ui->pushButton_4); m_options["second_shortcut"] = Option("", "text", ui->pushButton_5); m_options["show_action_dialog"] = Option("", "text", ui->pushButton_6); m_options["new_item_shortcut"] = Option("", "text", ui->pushButton_7); #endif #ifdef COPYQ_WS_X11 /* X11 clipboard selection monitoring and synchronization */ m_options["check_selection"] = Option(true, "checked", ui->checkBoxSel); m_options["copy_clipboard"] = Option(true, "checked", ui->checkBoxCopyClip); m_options["copy_selection"] = Option(true, "checked", ui->checkBoxCopySel); #else ui->checkBoxCopySel->hide(); ui->checkBoxSel->hide(); ui->checkBoxCopyClip->hide(); #endif // values of last submitted action m_options["action_has_input"] = Option(false); m_options["action_has_output"] = Option(false); m_options["action_separator"] = Option("\\n"); m_options["action_output_tab"] = Option(""); /* appearance options */ QString name; QPalette p; name = p.color(QPalette::Base).name(); m_theme["bg"] = Option(name, "VALUE", ui->pushButtonColorBg); m_theme["edit_bg"] = Option(name, "VALUE", ui->pushButtonColorEditorBg); name = p.color(QPalette::Text).name(); m_theme["fg"] = Option(name, "VALUE", ui->pushButtonColorFg); m_theme["edit_fg"] = Option(name, "VALUE", ui->pushButtonColorEditorFg); name = p.color(QPalette::Text).lighter(400).name(); m_theme["num_fg"] = Option(name, "VALUE", ui->pushButtonColorNumberFg); name = p.color(QPalette::AlternateBase).name(); m_theme["alt_bg"] = Option(name, "VALUE", ui->pushButtonColorAltBg); name = p.color(QPalette::Highlight).name(); m_theme["sel_bg"] = Option(name, "VALUE", ui->pushButtonColorSelBg); name = p.color(QPalette::HighlightedText).name(); m_theme["sel_fg"] = Option(name, "VALUE", ui->pushButtonColorSelFg); m_theme["find_bg"] = Option("#ff0", "VALUE", ui->pushButtonColorFindBg); m_theme["find_fg"] = Option("#000", "VALUE", ui->pushButtonColorFindFg); m_theme["font"] = Option("", "VALUE", ui->pushButtonFont); m_theme["edit_font"] = Option("", "VALUE", ui->pushButtonEditorFont); m_theme["find_font"] = Option("", "VALUE", ui->pushButtonFoundFont); m_theme["num_font"] = Option("", "VALUE", ui->pushButtonNumberFont); m_theme["show_number"] = Option(true, "checked", ui->checkBoxShowNumber); m_theme["show_scrollbars"] = Option(true, "checked", ui->checkBoxScrollbars); m_options["use_system_icons"] = Option(false, "checked", ui->checkBoxSystemIcons); /* datafile for items */ QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName()); const QString settingsFileName = settings.fileName(); m_datfilename = settingsFileName; m_datfilename.replace( QRegExp(".ini$"), QString("_tab_") ); // Create directory to save items (otherwise it may not exist at time of saving). QDir settingsDir(settingsFileName + "/.."); if ( settingsDir.mkdir(".") ) { log( tr("Cannot create directory for settings \"%1\"!").arg(settingsDir.path()), LogError ); } connect(this, SIGNAL(finished(int)), SLOT(onFinished(int))); // Tab icons QTabWidget *tw = ui->tabWidget; tw->setTabIcon( tw->indexOf(ui->tabClipboard), getIcon("", IconPaste) ); tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconListOl) ); tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) ); tw->setTabIcon( tw->indexOf(ui->tabCommands), getIcon("", IconCogs) ); tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconHandUp) ); tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconPicture) ); loadSettings(); }
void QTabWidgetProto::setTabIcon(int index, const QIcon &icon) { QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject()); if (item) item->setTabIcon(index, icon); }