Exemple #1
0
MainWindow::MainWindow(quint32 id, QWidget *parent) :
    QMainWindow(parent)
{
    m_id = id;
    m_hometab = NULL;

    setWindowTitle(titleString);
    setMinimumSize(600, 500);
    setWindowIcon(QIcon(":/icons/icon.png"));
    setAttribute(Qt::WA_DeleteOnClose);
    loadWindowParams();

    QApplication::setFont(Utils::getFontFromString(sConfig.get(CFG_STRING_APP_FONT)));

    setStatusBar(new QStatusBar(this));

    m_tabView = new TabView(this);
    connect(m_tabView, SIGNAL(statusBarMsg(QString,int)), statusBar(), SLOT(showMessage(QString,int)));
    connect(m_tabView, SIGNAL(closeWindow()),                          SLOT(close()));
    connect(m_tabView, SIGNAL(openHomeTab()),                          SLOT(openHomeTab()));
    connect(m_tabView, SIGNAL(closeHomeTab()),                         SLOT(closeHomeTab()));
    connect(m_tabView, SIGNAL(changeWindowTitle(QString)),             SLOT(changeWindowTitle(QString)));

    setCentralWidget(m_tabView);
    openHomeTab();
}
void TitleSetter::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
    QItemSelectionRange changedArea(topLeft, bottomRight);
    QModelIndex currentTopicIndex = selectionModel()->currentIndex().sibling(selectionModel()->currentIndex().row(), 0);
    if (changedArea.contains(currentTopicIndex))
        changeWindowTitle(currentTopicIndex);
};
Exemple #3
0
MainWindow::MainWindow()
{
	XmlParser xf;
	xf.open(config_file_path);
	xf.loadXmlData();
	enableSysTray = xf.getCheckbox(QString::fromStdString("notification"));

    real_close = false;
    w = new CentralWidget();
    connect(w,SIGNAL(change_ctd_d(const ctd_d*)),this,SLOT(changeTrayTime(const ctd_d*)));
	connect(w,SIGNAL(change_pause_f(QString)),this,SLOT(changeWindowTitle(QString)));

    sysTrayIcon = new QSystemTrayIcon(QIcon(":/photos/resource/p_icon.png"));
    sysTrayIcon->setVisible(true);//show!!
    if(enableSysTray) sysTrayIcon->showMessage(tr("gat2"),tr("Welcome to gat2!"),QSystemTrayIcon::Information,1500);
    connect(w,SIGNAL(finishCountDown()),this,SLOT(userCall()));


    config_editor = new PreferenceDialog();
	connect(config_editor,SIGNAL(chNotificationCheckBox(bool)),this,SLOT(changeNotificationCheckBox(bool)));
    about_widget = new gat_about_widget();

    a_about = new QAction(tr("&About"),this);
    a_about->setIcon(QIcon(":/photos/resource/p_icon_mini2.png"));
    connect(a_about,SIGNAL(triggered()),this,SLOT(about()));

    a_config = new QAction(tr("&Preferences"),this);
    connect(a_config,SIGNAL(triggered()),this,SLOT(callConfigDialog()));

    a_close = new QAction(tr("&Close"),this);
    connect(a_close,SIGNAL(triggered()),this,SLOT(closeApplication()));

    vSwitch = new QAction(tr("gat2"),this);
    connect(vSwitch,SIGNAL(triggered()),this,SLOT(changeVisible()));

    showTime = new QAction(tr("-----"),this);
    connect(showTime,SIGNAL(triggered()),this,SLOT(timeMessage()));


    help_bar = menuBar()->addMenu(tr("&gat2"));
    help_bar->addAction(a_about);
	help_bar->addAction(a_close);
    config_app = menuBar()->addMenu(tr("&Options"));
    config_app->addAction(a_config);
    sTaryIcon_Menu = new QMenu(tr("ContextMenu"));
    sTaryIcon_Menu->addAction(showTime);
    sTaryIcon_Menu->addSeparator();
    sTaryIcon_Menu->addAction(vSwitch);
    sTaryIcon_Menu->addAction(a_close);
    sysTrayIcon->setContextMenu(sTaryIcon_Menu);

    connect(this,SIGNAL(close_mainwid()),w,SLOT(delete_phonon_object()));

    setCentralWidget(w);
    setWindowTitle(tr("Gat2"));
    setWindowIcon(QIcon(":/photos/resource/p_icon.png"));
};
Exemple #4
0
void TabWidget::setTabNameAndTooltip(int idx, QString name)
{
    setTabToolTip(idx, name);

    if(idx == currentIndex())
        emit changeWindowTitle(name);

    if(name.size() > 25)
    {
        name.resize(28);
        name.replace(25, 3, "...");
    }

    setTabText(idx, name);
}
Exemple #5
0
void TabWidget::currentIndexChanged(int idx)
{
    changeMenu(idx);

    if(idx == -1)
        return;

    emit changeWindowTitle(tabToolTip(idx));

    if((size_t)idx < m_tab_ids.size())
    {
        m_tabHistory.removeOne(m_tab_ids[idx]);
        m_tabHistory.push_back(m_tab_ids[idx]);
    }
}
void TitleSetter::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
    Q_UNUSED(previous);
    changeWindowTitle(current.sibling(current.row(), 0));
}