mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-03 01:19:25 +02:00
Added bool itemHasCodes(int itemnumber,QStringList test_codes)
Cleaned up formatting
This commit is contained in:
parent
39801d7be6
commit
da33dae6c1
@ -18,7 +18,8 @@
|
|||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <schedcartlist.h>
|
#include <stdio.h>
|
||||||
|
#include "schedcartlist.h"
|
||||||
|
|
||||||
SchedCartList::SchedCartList(int listsize)
|
SchedCartList::SchedCartList(int listsize)
|
||||||
{
|
{
|
||||||
@ -39,15 +40,15 @@ SchedCartList::~SchedCartList()
|
|||||||
delete []sched_codes;
|
delete []sched_codes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// stack_schedcodes should no longer be needed. Possibly remove at a later date. P. Linstruth 01/12/2019
|
|
||||||
//
|
|
||||||
void SchedCartList::insertItem(unsigned cartnumber,int cartlength,int stack_id,QString stack_artist,QString stack_schedcodes)
|
void SchedCartList::insertItem(unsigned cartnumber,int cartlength,int stack_id,QString stack_artist,QString stack_schedcodes)
|
||||||
{
|
{
|
||||||
cartnum[itemcounter]=cartnumber;
|
cartnum[itemcounter]=cartnumber;
|
||||||
cartlen[itemcounter]=cartlength;
|
cartlen[itemcounter]=cartlength;
|
||||||
stackid[itemcounter]=stack_id;
|
stackid[itemcounter]=stack_id;
|
||||||
artist[itemcounter]=stack_artist.lower().replace(" ","");
|
artist[itemcounter]=stack_artist.lower().replace(" ","");
|
||||||
|
if(stack_schedcodes=="") {
|
||||||
|
stack_schedcodes=".";
|
||||||
|
}
|
||||||
sched_codes[itemcounter]=stack_schedcodes;
|
sched_codes[itemcounter]=stack_schedcodes;
|
||||||
itemcounter++;
|
itemcounter++;
|
||||||
}
|
}
|
||||||
@ -55,8 +56,7 @@ void SchedCartList::insertItem(unsigned cartnumber,int cartlength,int stack_id,Q
|
|||||||
|
|
||||||
void SchedCartList::removeItem(int itemnumber)
|
void SchedCartList::removeItem(int itemnumber)
|
||||||
{
|
{
|
||||||
for(int i=itemnumber;i<(itemcounter-1);i++)
|
for(int i=itemnumber;i<(itemcounter-1);i++) {
|
||||||
{
|
|
||||||
cartnum[i]=cartnum[i+1];
|
cartnum[i]=cartnum[i+1];
|
||||||
cartlen[i]=cartlen[i+1];
|
cartlen[i]=cartlen[i+1];
|
||||||
stackid[i]=stackid[i+1];
|
stackid[i]=stackid[i+1];
|
||||||
@ -72,10 +72,8 @@ bool SchedCartList::removeIfCode(int itemnumber,QString test_code)
|
|||||||
test+=" ";
|
test+=" ";
|
||||||
test=test.left(11);
|
test=test.left(11);
|
||||||
|
|
||||||
if (sched_codes[itemnumber].find(test)!=-1)
|
if (sched_codes[itemnumber].find(test)!=-1) {
|
||||||
{
|
for(int i=itemnumber;i<(itemcounter-1);i++) {
|
||||||
for(int i=itemnumber;i<(itemcounter-1);i++)
|
|
||||||
{
|
|
||||||
cartnum[i]=cartnum[i+1];
|
cartnum[i]=cartnum[i+1];
|
||||||
cartlen[i]=cartlen[i+1];
|
cartlen[i]=cartlen[i+1];
|
||||||
stackid[i]=stackid[i+1];
|
stackid[i]=stackid[i+1];
|
||||||
@ -94,13 +92,29 @@ bool SchedCartList::itemHasCode(int itemnumber,QString test_code)
|
|||||||
test+=" ";
|
test+=" ";
|
||||||
test=test.left(11);
|
test=test.left(11);
|
||||||
|
|
||||||
if (sched_codes[itemnumber].find(test)!=-1)
|
if (sched_codes[itemnumber].find(test)!=-1) {
|
||||||
return true;
|
return true;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SchedCartList::itemHasCodes(int itemnumber,QStringList test_codes)
|
||||||
|
{
|
||||||
|
for (int i=0;i<test_codes.size();i++) {
|
||||||
|
QString test=test_codes.at(i);
|
||||||
|
test+=" ";
|
||||||
|
test=test.left(11);
|
||||||
|
|
||||||
|
if (sched_codes[itemnumber].find(test)!=-1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SchedCartList::save(void)
|
void SchedCartList::save(void)
|
||||||
{
|
{
|
||||||
savecartnum=new unsigned[itemcounter];
|
savecartnum=new unsigned[itemcounter];
|
||||||
@ -110,8 +124,7 @@ void SchedCartList::save(void)
|
|||||||
save_sched_codes=new QString[itemcounter];
|
save_sched_codes=new QString[itemcounter];
|
||||||
|
|
||||||
saveitemcounter=itemcounter;
|
saveitemcounter=itemcounter;
|
||||||
for(int i=0;i<saveitemcounter;i++)
|
for(int i=0;i<saveitemcounter;i++) {
|
||||||
{
|
|
||||||
savecartnum[i]=cartnum[i];
|
savecartnum[i]=cartnum[i];
|
||||||
savecartlen[i]=cartlen[i];
|
savecartlen[i]=cartlen[i];
|
||||||
savestackid[i]=stackid[i];
|
savestackid[i]=stackid[i];
|
||||||
@ -123,10 +136,8 @@ void SchedCartList::save(void)
|
|||||||
|
|
||||||
void SchedCartList::restore(void)
|
void SchedCartList::restore(void)
|
||||||
{
|
{
|
||||||
if(itemcounter==0)
|
if(itemcounter==0) {
|
||||||
{
|
for(int i=0;i<saveitemcounter;i++) {
|
||||||
for(int i=0;i<saveitemcounter;i++)
|
|
||||||
{
|
|
||||||
cartnum[i]=savecartnum[i];
|
cartnum[i]=savecartnum[i];
|
||||||
cartlen[i]=savecartlen[i];
|
cartlen[i]=savecartlen[i];
|
||||||
stackid[i]=savestackid[i];
|
stackid[i]=savestackid[i];
|
||||||
@ -144,7 +155,7 @@ void SchedCartList::restore(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned SchedCartList::getItemCartnumber(int itemnumber)
|
unsigned SchedCartList::getItemCartNumber(int itemnumber)
|
||||||
{
|
{
|
||||||
return cartnum[itemnumber];
|
return cartnum[itemnumber];
|
||||||
}
|
}
|
||||||
@ -164,7 +175,7 @@ QString SchedCartList::getItemSchedCodes(int itemnumber)
|
|||||||
return sched_codes[itemnumber];
|
return sched_codes[itemnumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
int SchedCartList::getItemCartlength(int itemnumber)
|
int SchedCartList::getItemCartLength(int itemnumber)
|
||||||
{
|
{
|
||||||
return cartlen[itemnumber];
|
return cartlen[itemnumber];
|
||||||
}
|
}
|
||||||
@ -175,5 +186,3 @@ int SchedCartList::getNumberOfItems(void)
|
|||||||
return itemcounter;
|
return itemcounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#define SCHEDCARTLIST_H
|
#define SCHEDCARTLIST_H
|
||||||
|
|
||||||
#include <qsqldatabase.h>
|
#include <qsqldatabase.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
class SchedCartList
|
class SchedCartList
|
||||||
{
|
{
|
||||||
@ -32,8 +33,9 @@ class SchedCartList
|
|||||||
void removeItem(int itemnumber);
|
void removeItem(int itemnumber);
|
||||||
bool removeIfCode(int itemnumber,QString test_code);
|
bool removeIfCode(int itemnumber,QString test_code);
|
||||||
bool itemHasCode(int itemnumber,QString test_code);
|
bool itemHasCode(int itemnumber,QString test_code);
|
||||||
unsigned getItemCartnumber(int itemnumber);
|
bool itemHasCodes(int itemnumber,QStringList test_codes);
|
||||||
int getItemCartlength(int itemnumber);
|
unsigned getItemCartNumber(int itemnumber);
|
||||||
|
int getItemCartLength(int itemnumber);
|
||||||
int getItemStackid(int itemnumber);
|
int getItemStackid(int itemnumber);
|
||||||
QString getItemArtist(int itemnumber);
|
QString getItemArtist(int itemnumber);
|
||||||
QString getItemSchedCodes(int itemnumber);
|
QString getItemSchedCodes(int itemnumber);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user