Ejemplo n.º 1
0
int main(int argc, char *argv[]) {
    
    
    GtkWidget *notebook;
    GtkWidget *tab;

    gtk_init(&argc, &argv);
    glutInit(&argc, argv);//对GLUT进行初始化,这个函数必须在其它的GLUT使用之前调用一次
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "罗婷婷插补仿真系统");
    gtk_window_set_icon_from_file(GTK_WINDOW(window),"Goozillian.jpg",0);
    gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);

    notebook = gtk_notebook_new();

    tab = createTab("Timting.jpg", "空间直线插补");
    
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addButton(tab1Box(w_tab1),line_interpolation), tab);

    tab = createTab("Timting.jpg", "空间圆弧插补");
    
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addButton(tab2Box(w_tab2),circle_interpolation/*不提供参数就要使用extern*/), tab);
    

    gtk_container_add(GTK_CONTAINER(window), to_a_vbox(createMenu(),notebook));

    g_signal_connect(GTK_OBJECT(window), "destroy",G_CALLBACK(gtk_main_quit), NULL);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}
 void shouldNotChangeCurrentTabWhenAddingUnlessModelWasEmpty()
 {
     QSignalSpy spy(model, SIGNAL(currentTabChanged()));
     QQuickItem* tab = createTab();
     model->add(tab);
     QCOMPARE(spy.count(), 1);
     QCOMPARE(model->currentTab(), tab);
     spy.clear();
     model->add(createTab());
     QVERIFY(spy.isEmpty());
     QCOMPARE(model->currentTab(), tab);
 }
 void shouldUpdateCurrentTabWhenSettingCurrent()
 {
     QQuickItem* tab1 = createTab();
     model->add(tab1);
     QSignalSpy spy(model, SIGNAL(currentTabChanged()));
     model->setCurrent(0);
     QVERIFY(spy.isEmpty());
     QCOMPARE(model->currentTab(), tab1);
     QQuickItem* tab2 = createTab();
     model->add(tab2);
     model->setCurrent(1);
     QCOMPARE(spy.count(), 1);
     QCOMPARE(model->currentTab(), tab2);
 }
void DeclarativeTabModel::addTab(const QString& url, const QString &title) {
    if (!LinkValidator::navigable(QUrl(url))) {
        return;
    }
    int tabId = createTab();
    int linkId = createLink(tabId, url, title);

    Tab tab(tabId, Link(linkId, url, "", title), 0, 0);
#if DEBUG_LOGS
    qDebug() << "new tab data:" << &tab;
#endif
    int index = m_tabs.count();
    beginInsertRows(QModelIndex(), index, index);
    m_tabs.append(tab);
    endInsertRows();
    // We should trigger this only when
    // tab is added through new window request. In all other
    // case we should keep the new tab in background.
    updateActiveTab(tab, true);

    emit countChanged();
    emit tabAdded(tabId);

    m_nextTabId = ++tabId;
    emit nextTabIdChanged();

    setWaitingForNewTab(false);
}
Ejemplo n.º 5
0
/**
 * Called when recieving a private message.
 * Adds message to a tab if the tab corresponds to the given convo id,
 * otherwise creates a new tab.
 * @brief MainWindow::displayPrivateMsg
 * @param data "{convo_id}|{from_ip}|{message_txt}"
 */
void MainWindow::displayPrivateMsg(QString data)
{
    QRegularExpression re("(\\d+)\\|(\\d+\\.\\d+\\.\\d+\\.\\d+)\\|(.*)");
    QRegularExpressionMatch match = re.match(data);

    for (int i = 0; i < convos->count(); i++)
    {
        if(convos->at(i)->getCid().compare(match.captured(1)) == 0)
        {
            QTextEdit* tmp = ui->tabgrpConversations->widget(i+1)->findChild<QTextEdit*>(CONVO_TAB_TXT_ID);
            addTextToConvo(tmp, match.captured(3));

            if(ui->tabgrpConversations->currentIndex() != i+1) //if tab not focused, set header color to red.
                indicateChange(i+1, CHANGE_NEW);
            if(!isVisible())
                displayTrayMsg(i+1, match.captured(3));
            return;
        }
    }
    createTab(match.captured(1), match.captured(2), match.captured(3).split("|").at(0));
    QTextEdit* tmp = ui->tabgrpConversations->widget(convos->count())->findChild<QTextEdit*>(CONVO_TAB_TXT_ID);
    addTextToConvo(tmp, match.captured(3));
    indicateChange(convos->count(), CHANGE_NEW);
    if(!isVisible()) displayTrayMsg(convos->count(), match.captured(3));
}
    void shouldNotifyWhenTabPropertiesChange()
    {
        qRegisterMetaType<QVector<int> >();
        QSignalSpy spy(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)));
        QQuickItem* tab = createTab();
        model->add(tab);

        QQmlProperty(tab, "url").write(QUrl("http://ubuntu.com"));
        QCOMPARE(spy.count(), 1);
        QList<QVariant> args = spy.takeFirst();
        QCOMPARE(args.at(0).toModelIndex().row(), 0);
        QCOMPARE(args.at(1).toModelIndex().row(), 0);
        QVector<int> roles = args.at(2).value<QVector<int> >();
        QCOMPARE(roles.size(), 1);
        QVERIFY(roles.contains(TabsModel::Url));

        QQmlProperty(tab, "title").write(QString("Lorem Ipsum"));
        QCOMPARE(spy.count(), 1);
        args = spy.takeFirst();
        QCOMPARE(args.at(0).toModelIndex().row(), 0);
        QCOMPARE(args.at(1).toModelIndex().row(), 0);
        roles = args.at(2).value<QVector<int> >();
        QCOMPARE(roles.size(), 1);
        QVERIFY(roles.contains(TabsModel::Title));

        QQmlProperty(tab, "icon").write(QUrl("image://webicon/123"));
        QCOMPARE(spy.count(), 1);
        args = spy.takeFirst();
        QCOMPARE(args.at(0).toModelIndex().row(), 0);
        QCOMPARE(args.at(1).toModelIndex().row(), 0);
        roles = args.at(2).value<QVector<int> >();
        QCOMPARE(roles.size(), 1);
        QVERIFY(roles.contains(TabsModel::Icon));
    }
 void shouldUpdateCountWhenAddingTab()
 {
     QSignalSpy spy(model, SIGNAL(countChanged()));
     model->add(createTab());
     QCOMPARE(spy.count(), 1);
     QCOMPARE(model->rowCount(), 1);
 }
Ejemplo n.º 8
0
/**
 * Adds a participant to a convo, if that conversation dont exist, the tab and convo is created.
 * @brief MainWindow::addToConvo
 * @param fromIp ip of user that added someone to a conversation, empty if originating user is the current user.
 * @param fromName name of user that added someone to a conversation, empty if originating user is the current user.
 * @param member new participant to be added: "{name}/{ip}"
 * @param cid Conversation id.
 * @return false if member already exists in the conversation, true otherwise.
 */
bool MainWindow::addToConvo(QString fromIp, QString fromName, QString member, QString cid)
{
    Conversation* lst = 0;
    QStringList tmp = member.split("/", QString::SkipEmptyParts);
    int i = 0;
    for (; i < convos->count(); ++i)
    {
        if(convos->at(i)->getCid().compare(cid) == 0)
        {
            lst = convos->at(i);
            break;
        }
    }

    if(lst == 0)
    {
        createTab(cid, fromIp, fromName);
        lst = convos->at(convos->count()-1);
    }
    else
    {
        for (int i = 0; i < lst->count(); ++i)
        {
            if(tmp.at(1).compare(lst->at(i)->getIp()) == 0) return false;
        }
    }

    lst->add(tmp.at(1), tmp.at(0));

    if(ui->tabgrpConversations->currentIndex() == (i+1))
        ui->lstInConvo->addItem(member);

    return true;
}
Ejemplo n.º 9
0
DTabWidget *DMainWindow::splitVertical() 
{
//     invalidateActiveTabWidget();
    int row = m_central->indexOf(m_activeTabWidget).first;
    m_activeTabWidget = createTab();
    m_central->addDock(row, m_central->numCols(row), m_activeTabWidget);
    return m_activeTabWidget;
}
 void shouldNotDeleteTabWhenRemoving()
 {
     QQuickItem* tab = createTab();
     model->add(tab);
     model->remove(0);
     QCOMPARE(tab->parent(), this);
     delete tab;
 }
 void shouldReturnTabWhenRemoving()
 {
     QQuickItem* tab = createTab();
     model->add(tab);
     QObject* removed = model->remove(0);
     QCOMPARE(removed, tab);
     delete removed;
 }
 void shouldUpdateCountWhenRemovingTab()
 {
     model->add(createTab());
     QSignalSpy spy(model, SIGNAL(countChanged()));
     delete model->remove(0);
     QCOMPARE(spy.count(), 1);
     QCOMPARE(model->rowCount(), 0);
 }
Ejemplo n.º 13
0
DMainWindow::DMainWindow(QWidget *parent, const char *name)
    :KParts::MainWindow(parent, name), m_firstRemoved(false), m_currentWidget(0)
{
    loadSettings();
    createToolWindows();
    m_central = new Ideal::DockSplitter(Qt::Horizontal, this);
    m_activeTabWidget = createTab();
    m_central->addDock(0, 0, m_activeTabWidget);
    setCentralWidget(m_central);
}
 void shouldNotifyWhenAddingTab()
 {
     QSignalSpy spy(model, SIGNAL(rowsInserted(const QModelIndex&, int, int)));
     for(int i = 0; i < 3; ++i) {
         model->add(createTab());
         QCOMPARE(spy.count(), 1);
         QList<QVariant> args = spy.takeFirst();
         QCOMPARE(args.at(1).toInt(), i);
         QCOMPARE(args.at(2).toInt(), i);
     }
 }
Ejemplo n.º 15
0
/**
 * Called when double-clicking a contact in the contact list.
 * Creates a new conversation with a new id, and a new tab.
 * @brief MainWindow::newPrivateConvo
 */
void MainWindow::newPrivateConvo()
{
    QString pConvo(ui->lstContacts->selectedItems().at(0)->data(Qt::DisplayRole).toString());
    QTabWidget* grp = ui->tabgrpConversations;

    QStringList t = pConvo.split("/", QString::SkipEmptyParts);
    createTab(QString::number(QDateTime::currentMSecsSinceEpoch()), t.at(1), t.at(0));

    //Set selected tab to newly created
    grp->setCurrentIndex(grp->count()-1);
}
Ejemplo n.º 16
0
static void listener_ircLine(void *subject, const char *event, void *data, va_list args)
{
	IrcConnection *connection = subject;
	IrcMessage *message = va_arg(args, IrcMessage *);

	if(irc != connection) {
		return;
	}

	appendMessage("*status", message->raw_message, MESSAGE_LINE);

	if(g_strcmp0(message->command, "JOIN") == 0) {
		IrcUserMask *mask = parseIrcUserMask(message->prefix);
		if(mask != NULL) {
			char *nick = irc->nick;

			if(g_strcmp0(mask->nick, nick) == 0) { // it's-a-me!
				if(message->params != NULL && message->params[0] != NULL) { // usually, the channel is being sent straight as parameter
					createTab(message->params[0]);
				} else if(message->trailing != NULL) { // some other servers though, like znc, send it as trailing parameter...
					createTab(message->trailing);
				} else { // anything else can't possibly happen
					logError("No channel given in JOIN command");
				}
			}

			freeIrcUserMask(mask);
		}
	} else if(g_strcmp0(message->command, "PRIVMSG") == 0) {
		if(message->params[0] != NULL) {
			IrcUserMask *mask = parseIrcUserMask(message->prefix);
			if(mask != NULL) {
				GString *msg = g_string_new("");
				g_string_append_printf(msg, "<%s> %s", mask->nick, message->trailing);
				appendMessage(message->params[0], msg->str, MESSAGE_LINE);
				g_string_free(msg, true);
				freeIrcUserMask(mask);
			}
		}
	}
}
Ejemplo n.º 17
0
void KgGeneral::createExtensionsTab()
{
    // ------------------------- atomic extensions ----------------------------------

    QWidget *tab = createTab(i18n("Atomic extensions"));
    QGridLayout *tabLayout = new QGridLayout(tab);
    tabLayout->setSpacing(6);
    tabLayout->setContentsMargins(11, 11, 11, 11);

    QWidget * vboxWidget2 = new QWidget(tab);
    tabLayout->addWidget(vboxWidget2);

    QVBoxLayout * vbox2 = new QVBoxLayout(vboxWidget2);

    QWidget * hboxWidget3 = new QWidget(vboxWidget2);
    vbox2->addWidget(hboxWidget3);

    QHBoxLayout * hbox3 = new QHBoxLayout(hboxWidget3);

    QLabel * atomLabel = new QLabel(i18n("Atomic extensions:"), hboxWidget3);
    hbox3->addWidget(atomLabel);

    int size = QFontMetrics(atomLabel->font()).height();

    QToolButton *addButton = new QToolButton(hboxWidget3);
    hbox3->addWidget(addButton);

    QPixmap icon = krLoader->loadIcon("list-add", KIconLoader::Desktop, size);
    addButton->setFixedSize(icon.width() + 4, icon.height() + 4);
    addButton->setIcon(QIcon(icon));
    connect(addButton, SIGNAL(clicked()), this, SLOT(slotAddExtension()));

    QToolButton *removeButton = new QToolButton(hboxWidget3);
    hbox3->addWidget(removeButton);

    icon = krLoader->loadIcon("list-remove", KIconLoader::Desktop, size);
    removeButton->setFixedSize(icon.width() + 4, icon.height() + 4);
    removeButton->setIcon(QIcon(icon));
    connect(removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveExtension()));

    QStringList defaultAtomicExtensions;
    defaultAtomicExtensions += ".tar.gz";
    defaultAtomicExtensions += ".tar.bz2";
    defaultAtomicExtensions += ".tar.lzma";
    defaultAtomicExtensions += ".tar.xz";
    defaultAtomicExtensions += ".moc.cpp";

    listBox = createListBox("Look&Feel", "Atomic Extensions",
                            defaultAtomicExtensions, vboxWidget2, true, PAGE_EXTENSIONS);
    vbox2->addWidget(listBox);
}
Ejemplo n.º 18
0
/**
 * Called when user has been added to an existing conversation
 * between two or more participants. Creates a new tab, and
 * adds all participants to the corresponding conversation list.
 * @brief MainWindow::createExistingConvo
 * @param data "{convo_id}|{ip}|{name}|{ip}|{name}|..."
 */
void MainWindow::createExistingConvo(QString data)
{
    QStringList stuff = data.split('|', QString::SkipEmptyParts);

    createTab(stuff.at(0), stuff.at(1), stuff.at(2));
    indicateChange(convos->count());
    Conversation* newConvo = convos->at(convos->count()-1);

    for (int i = 3; i < stuff.count(); i++)
    {
        QString ip = stuff.at(i++); //Separated to avoid possibly undefined behavior.
        newConvo->add(ip, stuff.at(i));
    }
}
    void shouldUpdateCurrentTabWhenRemoving()
    {
        QSignalSpy spy(model, SIGNAL(currentTabChanged()));

        // Adding a tab to an empty model should update the current tab.
        // Removing the last tab from the model should update it too.
        model->add(createTab());
        delete model->remove(0);
        QCOMPARE(spy.count(), 2);

        // When removing a tab after the current one,
        // the current tab shouldn’t change.
        QQuickItem* tab1 = createTab();
        model->add(tab1);
        model->add(createTab());
        spy.clear();
        delete model->remove(1);
        QCOMPARE(model->currentTab(), tab1);
        QVERIFY(spy.isEmpty());

        // When removing the current tab, if there is a tab after it,
        // it becomes the current one.
        QQuickItem* tab2 = createTab();
        model->add(tab2);
        spy.clear();
        delete model->remove(0);
        QCOMPARE(spy.count(), 1);
        QCOMPARE(model->currentTab(), tab2);

        // When removing the current tab, if it was the last one, the
        // current tab should be reset to 0.
        spy.clear();
        delete model->remove(0);
        QCOMPARE(spy.count(), 1);
        QCOMPARE(model->currentTab(), (QObject*) 0);
    }
Ejemplo n.º 20
0
void GuildManager::updateList()
{
    Guild *guild = Guild::getGuild(1);
    if (guild)
    {
        guild->setServerGuild(false);
        StringVectCIter it = mTempList.begin();
        StringVectCIter it_end = mTempList.end();
        int i = 0;
        while (it != it_end)
        {
            std::string name = *it;
            if (name.size() > 1)
            {
                int status = atoi(name.substr(name.size() - 1).c_str());

                name = name.substr(0, name.size() - 1);
                GuildMember *m = guild->addMember(i, 0, name);
                if (m)
                {
                    m->setOnline(status & 1);
                    m->setGender(GENDER_UNSPECIFIED);
                    if (status & 2)
                        m->setPos(10);
                    else
                        m->setPos(0);
                    if (player_node && name == player_node->getName())
                    {
                        mHavePower = (status & 2);
                        m->setOnline(true);
                    }
                }
            }
            ++ it;
            i ++;
        }
        guild->sort();
        createTab(guild);
        if (actorSpriteManager)
        {
            actorSpriteManager->updatePlayerGuild();
            actorSpriteManager->updatePlayerColors();
        }
    }
    mTempList.clear();
    mSentInfoRequest = false;
    mGotInfo = true;
}
 void shouldReturnData()
 {
     QQuickItem* tab = createTab();
     QQmlProperty(tab, "url").write(QUrl("http://ubuntu.com/"));
     QQmlProperty(tab, "title").write(QString("Lorem Ipsum"));
     QQmlProperty(tab, "icon").write(QUrl("image://webicon/123"));
     model->add(tab);
     QVERIFY(!model->data(QModelIndex(), TabsModel::Url).isValid());
     QVERIFY(!model->data(model->index(-1, 0), TabsModel::Url).isValid());
     QVERIFY(!model->data(model->index(3, 0), TabsModel::Url).isValid());
     QCOMPARE(model->data(model->index(0, 0), TabsModel::Url).toUrl(), QUrl("http://ubuntu.com/"));
     QCOMPARE(model->data(model->index(0, 0), TabsModel::Title).toString(), QString("Lorem Ipsum"));
     QCOMPARE(model->data(model->index(0, 0), TabsModel::Icon).toUrl(), QUrl("image://webicon/123"));
     QCOMPARE(model->data(model->index(0, 0), TabsModel::Tab).value<QQuickItem*>(), tab);
     QVERIFY(!model->data(model->index(0, 0), TabsModel::Tab + 3).isValid());
 }
 void shouldNotifyWhenRemovingTab()
 {
     QSignalSpy spy(model, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
     for(int i = 0; i < 5; ++i) {
         model->add(createTab());
     }
     delete model->remove(3);
     QCOMPARE(spy.count(), 1);
     QList<QVariant> args = spy.takeFirst();
     QCOMPARE(args.at(1).toInt(), 3);
     QCOMPARE(args.at(2).toInt(), 3);
     for(int i = 3; i >= 0; --i) {
         delete model->remove(i);
         QCOMPARE(spy.count(), 1);
         args = spy.takeFirst();
         QCOMPARE(args.at(1).toInt(), i);
         QCOMPARE(args.at(2).toInt(), i);
     }
 }
Ejemplo n.º 23
0
w_Conf::w_Conf(QWidget *parent) :
    QWidget(parent)
{
    tabWidget = NULL;
    wAll = NULL;
    wRes = NULL;
    wOpp = NULL;
    wIns = NULL;
    wAcv = NULL;
    wDcv = NULL;
    wItt = NULL;

    createButton();
    createTab();

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(tabWidget);
    layout->addLayout(buttonLayout);

    this->setLayout(layout);
    layout->setContentsMargins(9,0,9,0);
}
Ejemplo n.º 24
0
void DGLTabbedView::ensureTabDisplayed(opaque_id_t ctxId, gl_t objName,
                                       gl_t target) {
    bool found = false;
    for (int i = 0; i < m_TabWidget.count(); i++) {
        DGLTabbedViewItem* itemWidget =
                dynamic_cast<DGLTabbedViewItem*>(m_TabWidget.widget(i));

        const dglnet::ContextObjectName& ctxObjName = itemWidget->getObjName();

        if (itemWidget && ctxObjName.m_Context == ctxId &&
            ctxObjName.m_Name == objName &&
            ctxObjName.m_Target == target) {
            found = true;
            m_TabWidget.setCurrentIndex(m_TabWidget.indexOf(itemWidget));
        }
    }
    if (!found) {
        m_TabWidget.addTab(
                createTab(dglnet::ContextObjectName(ctxId, objName, target)), QIcon(getTabIcon()),
                getTabName(objName, target));
        m_TabWidget.setCurrentIndex(m_TabWidget.count() - 1);
    }
    raise();
}
Ejemplo n.º 25
0
void KgGeneral::createViewerTab()
{
    QWidget *tab = createTab(i18n("Viewer/Editor"));
    QGridLayout *tabLayout = new QGridLayout(tab);
    tabLayout->setSpacing(6);
    tabLayout->setContentsMargins(11, 11, 11, 11);

    tabLayout->addWidget(createCheckBox("General", "View In Separate Window", _ViewInSeparateWindow,
                                   i18n("Internal editor and viewer opens each file in a separate window"), tab, false,
                                   i18n("If checked, each file will open in a separate window, otherwise, the viewer will work in a single, tabbed mode"), PAGE_VIEWER));

    // ------------------------- viewer ----------------------------------

    QGroupBox *viewerGrp = createFrame(i18n("Viewer"), tab);
    tabLayout->addWidget(viewerGrp, 1, 0);

    QGridLayout *viewerGrid = createGridLayout(viewerGrp);

    QWidget * hboxWidget2 = new QWidget(viewerGrp);
    QHBoxLayout * hbox2 = new QHBoxLayout(hboxWidget2);

    QWidget * vboxWidget = new QWidget(hboxWidget2);
    QVBoxLayout * vbox = new QVBoxLayout(vboxWidget);

    vbox->addWidget(new QLabel(i18n("Default viewer mode:"), vboxWidget));

    KONFIGURATOR_NAME_VALUE_TIP viewMode[] =
        //            name            value    tooltip
    {{ i18n("Generic mode"),  "generic", i18n("Use the system's default viewer") },
        { i18n("Text mode"), "text",  i18n("View the file in text-only mode") },
        { i18n("Hex mode"), "hex",  i18n("View the file in hex-mode (better for binary files)") },
        { i18n("Lister mode"), "lister",  i18n("View the file with lister (for huge text files)") }
    };

    vbox->addWidget(createRadioButtonGroup("General", "Default Viewer Mode",
                                           "generic", 0, 4, viewMode, 4, vboxWidget, false, PAGE_VIEWER));


    vbox->addWidget(
        createCheckBox("General", "UseOktetaViewer", _UseOktetaViewer, i18n("Use Okteta as Hex viewer"), vboxWidget, false,
                       i18n("If available, use Okteta as Hex viewer instead of the internal viewer"), PAGE_VIEWER)
                   );

    QWidget * hboxWidget4 = new QWidget(vboxWidget);
    QHBoxLayout * hbox4 = new QHBoxLayout(hboxWidget4);

    QLabel *label5 = new QLabel(i18n("Use lister if the text file is bigger than:"), hboxWidget4);
    hbox4->addWidget(label5);
    KonfiguratorSpinBox *spinBox = createSpinBox("General", "Lister Limit", _ListerLimit,
                                   0, 0x7FFFFFFF, hboxWidget4, false, PAGE_VIEWER);
    hbox4->addWidget(spinBox);
    QLabel *label6 = new QLabel(i18n("MB"), hboxWidget4);
    hbox4->addWidget(label6);

    vbox->addWidget(hboxWidget4);

    hbox2->addWidget(vboxWidget);

    viewerGrid->addWidget(hboxWidget2, 0, 0);


    // ------------------------- editor ----------------------------------

    QGroupBox *editorGrp = createFrame(i18n("Editor"), tab);
    tabLayout->addWidget(editorGrp, 2, 0);
    QGridLayout *editorGrid = createGridLayout(editorGrp);

    QLabel *label1 = new QLabel(i18n("Editor:"), editorGrp);
    editorGrid->addWidget(label1, 0, 0);
    KonfiguratorURLRequester *urlReq = createURLRequester("General", "Editor", "internal editor",
                                       editorGrp, false, PAGE_VIEWER, false);
    editorGrid->addWidget(urlReq, 0, 1);

    QLabel *label2 = new QLabel(i18n("Hint: use 'internal editor' if you want to use Krusader's fast built-in editor"), editorGrp);
    editorGrid->addWidget(label2, 1, 0, 1, 2);
}
Ejemplo n.º 26
0
void KgGeneral::createGeneralTab()
{
    QWidget *tab = createTab(i18n("General"));
    QGridLayout *kgGeneralLayout = new QGridLayout(tab);
    kgGeneralLayout->setSpacing(6);
    kgGeneralLayout->setContentsMargins(11, 11, 11, 11);


    //  -------------------------- GENERAL GROUPBOX ----------------------------------

    QGroupBox *generalGrp = createFrame(i18n("General"), tab);
    QGridLayout *generalGrid = createGridLayout(generalGrp);



    KONFIGURATOR_CHECKBOX_PARAM settings[] = { //   cfg_class  cfg_name                default             text                              restart tooltip
        {"Look&Feel", "Warn On Exit",         _WarnOnExit,        i18n("Warn on exit"),           false,  i18n("Display a warning when trying to close the main window.") },    // KDE4: move warn on exit to the other confirmations
        {"Look&Feel", "Minimize To Tray",     _MinimizeToTray,    i18n("Minimize to tray"),       false,  i18n("The icon will appear in the system tray instead of the taskbar, when Krusader is minimized.") },
    };
    KonfiguratorCheckBoxGroup *cbs = createCheckBoxGroup(2, 0, settings, 2 /*count*/, generalGrp, PAGE_GENERAL);
    generalGrid->addWidget(cbs, 0, 0);

    // temp dir

    QHBoxLayout *hbox = new QHBoxLayout();

    hbox->addWidget(new QLabel(i18n("Temp Folder:"), generalGrp));
    KonfiguratorURLRequester *urlReq3 = createURLRequester("General", "Temp Directory", _TempDirectory,
                                        generalGrp, false, PAGE_GENERAL);
    urlReq3->setMode(KFile::Directory);
    connect(urlReq3->extension(), SIGNAL(applyManually(QObject *, QString, QString)),
            this, SLOT(applyTempDir(QObject *, QString, QString)));
    hbox->addWidget(urlReq3);
    generalGrid->addLayout(hbox, 13, 0, 1, 1);

    QLabel *label4 = new QLabel(i18n("Note: you must have full permissions for the temporary folder."),
                                generalGrp);
    generalGrid->addWidget(label4, 14, 0, 1, 1);


    kgGeneralLayout->addWidget(generalGrp, 0 , 0);


    // ----------------------- delete mode --------------------------------------

    QGroupBox *delGrp = createFrame(i18n("Delete mode"), tab);
    QGridLayout *delGrid = createGridLayout(delGrp);

    KONFIGURATOR_NAME_VALUE_TIP deleteMode[] =
        //            name            value    tooltip
        {{i18n("Move to trash"), "true", i18n("Files will be moved to trash when deleted.")},
         {i18n("Delete files"), "false", i18n("Files will be permanently deleted.")}
        };
    KonfiguratorRadioButtons *trashRadio = createRadioButtonGroup("General", "Move To Trash",
                                           _MoveToTrash ? "true" : "false", 2, 0, deleteMode, 2, delGrp, false, PAGE_GENERAL);
    delGrid->addWidget(trashRadio);

    kgGeneralLayout->addWidget(delGrp, 1 , 0);


    // ----------------------- terminal -----------------------------------------

    QGroupBox *terminalGrp = createFrame(i18n("Terminal"), tab);
    QGridLayout *terminalGrid = createGridLayout(terminalGrp);

    QLabel *label3 = new QLabel(i18n("Terminal:"), generalGrp);
    terminalGrid->addWidget(label3, 0, 0);
    KonfiguratorURLRequester *urlReq2 = createURLRequester("General", "Terminal", _Terminal,
                                        generalGrp, false, PAGE_GENERAL, false);
    terminalGrid->addWidget(urlReq2, 0, 1);
    QLabel *terminalLabel = new QLabel(i18n("%d will be replaced by the workdir."),
                                       terminalGrp);
    terminalGrid->addWidget(terminalLabel, 1, 1);

    KONFIGURATOR_CHECKBOX_PARAM terminal_settings[] = { //   cfg_class  cfg_name     default        text            restart tooltip
        {"General", "Send CDs", _SendCDs, i18n("Terminal Emulator sends Chdir on panel change"), false, i18n("When checked, whenever the panel is changed (for example, by pressing Tab), Krusader changes the current folder in the terminal emulator.") },
        {"Look&Feel", "Fullscreen Terminal Emulator", false, i18n("Fullscreen terminal (mc-style)"), false,  i18n("Terminal is shown instead of the Krusader window (full screen).") },
    };
    cbs = createCheckBoxGroup(1, 0, terminal_settings, 2 /*count*/, terminalGrp, PAGE_GENERAL);
    terminalGrid->addWidget(cbs, 2, 0, 1, 2);


    kgGeneralLayout->addWidget(terminalGrp, 2 , 0);
}
Ejemplo n.º 27
0
ladspaBrowserView::ladspaBrowserView( ToolPlugin * _tool ) :
	ToolPluginView( _tool  )
{
	QHBoxLayout * hlayout = new QHBoxLayout( this );
	hlayout->setSpacing( 0 );
	hlayout->setMargin( 0 );

	m_tabBar = new TabBar( this, QBoxLayout::TopToBottom );
	m_tabBar->setExclusive( true );
	m_tabBar->setFixedWidth( 72 );

	QWidget * ws = new QWidget( this );
	ws->setFixedSize( 500, 480 );

	QWidget * available = createTab( ws, tr( "Available Effects" ), VALID );
	QWidget * unavailable = createTab( ws, tr( "Unavailable Effects" ),
								INVALID );
	QWidget * instruments = createTab( ws, tr( "Instruments" ), SOURCE );
	QWidget * analysis = createTab( ws, tr( "Analysis Tools" ), SINK );
	QWidget * other = createTab( ws, tr( "Don't know" ), OTHER );


	m_tabBar->addTab( available, tr( "Available Effects" ), 
				0, false, true 
			)->setIcon( embed::getIconPixmap( "setup_audio" ) );
	m_tabBar->addTab( unavailable, tr( "Unavailable Effects" ), 
				1, false, true 
			)->setIcon( embed::getIconPixmap(
						"unavailable_sound" ) );
	m_tabBar->addTab( instruments, tr( "Instruments" ), 
				2, false, true 
			)->setIcon( embed::getIconPixmap(
							"setup_midi" ) );
	m_tabBar->addTab( analysis, tr( "Analysis Tools" ), 
				3, false, true
			)->setIcon( embed::getIconPixmap( "analysis" ) );
	m_tabBar->addTab( other, tr( "Don't know" ), 
				4, true, true
			)->setIcon( embed::getIconPixmap( "uhoh" ) );


	m_tabBar->setActiveTab( 0 );

	hlayout->addWidget( m_tabBar );
	hlayout->addSpacing( 10 );
	hlayout->addWidget( ws );
	hlayout->addSpacing( 10 );
	hlayout->addStretch();

	hide();
	if( parentWidget() )
	{
		parentWidget()->hide();
		parentWidget()->layout()->setSizeConstraint(
							QLayout::SetFixedSize );
		
		Qt::WindowFlags flags = parentWidget()->windowFlags();
		flags |= Qt::MSWindowsFixedSizeDialogHint;
		flags &= ~Qt::WindowMaximizeButtonHint;
		parentWidget()->setWindowFlags( flags );
	}
}
Ejemplo n.º 28
0
Widget* TabWidget::createTab(const std::string &label) {
    return createTab(tabCount(), label);
}
Ejemplo n.º 29
0
ladspaBrowserView::ladspaBrowserView( ToolPlugin * _tool ) :
	ToolPluginView( _tool  )
{
	QHBoxLayout * hlayout = new QHBoxLayout( this );
	hlayout->setSpacing( 0 );
	hlayout->setMargin( 0 );

	m_tabBar = new TabBar( this, QBoxLayout::TopToBottom );
	m_tabBar->setExclusive( true );
	m_tabBar->setFixedWidth( 72 );

	QWidget * ws = new QWidget( this );
	ws->setFixedSize( 500, 480 );

	QWidget * available = createTab( ws, tr( "Available Effects" ), VALID );
	QWidget * unavailable = createTab( ws, tr( "Unavailable Effects" ),
								INVALID );
	QWidget * instruments = createTab( ws, tr( "Instruments" ), SOURCE );
	QWidget * analysis = createTab( ws, tr( "Analysis Tools" ), SINK );
	QWidget * other = createTab( ws, tr( "Don't know" ), OTHER );


	m_tabBar->addTab( available, tr( "Available Effects" ), 
				0, false, true 
			)->setIcon( embed::getIconPixmap( "setup_audio" ) );
	m_tabBar->addTab( unavailable, tr( "Unavailable Effects" ), 
				1, false, true 
			)->setIcon( embed::getIconPixmap(
						"unavailable_sound" ) );
	m_tabBar->addTab( instruments, tr( "Instruments" ), 
				2, false, true 
			)->setIcon( embed::getIconPixmap(
							"setup_midi" ) );
	m_tabBar->addTab( analysis, tr( "Analysis Tools" ), 
				3, false, true
			)->setIcon( embed::getIconPixmap( "analysis" ) );
	m_tabBar->addTab( other, tr( "Don't know" ), 
				4, true, true
			)->setIcon( embed::getIconPixmap( "uhoh" ) );


	m_tabBar->setActiveTab( 0 );

	hlayout->addWidget( m_tabBar );
	hlayout->addSpacing( 10 );
	hlayout->addWidget( ws );
	hlayout->addSpacing( 10 );
	hlayout->addStretch();

	setWhatsThis( tr(
"This dialog displays information on all of the LADSPA plugins LMMS was "
"able to locate. The plugins are divided into five categories based "
"upon an interpretation of the port types and names.\n\n"

"Available Effects are those that can be used by LMMS. In order for LMMS "
"to be able to use an effect, it must, first and foremost, be an effect, "
"which is to say, it has to have both input channels and output channels. "
"LMMS identifies an input channel as an audio rate port containing 'in' in "
"the name. Output channels are identified by the letters 'out'. Furthermore, "
"the effect must have the same number of inputs and outputs and be real time "
"capable.\n\n"

"Unavailable Effects are those that were identified as effects, but either "
"didn't have the same number of input and output channels or weren't real "
"time capable.\n\n"

"Instruments are plugins for which only output channels were identified.\n\n"

"Analysis Tools are plugins for which only input channels were identified.\n\n"

"Don't Knows are plugins for which no input or output channels were "
"identified.\n\n"

"Double clicking any of the plugins will bring up information on the "
"ports." ) );

	hide();
	if( parentWidget() )
	{
		parentWidget()->hide();
		parentWidget()->layout()->setSizeConstraint(
							QLayout::SetFixedSize );
		
		Qt::WindowFlags flags = parentWidget()->windowFlags();
		flags |= Qt::MSWindowsFixedSizeDialogHint;
		flags &= ~Qt::WindowMaximizeButtonHint;
		parentWidget()->setWindowFlags( flags );
	}
}
 void shouldReturnIndexWhenAddingTab()
 {
     for(int i = 0; i < 3; ++i) {
         QCOMPARE(model->add(createTab()), i);
     }
 }