Skip to content

Commit 1e38ffd

Browse files
committed
List entries works now;
Had to update QModelIndex calls. Also adding README template;
1 parent 671faef commit 1e38ffd

File tree

6 files changed

+72
-10
lines changed

6 files changed

+72
-10
lines changed

MPSCommon.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ static const size_t KLastSubtokenPosition = static_cast <size_t> (-1);
3333
#define Stringize( L ) #L
3434
#define MakeString( M, L ) M(L)
3535
#define $Line MakeString( Stringize, __LINE__ )
36-
#define Reminder __FILE__ "(" $Line ") : Reminder: "
36+
#define FixReminder __FILE__ "(" $Line ") : FixReminder: "
3737

3838
#endif // MPSCOMMON_HPP

MPSEngine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ void MPSEngine::select_master_token (const std::wstring& file_name)
127127

128128
void MPSEngine::select_subtoken (MPSToken* token, bool updateOutput)
129129
{
130-
m_selected_subtoken = token;
131130
if (!token)
132131
return;
132+
133+
m_selected_subtoken = token;
133134

134135
if (updateOutput) {
135136
// reconstruct the output

MPSMainWindow.cpp

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#include <QtWidgets/QMessageBox>
1515
#include <QtWidgets/QScrollBar>
1616
#include <QtGui/QPainter>
17-
//#include <QMediaPlayer>
17+
18+
19+
#include <QVector>
1820
//#include <QUrl>
1921

22+
2023
// confirmation dialog messages
2124
const QString KDiscardAllMessage = "You are going to lose all your changes.\nAre you sure?";
2225
const QString KRenameAllMessage = "You are going to physically rename all modified files.\nDo you really want to proceed?";
@@ -427,7 +430,7 @@ void MPSMainWindow::create_view_models ()
427430
m_files_model->setNameFilterDisables(false);
428431

429432
m_gui_obj.lstFiles->setModel(m_files_model);
430-
m_gui_obj.lstFiles->setEditTriggers(QAbstractItemView::NoEditTriggers);
433+
m_gui_obj.lstFiles->setEditTriggers(QAbstractItemView::NoEditTriggers);
431434
}
432435

433436
QString MPSMainWindow::get_drive_label(const QString& drive)
@@ -1817,12 +1820,33 @@ void MPSMainWindow::on_btnClearConsole_clicked()
18171820
void MPSMainWindow::on_btnListRenames_clicked()
18181821
{
18191822
bool map_has_entries = false;
1820-
QModelIndex modelIndex = m_files_model->index(m_files_model->rootPath());
1823+
1824+
QString rootPath = m_files_model->rootPath();
1825+
QModelIndex modelIndex = m_files_model->index(rootPath);
1826+
int colCount = m_files_model->columnCount(modelIndex);
1827+
int rowCount = m_files_model->rowCount(modelIndex);
1828+
QString fileName; // child fileName
1829+
1830+
/*
1831+
QVector<QString> vec;
1832+
for (int row = 0; row < rowCount; ++row)
1833+
{
1834+
// coloana 0 are informatia necesara
1835+
QModelIndex child = m_files_model->index(row, 0, modelIndex);
1836+
fileName = m_files_model->fileName(child);
1837+
vec.append(fileName);
1838+
}
1839+
*/
1840+
1841+
// the file name we're looking for is on col 0/4 (file size is also there on one of the columns)
1842+
int col = 0;
1843+
modelIndex = m_files_model->index(m_files_model->rootPath());
18211844
for (int idx = 0; idx < m_files_model->rowCount(modelIndex); ++idx) {
1822-
QModelIndex child = m_files_model->index(idx, modelIndex.column());
1845+
// must pass a parent to the index call
1846+
QModelIndex child = m_files_model->index(idx, col, modelIndex);
18231847

18241848
// get the file name
1825-
QString fileName = m_files_model->fileName(child);
1849+
fileName = m_files_model->fileName(child);
18261850

18271851
// check the entry in engine's map
18281852
std::wstring rename_to;

MPSTransformsContainer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,15 @@ std::wstring MPSTransformsContainer::get_transform_description_at (int idx) cons
107107

108108
MPSTransformInfo MPSTransformsContainer::get_transform_information_at (int idx) const
109109
{
110+
110111
MPSTransformInfo info;
111112

113+
if (idx < 0 || idx >= static_cast<int> (m_avail_act_info.size()))
114+
{
115+
#pragma message (FixReminder "On invalid index, maybe should return some default dummy MPSTransformInfo")
116+
return info;
117+
}
118+
112119
MPSTransform* trans = m_transforms.at (idx);
113120
if (!trans || !trans->condition() || !trans->action())
114121
return info;

MemphisNow.vcxproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup />
44
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
5-
<QtLastBackgroundBuild>2022-07-28T11:16:51.6805511Z</QtLastBackgroundBuild>
5+
<QtLastBackgroundBuild>2022-07-28T12:43:27.1735723Z</QtLastBackgroundBuild>
66
</PropertyGroup>
77
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8-
<QtLastBackgroundBuild>2022-07-28T11:16:51.7314427Z</QtLastBackgroundBuild>
8+
<QtLastBackgroundBuild>2022-07-28T12:43:27.2836889Z</QtLastBackgroundBuild>
99
</PropertyGroup>
1010
</Project>

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# MemphisNow
1+
# README #
2+
3+
This README would normally document whatever steps are necessary to get your application up and running.
4+
5+
### What is this repository for? ###
6+
7+
* Quick summary
8+
* Version
9+
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10+
11+
### How do I get set up? ###
12+
13+
* Summary of set up
14+
* Configuration
15+
* Dependencies
16+
Qt-6.3.1
17+
boost_1_79_0
18+
* Database configuration
19+
* How to run tests
20+
* Deployment instructions
21+
22+
### Contribution guidelines ###
23+
24+
* Writing tests
25+
* Code review
26+
* Other guidelines
27+
28+
### Who do I talk to? ###
29+
30+
* Repo owner or admin
31+
* Other community or team contact

0 commit comments

Comments
 (0)