Added code to populate history tree view in Qt TAS Editor.
This commit is contained in:
parent
a20b7c0749
commit
8b4caef750
|
@ -1036,6 +1036,7 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
QVBoxLayout *vbox;
|
||||
QHBoxLayout *hbox;
|
||||
QGridLayout *grid;
|
||||
QTreeWidgetItem *item;
|
||||
|
||||
ctlPanelMainVbox = new QVBoxLayout();
|
||||
|
||||
|
@ -1082,6 +1083,15 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
bkbrTree = new QTreeWidget();
|
||||
histTree = new QTreeWidget();
|
||||
|
||||
histTree->setColumnCount(1);
|
||||
histTree->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
histTree->setAlternatingRowColors(true);
|
||||
|
||||
item = new QTreeWidgetItem();
|
||||
item->setText(0, QString::fromStdString("Time / Description"));
|
||||
|
||||
histTree->setHeaderItem(item);
|
||||
|
||||
prevMkrBtn = new QPushButton();
|
||||
nextMkrBtn = new QPushButton();
|
||||
similarBtn = new QPushButton( tr("Similar") );
|
||||
|
@ -1197,6 +1207,9 @@ void TasEditorWindow::buildSideControlPanel(void)
|
|||
|
||||
shortcut = new QShortcut( QKeySequence("Ctrl+Down"), this);
|
||||
connect( shortcut, SIGNAL(activated(void)), this, SLOT(scrollSelectionDnOne(void)) );
|
||||
|
||||
connect( histTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(histTreeItemActivated(QTreeWidgetItem*,int) ) );
|
||||
connect( histTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(histTreeItemActivated(QTreeWidgetItem*,int) ) );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TasEditorWindow::updateCheckedItems(void)
|
||||
|
@ -1244,6 +1257,50 @@ void TasEditorWindow::updateCheckedItems(void)
|
|||
showToolTipsAct->setChecked( taseditorConfig.tooltipsEnabled );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TasEditorWindow::updateHistoryItems(void)
|
||||
{
|
||||
int i;
|
||||
QTreeWidgetItem *item;
|
||||
const char *txt;
|
||||
|
||||
for (i=0; i<history.getNumItems(); i++)
|
||||
{
|
||||
txt = history.getItemDesc(i);
|
||||
|
||||
item = histTree->topLevelItem(i);
|
||||
|
||||
if (item == NULL)
|
||||
{
|
||||
item = new QTreeWidgetItem();
|
||||
|
||||
histTree->addTopLevelItem(item);
|
||||
|
||||
histTree->setCurrentItem(item);
|
||||
}
|
||||
|
||||
if ( txt )
|
||||
{
|
||||
if ( item->text(0).compare( tr(txt) ) != 0 )
|
||||
{
|
||||
item->setText(0, tr(txt));
|
||||
|
||||
histTree->setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ( (histTree->topLevelItemCount() > 0) && (history.getNumItems() < histTree->topLevelItemCount()) )
|
||||
{
|
||||
item = histTree->takeTopLevelItem( histTree->topLevelItemCount()-1 );
|
||||
|
||||
if ( item )
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
histTree->viewport()->update();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
int TasEditorWindow::initModules(void)
|
||||
{
|
||||
// init modules
|
||||
|
@ -1910,6 +1967,17 @@ void TasEditorWindow::scrollSelectionDnOne(void)
|
|||
fceuWrapperUnLock();
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
void TasEditorWindow::histTreeItemActivated(QTreeWidgetItem *item, int col)
|
||||
{
|
||||
int row = histTree->indexOfTopLevelItem(item);
|
||||
|
||||
if ( row < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
history.handleSingleClick(row);
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
void TasEditorWindow::loadClipboard(const char *txt)
|
||||
{
|
||||
clipboard->setText( tr(txt), QClipboard::Clipboard );
|
||||
|
|
|
@ -273,6 +273,7 @@ class TasEditorWindow : public QDialog
|
|||
void closeWindow(void);
|
||||
void frameUpdate(void);
|
||||
void updateCheckedItems(void);
|
||||
void updateHistoryItems(void);
|
||||
private slots:
|
||||
void openProject(void);
|
||||
void saveProjectCb(void);
|
||||
|
@ -308,11 +309,13 @@ class TasEditorWindow : public QDialog
|
|||
void editInsertCB(void);
|
||||
void editInsertNumFramesCB(void);
|
||||
void editTruncateMovieCB(void);
|
||||
void histTreeItemActivated(QTreeWidgetItem*,int);
|
||||
|
||||
friend class RECORDER;
|
||||
friend class SPLICER;
|
||||
friend class SELECTION;
|
||||
friend class PLAYBACK;
|
||||
friend class HISTORY;
|
||||
};
|
||||
|
||||
extern TASEDITOR_PROJECT *project;
|
||||
|
|
|
@ -1192,15 +1192,17 @@ void HISTORY::handleSingleClick(int row_index)
|
|||
void HISTORY::updateList()
|
||||
{
|
||||
//update the number of items in the history list
|
||||
//int currLVItemCount = ListView_GetItemCount(hwndHistoryList);
|
||||
//if (currLVItemCount != historyTotalItems)
|
||||
//{
|
||||
// ListView_SetItemCountEx(hwndHistoryList, historyTotalItems, LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL);
|
||||
//}
|
||||
int currLVItemCount = tasWin->histTree->topLevelItemCount();
|
||||
|
||||
if (currLVItemCount != historyTotalItems)
|
||||
{
|
||||
tasWin->updateHistoryItems();
|
||||
}
|
||||
}
|
||||
|
||||
void HISTORY::redrawList()
|
||||
{
|
||||
tasWin->updateHistoryItems();
|
||||
//ListView_SetItemState(hwndHistoryList, historyCursorPos, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
|
||||
//ListView_EnsureVisible(hwndHistoryList, historyCursorPos, FALSE);
|
||||
//InvalidateRect(hwndHistoryList, 0, FALSE);
|
||||
|
|
|
@ -137,6 +137,8 @@ public:
|
|||
|
||||
bool isCursorOverHistoryList();
|
||||
|
||||
int getNumItems(void){ return historyTotalItems; };
|
||||
|
||||
//HWND hwndHistoryList;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue