frmMainChart_State::frmMainChart_State(int portfolioID_, const QMap<int, portfolio> &portfolios_, const QHash<QString, historicalPrices> &prices_, QWidget *parent_): frmMainStateToolbar(portfolios_.value(portfolioID_), parent_), frmMainStateTree(portfolios_, prices_), ui(new frmMainChart_UI()), m_counter(0) { ui->setupUI(static_cast<QWidget*>(this->parent())); foreach(const portfolio &p, m_portfolios) ui->treeCmb->addItem(p.displayText(), p.id()); ui->treeCmb->setCurrentIndex(ui->treeCmb->findData(m_portfolio.id())); populateTree(portfolioID_); int beginDate = m_portfolio.startDate(); int endDate = m_portfolio.endDate(); ui->toolbarDateBeginEdit->setDate(QDate::fromJulianDay(beginDate)); ui->toolbarDateEndEdit->setDate(QDate::fromJulianDay(endDate)); connect(ui->toolbarDateBeginEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab())); connect(ui->toolbarDateEndEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab())); connect(ui->toolbarExport, SIGNAL(triggered()), ui->chart, SLOT(exportChart())); connect(ui->tree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChecked(QTreeWidgetItem*,int))); connect(ui->treeCmb, SIGNAL(currentIndexChanged(int)), SLOT(portfolioChange(int))); connect(ui->treeAllPortfolios, SIGNAL(clicked()), this, SLOT(addAllPortfolios())); connect(ui->treeClearBtn, SIGNAL(clicked()), this, SLOT(clearTree())); connect(ui->toolbar3M, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar6M, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbarYTD, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar1Y, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar5Y, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbarMax, SIGNAL(triggered()), this, SLOT(dateClicked())); refreshTab(); }
void frmMainStateTable::setupUI(bool hasRowLabels_) { ui = createUI(); ui->setupUI(tableColumns(), hasRowLabels_, static_cast<QWidget*>(this->parent())); ui->toolbarDateBeginEdit->setDate(QDate::fromJulianDay(m_portfolio.startDate())); ui->toolbarDateEndEdit->setDate(QDate::fromJulianDay(m_portfolio.endDate())); setSortDropDown(); connect(ui->toolbarDateBeginEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab())); connect(ui->toolbarDateEndEdit, SIGNAL(dateChanged(QDate)), this, SLOT(refreshTab())); connect(ui->toolbarSortCmb, SIGNAL(activated(int)), this, SLOT(sortIndexChanged(int))); connect(ui->toolbarReorder, SIGNAL(triggered()), this, SLOT(modifyColumns())); connect(ui->toolbarExport, SIGNAL(triggered()), ui->table, SLOT(exportTable())); connect(ui->tableCopy, SIGNAL(activated()), ui->table, SLOT(copyTable())); connect(ui->toolbar1D, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar3M, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar6M, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbarYTD, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar1Y, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbar5Y, SIGNAL(triggered()), this, SLOT(dateClicked())); connect(ui->toolbarMax, SIGNAL(triggered()), this, SLOT(dateClicked())); refreshTab(); connect(ui->table,SIGNAL(doubleClicked(const QModelIndex &)),this,SLOT(cellSelected(const QModelIndex &))); }
VariableEditor::VariableEditor(QWidget *parent) : QDialog(parent), ui(new Ui::VariableEditor) { ui->setupUi(this); refreshTab(); connect(ui->newVariableBtn, SIGNAL(clicked()), this, SLOT(newVariableSlot())); }
void PackerJob::updateStats() { DWORD dwNewTick = GetTickCount(); if (m_uiReaded && (time(0) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) { m_lastUpdateTick = dwNewTick; double speed = ((double)m_uiReaded / 1024) / (time(0) - m_startTS); mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed); double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0; mir_snwprintf(m_tab->m_stzComplet, TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)m_uiReaded / 1024, (int)m_uiFileSize / 1024); wchar_t buff[256]; long s = (m_uiFileSize - m_uiReaded) / (long)(speed * 1024); int d = (s / 60 / 60 / 24); int h = (s - d * 60 * 60 * 24) / 60 / 60; int m = (s - d * 60 * 60 * 24 - h * 60 * 60) / 60; s = s - (d * 24 * 60 * 60) - (h * 60 * 60) - (m * 60); if (d > 0) mir_snwprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s); else mir_snwprintf(buff, L"%02d:%02d:%02d", h, m, s); mir_snwprintf(m_tab->m_stzRemain, TranslateT("%s (%d kB/%d kB)"), buff, (m_uiFileSize - m_uiReaded) / 1024, m_uiFileSize / 1024); refreshTab(false); } }
frmMainStatistic_State::frmMainStatistic_State(int portfolioID_, const QMap<int, portfolio> &portfolios_, const settings &settings_, const QHash<QString, historicalPrices> &prices_, QWidget *parent_): frmMainStateTableWithTree(portfolioID_, portfolios_, settings_, prices_, parent_) { setupUI(true); ui->toolbarReorder->setText("Add/Remove Statistics..."); ui->toolbarReorder->setIconText("Add/Remove Statistics..."); connect(treeWidget(), SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChecked(QTreeWidgetItem*,int))); refreshTab(); }
void frmMainChart_State::clearTree() { treeWidget()->blockSignals(true); for(int i = 0; i < treeWidget()->topLevelItemCount(); ++i) { QTreeWidgetItem *item = treeWidget()->topLevelItem(i); for(int x = 0; x < item->childCount(); ++x) if (item->child(x)->checkState(0) == Qt::Checked) item->child(x)->setCheckState(0, Qt::Unchecked); } m_selectedItems.clear(); treeWidget()->blockSignals(false); refreshTab(); }
/** * Create a query tab and connect it. * * @return a new QueryEditorWidget */ QueryEditorWidget* MainWindow::newQuery() { QueryEditorWidget *w = new QueryEditorWidget(); tabWidget->addTab(w, w->icon(), w->title()); tabWidget->setCurrentIndex(tabWidget->count() - 1); connect(w, SIGNAL(actionAvailable(AbstractTabWidget::Actions)), this, SLOT(refreshTab())); connect(w, SIGNAL(fileChanged(QString)), this, SLOT(addRecentFile(QString))); connect(w, SIGNAL(modificationChanged(bool)), this, SLOT(refreshTab())); connect(w, SIGNAL(tableRequested(QSqlDatabase*,QString)), this, SLOT(openTable(QSqlDatabase*,QString))); return w; }