OpenMW
|
00001 #ifndef CSM_WOLRD_COLUMNIMP_H 00002 #define CSM_WOLRD_COLUMNIMP_H 00003 00004 #include <sstream> 00005 00006 #include <boost/lexical_cast.hpp> 00007 00008 #include <QColor> 00009 00010 #include "columnbase.hpp" 00011 #include "columns.hpp" 00012 #include "info.hpp" 00013 00014 namespace CSMWorld 00015 { 00017 template<typename ESXRecordT> 00018 struct FloatValueColumn : public Column<ESXRecordT> 00019 { 00020 FloatValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Float) {} 00021 00022 virtual QVariant get (const Record<ESXRecordT>& record) const 00023 { 00024 return record.get().mValue.getFloat(); 00025 } 00026 00027 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00028 { 00029 ESXRecordT record2 = record.get(); 00030 record2.mValue.setFloat (data.toFloat()); 00031 record.setModified (record2); 00032 } 00033 00034 virtual bool isEditable() const 00035 { 00036 return true; 00037 } 00038 }; 00039 00041 template<typename ESXRecordT> 00042 struct StringIdColumn : public Column<ESXRecordT> 00043 { 00044 StringIdColumn (bool hidden = false) 00045 : Column<ESXRecordT> (Columns::ColumnId_Id, ColumnBase::Display_String, 00046 hidden ? 0 : ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue) 00047 {} 00048 00049 virtual QVariant get (const Record<ESXRecordT>& record) const 00050 { 00051 return QString::fromUtf8 (record.get().mId.c_str()); 00052 } 00053 00054 virtual bool isEditable() const 00055 { 00056 return false; 00057 } 00058 }; 00059 00060 template<typename ESXRecordT> 00061 struct RecordStateColumn : public Column<ESXRecordT> 00062 { 00063 RecordStateColumn() 00064 : Column<ESXRecordT> (Columns::ColumnId_Modification, ColumnBase::Display_RecordState) 00065 {} 00066 00067 virtual QVariant get (const Record<ESXRecordT>& record) const 00068 { 00069 if (record.mState==Record<ESXRecordT>::State_Erased) 00070 return static_cast<int> (Record<ESXRecordT>::State_Deleted); 00071 00072 return static_cast<int> (record.mState); 00073 } 00074 00075 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00076 { 00077 record.mState = static_cast<RecordBase::State> (data.toInt()); 00078 } 00079 00080 virtual bool isEditable() const 00081 { 00082 return true; 00083 } 00084 00085 virtual bool isUserEditable() const 00086 { 00087 return false; 00088 } 00089 }; 00090 00091 template<typename ESXRecordT> 00092 struct FixedRecordTypeColumn : public Column<ESXRecordT> 00093 { 00094 int mType; 00095 00096 FixedRecordTypeColumn (int type) 00097 : Column<ESXRecordT> (Columns::ColumnId_RecordType, ColumnBase::Display_Integer, 0), 00098 mType (type) 00099 {} 00100 00101 virtual QVariant get (const Record<ESXRecordT>& record) const 00102 { 00103 return mType; 00104 } 00105 00106 virtual bool isEditable() const 00107 { 00108 return false; 00109 } 00110 }; 00111 00113 template<typename ESXRecordT> 00114 struct VarTypeColumn : public Column<ESXRecordT> 00115 { 00116 VarTypeColumn (ColumnBase::Display display) 00117 : Column<ESXRecordT> (Columns::ColumnId_ValueType, display) 00118 {} 00119 00120 virtual QVariant get (const Record<ESXRecordT>& record) const 00121 { 00122 return static_cast<int> (record.get().mValue.getType()); 00123 } 00124 00125 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00126 { 00127 ESXRecordT record2 = record.get(); 00128 record2.mValue.setType (static_cast<ESM::VarType> (data.toInt())); 00129 record.setModified (record2); 00130 } 00131 00132 virtual bool isEditable() const 00133 { 00134 return true; 00135 } 00136 }; 00137 00139 template<typename ESXRecordT> 00140 struct VarValueColumn : public Column<ESXRecordT> 00141 { 00142 VarValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Var) {} 00143 00144 virtual QVariant get (const Record<ESXRecordT>& record) const 00145 { 00146 switch (record.get().mValue.getType()) 00147 { 00148 case ESM::VT_String: 00149 00150 return QString::fromUtf8 (record.get().mValue.getString().c_str()); 00151 00152 case ESM::VT_Int: 00153 case ESM::VT_Short: 00154 case ESM::VT_Long: 00155 00156 return record.get().mValue.getInteger(); 00157 00158 case ESM::VT_Float: 00159 00160 return record.get().mValue.getFloat(); 00161 00162 default: return QVariant(); 00163 } 00164 } 00165 00166 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00167 { 00168 ESXRecordT record2 = record.get(); 00169 00170 switch (record2.mValue.getType()) 00171 { 00172 case ESM::VT_String: 00173 00174 record2.mValue.setString (data.toString().toUtf8().constData()); 00175 break; 00176 00177 case ESM::VT_Int: 00178 case ESM::VT_Short: 00179 case ESM::VT_Long: 00180 00181 record2.mValue.setInteger (data.toInt()); 00182 break; 00183 00184 case ESM::VT_Float: 00185 00186 record2.mValue.setFloat (data.toFloat()); 00187 break; 00188 00189 default: break; 00190 } 00191 00192 record.setModified (record2); 00193 } 00194 00195 virtual bool isEditable() const 00196 { 00197 return true; 00198 } 00199 }; 00200 00201 template<typename ESXRecordT> 00202 struct DescriptionColumn : public Column<ESXRecordT> 00203 { 00204 DescriptionColumn() 00205 : Column<ESXRecordT> (Columns::ColumnId_Description, ColumnBase::Display_String) 00206 {} 00207 00208 virtual QVariant get (const Record<ESXRecordT>& record) const 00209 { 00210 return QString::fromUtf8 (record.get().mDescription.c_str()); 00211 } 00212 00213 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00214 { 00215 ESXRecordT record2 = record.get(); 00216 00217 record2.mDescription = data.toString().toUtf8().constData(); 00218 00219 record.setModified (record2); 00220 } 00221 00222 virtual bool isEditable() const 00223 { 00224 return true; 00225 } 00226 }; 00227 00228 template<typename ESXRecordT> 00229 struct SpecialisationColumn : public Column<ESXRecordT> 00230 { 00231 SpecialisationColumn() 00232 : Column<ESXRecordT> (Columns::ColumnId_Specialisation, ColumnBase::Display_Specialisation) 00233 {} 00234 00235 virtual QVariant get (const Record<ESXRecordT>& record) const 00236 { 00237 return record.get().mData.mSpecialization; 00238 } 00239 00240 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00241 { 00242 ESXRecordT record2 = record.get(); 00243 00244 record2.mData.mSpecialization = data.toInt(); 00245 00246 record.setModified (record2); 00247 } 00248 00249 virtual bool isEditable() const 00250 { 00251 return true; 00252 } 00253 }; 00254 00255 template<typename ESXRecordT> 00256 struct UseValueColumn : public Column<ESXRecordT> 00257 { 00258 int mIndex; 00259 00260 UseValueColumn (int index) 00261 : Column<ESXRecordT> (Columns::ColumnId_UseValue1 + index, ColumnBase::Display_Float), 00262 mIndex (index) 00263 {} 00264 00265 virtual QVariant get (const Record<ESXRecordT>& record) const 00266 { 00267 return record.get().mData.mUseValue[mIndex]; 00268 } 00269 00270 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00271 { 00272 ESXRecordT record2 = record.get(); 00273 00274 record2.mData.mUseValue[mIndex] = data.toInt(); 00275 00276 record.setModified (record2); 00277 } 00278 00279 virtual bool isEditable() const 00280 { 00281 return true; 00282 } 00283 }; 00284 00285 template<typename ESXRecordT> 00286 struct AttributeColumn : public Column<ESXRecordT> 00287 { 00288 AttributeColumn() 00289 : Column<ESXRecordT> (Columns::ColumnId_Attribute, ColumnBase::Display_Attribute) 00290 {} 00291 00292 virtual QVariant get (const Record<ESXRecordT>& record) const 00293 { 00294 return record.get().mData.mAttribute; 00295 } 00296 00297 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00298 { 00299 ESXRecordT record2 = record.get(); 00300 00301 record2.mData.mAttribute = data.toInt(); 00302 00303 record.setModified (record2); 00304 } 00305 00306 virtual bool isEditable() const 00307 { 00308 return true; 00309 } 00310 }; 00311 00312 template<typename ESXRecordT> 00313 struct NameColumn : public Column<ESXRecordT> 00314 { 00315 NameColumn() : Column<ESXRecordT> (Columns::ColumnId_Name, ColumnBase::Display_String) {} 00316 00317 virtual QVariant get (const Record<ESXRecordT>& record) const 00318 { 00319 return QString::fromUtf8 (record.get().mName.c_str()); 00320 } 00321 00322 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00323 { 00324 ESXRecordT record2 = record.get(); 00325 00326 record2.mName = data.toString().toUtf8().constData(); 00327 00328 record.setModified (record2); 00329 } 00330 00331 virtual bool isEditable() const 00332 { 00333 return true; 00334 } 00335 }; 00336 00337 template<typename ESXRecordT> 00338 struct AttributesColumn : public Column<ESXRecordT> 00339 { 00340 int mIndex; 00341 00342 AttributesColumn (int index) 00343 : Column<ESXRecordT> (Columns::ColumnId_Attribute1 + index, ColumnBase::Display_Attribute), 00344 mIndex (index) 00345 {} 00346 00347 virtual QVariant get (const Record<ESXRecordT>& record) const 00348 { 00349 return record.get().mData.mAttribute[mIndex]; 00350 } 00351 00352 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00353 { 00354 ESXRecordT record2 = record.get(); 00355 00356 record2.mData.mAttribute[mIndex] = data.toInt(); 00357 00358 record.setModified (record2); 00359 } 00360 00361 virtual bool isEditable() const 00362 { 00363 return true; 00364 } 00365 }; 00366 00367 template<typename ESXRecordT> 00368 struct SkillsColumn : public Column<ESXRecordT> 00369 { 00370 int mIndex; 00371 bool mMajor; 00372 00373 SkillsColumn (int index, bool typePrefix = false, bool major = false) 00374 : Column<ESXRecordT> ((typePrefix ? ( 00375 major ? Columns::ColumnId_MajorSkill1 : Columns::ColumnId_MinorSkill1) : 00376 Columns::ColumnId_Skill1) + index, ColumnBase::Display_String), 00377 mIndex (index), mMajor (major) 00378 {} 00379 00380 virtual QVariant get (const Record<ESXRecordT>& record) const 00381 { 00382 int skill = record.get().mData.getSkill (mIndex, mMajor); 00383 00384 return QString::fromUtf8 (ESM::Skill::indexToId (skill).c_str()); 00385 } 00386 00387 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00388 { 00389 std::istringstream stream (data.toString().toUtf8().constData()); 00390 00391 int index = -1; 00392 char c; 00393 00394 stream >> c >> index; 00395 00396 if (index!=-1) 00397 { 00398 ESXRecordT record2 = record.get(); 00399 00400 record2.mData.getSkill (mIndex, mMajor) = index; 00401 00402 record.setModified (record2); 00403 } 00404 } 00405 00406 virtual bool isEditable() const 00407 { 00408 return true; 00409 } 00410 }; 00411 00412 template<typename ESXRecordT> 00413 struct PlayableColumn : public Column<ESXRecordT> 00414 { 00415 PlayableColumn() : Column<ESXRecordT> (Columns::ColumnId_Playable, ColumnBase::Display_Boolean) 00416 {} 00417 00418 virtual QVariant get (const Record<ESXRecordT>& record) const 00419 { 00420 return record.get().mData.mIsPlayable!=0; 00421 } 00422 00423 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00424 { 00425 ESXRecordT record2 = record.get(); 00426 00427 record2.mData.mIsPlayable = data.toInt(); 00428 00429 record.setModified (record2); 00430 } 00431 00432 virtual bool isEditable() const 00433 { 00434 return true; 00435 } 00436 }; 00437 00438 template<typename ESXRecordT> 00439 struct HiddenColumn : public Column<ESXRecordT> 00440 { 00441 HiddenColumn() : Column<ESXRecordT> (Columns::ColumnId_Hidden, ColumnBase::Display_Boolean) {} 00442 00443 virtual QVariant get (const Record<ESXRecordT>& record) const 00444 { 00445 return record.get().mData.mIsHidden!=0; 00446 } 00447 00448 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00449 { 00450 ESXRecordT record2 = record.get(); 00451 00452 record2.mData.mIsHidden = data.toInt(); 00453 00454 record.setModified (record2); 00455 } 00456 00457 virtual bool isEditable() const 00458 { 00459 return true; 00460 } 00461 }; 00462 00463 template<typename ESXRecordT> 00464 struct FlagColumn : public Column<ESXRecordT> 00465 { 00466 int mMask; 00467 00468 FlagColumn (int columnId, int mask) 00469 : Column<ESXRecordT> (columnId, ColumnBase::Display_Boolean), mMask (mask) 00470 {} 00471 00472 virtual QVariant get (const Record<ESXRecordT>& record) const 00473 { 00474 return (record.get().mData.mFlags & mMask)!=0; 00475 } 00476 00477 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00478 { 00479 ESXRecordT record2 = record.get(); 00480 00481 int flags = record2.mData.mFlags & ~mMask; 00482 00483 if (data.toInt()) 00484 flags |= mMask; 00485 00486 record2.mData.mFlags = flags; 00487 00488 record.setModified (record2); 00489 } 00490 00491 virtual bool isEditable() const 00492 { 00493 return true; 00494 } 00495 }; 00496 00497 template<typename ESXRecordT> 00498 struct WeightHeightColumn : public Column<ESXRecordT> 00499 { 00500 bool mMale; 00501 bool mWeight; 00502 00503 WeightHeightColumn (bool male, bool weight) 00504 : Column<ESXRecordT> (male ? 00505 (weight ? Columns::ColumnId_MaleWeight : Columns::ColumnId_MaleHeight) : 00506 (weight ? Columns::ColumnId_FemaleWeight : Columns::ColumnId_FemaleHeight), 00507 ColumnBase::Display_Float), 00508 mMale (male), mWeight (weight) 00509 {} 00510 00511 virtual QVariant get (const Record<ESXRecordT>& record) const 00512 { 00513 const ESM::Race::MaleFemaleF& value = 00514 mWeight ? record.get().mData.mWeight : record.get().mData.mHeight; 00515 00516 return mMale ? value.mMale : value.mFemale; 00517 } 00518 00519 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00520 { 00521 ESXRecordT record2 = record.get(); 00522 00523 ESM::Race::MaleFemaleF& value = 00524 mWeight ? record2.mData.mWeight : record2.mData.mHeight; 00525 00526 (mMale ? value.mMale : value.mFemale) = data.toFloat(); 00527 00528 record.setModified (record2); 00529 } 00530 00531 virtual bool isEditable() const 00532 { 00533 return true; 00534 } 00535 }; 00536 00537 template<typename ESXRecordT> 00538 struct SoundParamColumn : public Column<ESXRecordT> 00539 { 00540 enum Type 00541 { 00542 Type_Volume, 00543 Type_MinRange, 00544 Type_MaxRange 00545 }; 00546 00547 Type mType; 00548 00549 SoundParamColumn (Type type) 00550 : Column<ESXRecordT> (type==Type_Volume ? Columns::ColumnId_Volume : 00551 (type==Type_MinRange ? Columns::ColumnId_MinRange : Columns::ColumnId_MaxRange), 00552 ColumnBase::Display_Integer), 00553 mType (type) 00554 {} 00555 00556 virtual QVariant get (const Record<ESXRecordT>& record) const 00557 { 00558 int value = 0; 00559 00560 switch (mType) 00561 { 00562 case Type_Volume: value = record.get().mData.mVolume; break; 00563 case Type_MinRange: value = record.get().mData.mMinRange; break; 00564 case Type_MaxRange: value = record.get().mData.mMaxRange; break; 00565 } 00566 00567 return value; 00568 } 00569 00570 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00571 { 00572 int value = data.toInt(); 00573 00574 if (value<0) 00575 value = 0; 00576 else if (value>255) 00577 value = 255; 00578 00579 ESXRecordT record2 = record.get(); 00580 00581 switch (mType) 00582 { 00583 case Type_Volume: record2.mData.mVolume = static_cast<unsigned char> (value); break; 00584 case Type_MinRange: record2.mData.mMinRange = static_cast<unsigned char> (value); break; 00585 case Type_MaxRange: record2.mData.mMaxRange = static_cast<unsigned char> (value); break; 00586 } 00587 00588 record.setModified (record2); 00589 } 00590 00591 virtual bool isEditable() const 00592 { 00593 return true; 00594 } 00595 }; 00596 00597 template<typename ESXRecordT> 00598 struct SoundFileColumn : public Column<ESXRecordT> 00599 { 00600 SoundFileColumn() 00601 : Column<ESXRecordT> (Columns::ColumnId_SoundFile, ColumnBase::Display_String) 00602 {} 00603 00604 virtual QVariant get (const Record<ESXRecordT>& record) const 00605 { 00606 return QString::fromUtf8 (record.get().mSound.c_str()); 00607 } 00608 00609 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00610 { 00611 ESXRecordT record2 = record.get(); 00612 00613 record2.mSound = data.toString().toUtf8().constData(); 00614 00615 record.setModified (record2); 00616 } 00617 00618 virtual bool isEditable() const 00619 { 00620 return true; 00621 } 00622 }; 00623 00626 template<typename ESXRecordT> 00627 struct MapColourColumn : public Column<ESXRecordT> 00628 { 00630 MapColourColumn() 00631 : Column<ESXRecordT> (Columns::ColumnId_MapColour, ColumnBase::Display_Integer) 00632 {} 00633 00634 virtual QVariant get (const Record<ESXRecordT>& record) const 00635 { 00636 int colour = record.get().mMapColor; 00637 00638 return QColor (colour & 0xff, (colour>>8) & 0xff, (colour>>16) & 0xff); 00639 } 00640 00641 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00642 { 00643 ESXRecordT record2 = record.get(); 00644 00645 QColor colour = data.value<QColor>(); 00646 00647 record2.mMapColor = colour.rgb() & 0xffffff; 00648 00649 record.setModified (record2); 00650 } 00651 00652 virtual bool isEditable() const 00653 { 00654 return true; 00655 } 00656 }; 00657 00658 template<typename ESXRecordT> 00659 struct SleepListColumn : public Column<ESXRecordT> 00660 { 00661 SleepListColumn() 00662 : Column<ESXRecordT> (Columns::ColumnId_SleepEncounter, ColumnBase::Display_String) 00663 {} 00664 00665 virtual QVariant get (const Record<ESXRecordT>& record) const 00666 { 00667 return QString::fromUtf8 (record.get().mSleepList.c_str()); 00668 } 00669 00670 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00671 { 00672 ESXRecordT record2 = record.get(); 00673 00674 record2.mSleepList = data.toString().toUtf8().constData(); 00675 00676 record.setModified (record2); 00677 } 00678 00679 virtual bool isEditable() const 00680 { 00681 return true; 00682 } 00683 }; 00684 00685 template<typename ESXRecordT> 00686 struct TextureColumn : public Column<ESXRecordT> 00687 { 00688 TextureColumn() : Column<ESXRecordT> (Columns::ColumnId_Texture, ColumnBase::Display_String) {} 00689 00690 virtual QVariant get (const Record<ESXRecordT>& record) const 00691 { 00692 return QString::fromUtf8 (record.get().mTexture.c_str()); 00693 } 00694 00695 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00696 { 00697 ESXRecordT record2 = record.get(); 00698 00699 record2.mTexture = data.toString().toUtf8().constData(); 00700 00701 record.setModified (record2); 00702 } 00703 00704 virtual bool isEditable() const 00705 { 00706 return true; 00707 } 00708 }; 00709 00710 template<typename ESXRecordT> 00711 struct SpellTypeColumn : public Column<ESXRecordT> 00712 { 00713 SpellTypeColumn() 00714 : Column<ESXRecordT> (Columns::ColumnId_SpellType, ColumnBase::Display_SpellType) 00715 {} 00716 00717 virtual QVariant get (const Record<ESXRecordT>& record) const 00718 { 00719 return record.get().mData.mType; 00720 } 00721 00722 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00723 { 00724 ESXRecordT record2 = record.get(); 00725 00726 record2.mData.mType = data.toInt(); 00727 00728 record.setModified (record2); 00729 } 00730 00731 virtual bool isEditable() const 00732 { 00733 return true; 00734 } 00735 }; 00736 00737 template<typename ESXRecordT> 00738 struct CostColumn : public Column<ESXRecordT> 00739 { 00740 CostColumn() : Column<ESXRecordT> (Columns::ColumnId_Cost, ColumnBase::Display_Integer) {} 00741 00742 virtual QVariant get (const Record<ESXRecordT>& record) const 00743 { 00744 return record.get().mData.mCost; 00745 } 00746 00747 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00748 { 00749 ESXRecordT record2 = record.get(); 00750 record2.mData.mCost = data.toInt(); 00751 record.setModified (record2); 00752 } 00753 00754 virtual bool isEditable() const 00755 { 00756 return true; 00757 } 00758 }; 00759 00760 template<typename ESXRecordT> 00761 struct ScriptColumn : public Column<ESXRecordT> 00762 { 00763 ScriptColumn() 00764 : Column<ESXRecordT> (Columns::ColumnId_ScriptText, ColumnBase::Display_Script, 0) {} 00765 00766 virtual QVariant get (const Record<ESXRecordT>& record) const 00767 { 00768 return QString::fromUtf8 (record.get().mScriptText.c_str()); 00769 } 00770 00771 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00772 { 00773 ESXRecordT record2 = record.get(); 00774 00775 record2.mScriptText = data.toString().toUtf8().constData(); 00776 00777 record.setModified (record2); 00778 } 00779 00780 virtual bool isEditable() const 00781 { 00782 return true; 00783 } 00784 }; 00785 00786 template<typename ESXRecordT> 00787 struct RegionColumn : public Column<ESXRecordT> 00788 { 00789 RegionColumn() : Column<ESXRecordT> (Columns::ColumnId_Region, ColumnBase::Display_String) {} 00790 00791 virtual QVariant get (const Record<ESXRecordT>& record) const 00792 { 00793 return QString::fromUtf8 (record.get().mRegion.c_str()); 00794 } 00795 00796 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00797 { 00798 ESXRecordT record2 = record.get(); 00799 00800 record2.mRegion = data.toString().toUtf8().constData(); 00801 00802 record.setModified (record2); 00803 } 00804 00805 virtual bool isEditable() const 00806 { 00807 return true; 00808 } 00809 }; 00810 00811 template<typename ESXRecordT> 00812 struct CellColumn : public Column<ESXRecordT> 00813 { 00814 CellColumn() : Column<ESXRecordT> (Columns::ColumnId_Cell, ColumnBase::Display_String) {} 00815 00816 virtual QVariant get (const Record<ESXRecordT>& record) const 00817 { 00818 return QString::fromUtf8 (record.get().mCell.c_str()); 00819 } 00820 00821 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00822 { 00823 ESXRecordT record2 = record.get(); 00824 00825 record2.mCell = data.toString().toUtf8().constData(); 00826 00827 record.setModified (record2); 00828 } 00829 00830 virtual bool isEditable() const 00831 { 00832 return true; 00833 } 00834 00835 virtual bool isUserEditable() const 00836 { 00837 return false; 00838 } 00839 }; 00840 00842 template<typename ESXRecordT> 00843 struct IdColumn : public Column<ESXRecordT> 00844 { 00845 IdColumn() : Column<ESXRecordT> (Columns::ColumnId_Id, ColumnBase::Display_String) {} 00846 00847 virtual QVariant get (const Record<ESXRecordT>& record) const 00848 { 00849 return QString::fromUtf8 (record.get().mRefID.c_str()); 00850 } 00851 00852 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00853 { 00854 ESXRecordT record2 = record.get(); 00855 00856 record2.mRefID = data.toString().toUtf8().constData(); 00857 00858 record.setModified (record2); 00859 } 00860 00861 virtual bool isEditable() const 00862 { 00863 return true; 00864 } 00865 }; 00866 00867 template<typename ESXRecordT> 00868 struct ScaleColumn : public Column<ESXRecordT> 00869 { 00870 ScaleColumn() : Column<ESXRecordT> (Columns::ColumnId_Scale, ColumnBase::Display_Float) {} 00871 00872 virtual QVariant get (const Record<ESXRecordT>& record) const 00873 { 00874 return record.get().mScale; 00875 } 00876 00877 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00878 { 00879 ESXRecordT record2 = record.get(); 00880 record2.mScale = data.toFloat(); 00881 record.setModified (record2); 00882 } 00883 00884 virtual bool isEditable() const 00885 { 00886 return true; 00887 } 00888 }; 00889 00890 template<typename ESXRecordT> 00891 struct OwnerColumn : public Column<ESXRecordT> 00892 { 00893 OwnerColumn() : Column<ESXRecordT> (Columns::ColumnId_Owner, ColumnBase::Display_String) {} 00894 00895 virtual QVariant get (const Record<ESXRecordT>& record) const 00896 { 00897 return QString::fromUtf8 (record.get().mOwner.c_str()); 00898 } 00899 00900 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00901 { 00902 ESXRecordT record2 = record.get(); 00903 00904 record2.mOwner = data.toString().toUtf8().constData(); 00905 00906 record.setModified (record2); 00907 } 00908 00909 virtual bool isEditable() const 00910 { 00911 return true; 00912 } 00913 }; 00914 00915 template<typename ESXRecordT> 00916 struct SoulColumn : public Column<ESXRecordT> 00917 { 00918 SoulColumn() : Column<ESXRecordT> (Columns::ColumnId_Soul, ColumnBase::Display_String) {} 00919 00920 virtual QVariant get (const Record<ESXRecordT>& record) const 00921 { 00922 return QString::fromUtf8 (record.get().mSoul.c_str()); 00923 } 00924 00925 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00926 { 00927 ESXRecordT record2 = record.get(); 00928 00929 record2.mSoul = data.toString().toUtf8().constData(); 00930 00931 record.setModified (record2); 00932 } 00933 00934 virtual bool isEditable() const 00935 { 00936 return true; 00937 } 00938 }; 00939 00940 template<typename ESXRecordT> 00941 struct FactionColumn : public Column<ESXRecordT> 00942 { 00943 FactionColumn() : Column<ESXRecordT> (Columns::ColumnId_Faction, ColumnBase::Display_String) {} 00944 00945 virtual QVariant get (const Record<ESXRecordT>& record) const 00946 { 00947 return QString::fromUtf8 (record.get().mFaction.c_str()); 00948 } 00949 00950 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00951 { 00952 ESXRecordT record2 = record.get(); 00953 00954 record2.mFaction = data.toString().toUtf8().constData(); 00955 00956 record.setModified (record2); 00957 } 00958 00959 virtual bool isEditable() const 00960 { 00961 return true; 00962 } 00963 }; 00964 00965 template<typename ESXRecordT> 00966 struct FactionIndexColumn : public Column<ESXRecordT> 00967 { 00968 FactionIndexColumn() 00969 : Column<ESXRecordT> (Columns::ColumnId_FactionIndex, ColumnBase::Display_Integer) 00970 {} 00971 00972 virtual QVariant get (const Record<ESXRecordT>& record) const 00973 { 00974 return record.get().mFactIndex; 00975 } 00976 00977 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 00978 { 00979 ESXRecordT record2 = record.get(); 00980 record2.mFactIndex = data.toInt(); 00981 record.setModified (record2); 00982 } 00983 00984 virtual bool isEditable() const 00985 { 00986 return true; 00987 } 00988 }; 00989 00990 template<typename ESXRecordT> 00991 struct ChargesColumn : public Column<ESXRecordT> 00992 { 00993 ChargesColumn() : Column<ESXRecordT> (Columns::ColumnId_Charges, ColumnBase::Display_Integer) {} 00994 00995 virtual QVariant get (const Record<ESXRecordT>& record) const 00996 { 00997 return record.get().mCharge; 00998 } 00999 01000 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01001 { 01002 ESXRecordT record2 = record.get(); 01003 record2.mCharge = data.toInt(); 01004 record.setModified (record2); 01005 } 01006 01007 virtual bool isEditable() const 01008 { 01009 return true; 01010 } 01011 }; 01012 01013 template<typename ESXRecordT> 01014 struct EnchantmentChargesColumn : public Column<ESXRecordT> 01015 { 01016 EnchantmentChargesColumn() 01017 : Column<ESXRecordT> (Columns::ColumnId_Enchantment, ColumnBase::Display_Float) 01018 {} 01019 01020 virtual QVariant get (const Record<ESXRecordT>& record) const 01021 { 01022 return record.get().mEnchantmentCharge; 01023 } 01024 01025 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01026 { 01027 ESXRecordT record2 = record.get(); 01028 record2.mEnchantmentCharge = data.toFloat(); 01029 record.setModified (record2); 01030 } 01031 01032 virtual bool isEditable() const 01033 { 01034 return true; 01035 } 01036 }; 01037 01038 template<typename ESXRecordT> 01039 struct GoldValueColumn : public Column<ESXRecordT> 01040 { 01041 GoldValueColumn() 01042 : Column<ESXRecordT> (Columns::ColumnId_CoinValue, ColumnBase::Display_Integer) {} 01043 01044 virtual QVariant get (const Record<ESXRecordT>& record) const 01045 { 01046 return record.get().mGoldValue; 01047 } 01048 01049 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01050 { 01051 ESXRecordT record2 = record.get(); 01052 record2.mGoldValue = data.toInt(); 01053 record.setModified (record2); 01054 } 01055 01056 virtual bool isEditable() const 01057 { 01058 return true; 01059 } 01060 }; 01061 01062 template<typename ESXRecordT> 01063 struct TeleportColumn : public Column<ESXRecordT> 01064 { 01065 TeleportColumn() 01066 : Column<ESXRecordT> (Columns::ColumnId_Teleport, ColumnBase::Display_Boolean) 01067 {} 01068 01069 virtual QVariant get (const Record<ESXRecordT>& record) const 01070 { 01071 return record.get().mTeleport; 01072 } 01073 01074 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01075 { 01076 ESXRecordT record2 = record.get(); 01077 01078 record2.mTeleport = data.toInt(); 01079 01080 record.setModified (record2); 01081 } 01082 01083 virtual bool isEditable() const 01084 { 01085 return true; 01086 } 01087 }; 01088 01089 template<typename ESXRecordT> 01090 struct TeleportCellColumn : public Column<ESXRecordT> 01091 { 01092 TeleportCellColumn() 01093 : Column<ESXRecordT> (Columns::ColumnId_TeleportCell, ColumnBase::Display_String) 01094 {} 01095 01096 virtual QVariant get (const Record<ESXRecordT>& record) const 01097 { 01098 return QString::fromUtf8 (record.get().mDestCell.c_str()); 01099 } 01100 01101 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01102 { 01103 ESXRecordT record2 = record.get(); 01104 01105 record2.mDestCell = data.toString().toUtf8().constData(); 01106 01107 record.setModified (record2); 01108 } 01109 01110 virtual bool isEditable() const 01111 { 01112 return true; 01113 } 01114 01115 virtual bool isUserEditable() const 01116 { 01117 return false; 01118 } 01119 }; 01120 01121 template<typename ESXRecordT> 01122 struct LockLevelColumn : public Column<ESXRecordT> 01123 { 01124 LockLevelColumn() 01125 : Column<ESXRecordT> (Columns::ColumnId_LockLevel, ColumnBase::Display_Integer) 01126 {} 01127 01128 virtual QVariant get (const Record<ESXRecordT>& record) const 01129 { 01130 return record.get().mLockLevel; 01131 } 01132 01133 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01134 { 01135 ESXRecordT record2 = record.get(); 01136 record2.mLockLevel = data.toInt(); 01137 record.setModified (record2); 01138 } 01139 01140 virtual bool isEditable() const 01141 { 01142 return true; 01143 } 01144 }; 01145 01146 template<typename ESXRecordT> 01147 struct KeyColumn : public Column<ESXRecordT> 01148 { 01149 KeyColumn() : Column<ESXRecordT> (Columns::ColumnId_Key, ColumnBase::Display_String) {} 01150 01151 virtual QVariant get (const Record<ESXRecordT>& record) const 01152 { 01153 return QString::fromUtf8 (record.get().mKey.c_str()); 01154 } 01155 01156 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01157 { 01158 ESXRecordT record2 = record.get(); 01159 01160 record2.mKey = data.toString().toUtf8().constData(); 01161 01162 record.setModified (record2); 01163 } 01164 01165 virtual bool isEditable() const 01166 { 01167 return true; 01168 } 01169 }; 01170 01171 template<typename ESXRecordT> 01172 struct TrapColumn : public Column<ESXRecordT> 01173 { 01174 TrapColumn() : Column<ESXRecordT> (Columns::ColumnId_Trap, ColumnBase::Display_String) {} 01175 01176 virtual QVariant get (const Record<ESXRecordT>& record) const 01177 { 01178 return QString::fromUtf8 (record.get().mTrap.c_str()); 01179 } 01180 01181 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01182 { 01183 ESXRecordT record2 = record.get(); 01184 01185 record2.mTrap = data.toString().toUtf8().constData(); 01186 01187 record.setModified (record2); 01188 } 01189 01190 virtual bool isEditable() const 01191 { 01192 return true; 01193 } 01194 }; 01195 01196 template<typename ESXRecordT> 01197 struct FilterColumn : public Column<ESXRecordT> 01198 { 01199 FilterColumn() : Column<ESXRecordT> (Columns::ColumnId_Filter, ColumnBase::Display_String) {} 01200 01201 virtual QVariant get (const Record<ESXRecordT>& record) const 01202 { 01203 return QString::fromUtf8 (record.get().mFilter.c_str()); 01204 } 01205 01206 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01207 { 01208 ESXRecordT record2 = record.get(); 01209 01210 record2.mFilter = data.toString().toUtf8().constData(); 01211 01212 record.setModified (record2); 01213 } 01214 01215 virtual bool isEditable() const 01216 { 01217 return true; 01218 } 01219 }; 01220 01221 template<typename ESXRecordT> 01222 struct ScopeColumn : public Column<ESXRecordT> 01223 { 01224 ScopeColumn() 01225 : Column<ESXRecordT> (Columns::ColumnId_Scope, ColumnBase::Display_Integer, 0) 01226 {} 01227 01228 virtual QVariant get (const Record<ESXRecordT>& record) const 01229 { 01230 return static_cast<int> (record.get().mScope); 01231 } 01232 01233 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01234 { 01235 ESXRecordT record2 = record.get(); 01236 record2.mScope = static_cast<CSMFilter::Filter::Scope> (data.toInt()); 01237 record.setModified (record2); 01238 } 01239 01240 virtual bool isEditable() const 01241 { 01242 return true; 01243 } 01244 01245 virtual bool isUserEditable() const 01246 { 01247 return false; 01248 } 01249 }; 01250 01251 01252 template<typename ESXRecordT> 01253 struct PosColumn : public Column<ESXRecordT> 01254 { 01255 ESM::Position ESXRecordT::* mPosition; 01256 int mIndex; 01257 01258 PosColumn (ESM::Position ESXRecordT::* position, int index, bool door) 01259 : Column<ESXRecordT> ( 01260 (door ? Columns::ColumnId_DoorPositionXPos : Columns::ColumnId_PositionXPos)+index, 01261 ColumnBase::Display_Float), mPosition (position), mIndex (index) {} 01262 01263 virtual QVariant get (const Record<ESXRecordT>& record) const 01264 { 01265 const ESM::Position& position = record.get().*mPosition; 01266 return position.pos[mIndex]; 01267 } 01268 01269 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01270 { 01271 ESXRecordT record2 = record.get(); 01272 01273 ESM::Position& position = record.get().*mPosition; 01274 01275 position.pos[mIndex] = data.toFloat(); 01276 01277 record.setModified (record2); 01278 } 01279 01280 virtual bool isEditable() const 01281 { 01282 return true; 01283 } 01284 }; 01285 01286 template<typename ESXRecordT> 01287 struct RotColumn : public Column<ESXRecordT> 01288 { 01289 ESM::Position ESXRecordT::* mPosition; 01290 int mIndex; 01291 01292 RotColumn (ESM::Position ESXRecordT::* position, int index, bool door) 01293 : Column<ESXRecordT> ( 01294 (door ? Columns::ColumnId_DoorPositionXRot : Columns::ColumnId_PositionXRot)+index, 01295 ColumnBase::Display_Float), mPosition (position), mIndex (index) {} 01296 01297 virtual QVariant get (const Record<ESXRecordT>& record) const 01298 { 01299 const ESM::Position& position = record.get().*mPosition; 01300 return position.rot[mIndex]; 01301 } 01302 01303 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01304 { 01305 ESXRecordT record2 = record.get(); 01306 01307 ESM::Position& position = record.get().*mPosition; 01308 01309 position.rot[mIndex] = data.toFloat(); 01310 01311 record.setModified (record2); 01312 } 01313 01314 virtual bool isEditable() const 01315 { 01316 return true; 01317 } 01318 }; 01319 01320 template<typename ESXRecordT> 01321 struct DialogueTypeColumn : public Column<ESXRecordT> 01322 { 01323 DialogueTypeColumn (bool hidden = false) 01324 : Column<ESXRecordT> (Columns::ColumnId_DialogueType, ColumnBase::Display_DialogueType, 01325 hidden ? 0 : ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue) 01326 {} 01327 01328 virtual QVariant get (const Record<ESXRecordT>& record) const 01329 { 01330 return static_cast<int> (record.get().mType); 01331 } 01332 01333 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01334 { 01335 ESXRecordT record2 = record.get(); 01336 01337 record2.mType = data.toInt(); 01338 01339 record.setModified (record2); 01340 } 01341 01342 virtual bool isEditable() const 01343 { 01344 return true; 01345 } 01346 01347 virtual bool isUserEditable() const 01348 { 01349 return false; 01350 } 01351 }; 01352 01353 template<typename ESXRecordT> 01354 struct QuestStatusTypeColumn : public Column<ESXRecordT> 01355 { 01356 QuestStatusTypeColumn() 01357 : Column<ESXRecordT> (Columns::ColumnId_QuestStatusType, ColumnBase::Display_QuestStatusType) 01358 {} 01359 01360 virtual QVariant get (const Record<ESXRecordT>& record) const 01361 { 01362 return static_cast<int> (record.get().mQuestStatus); 01363 } 01364 01365 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01366 { 01367 ESXRecordT record2 = record.get(); 01368 01369 record2.mQuestStatus = static_cast<Info::QuestStatus> (data.toInt()); 01370 01371 record.setModified (record2); 01372 } 01373 01374 virtual bool isEditable() const 01375 { 01376 return true; 01377 } 01378 }; 01379 01380 template<typename ESXRecordT> 01381 struct QuestDescriptionColumn : public Column<ESXRecordT> 01382 { 01383 QuestDescriptionColumn() : Column<ESXRecordT> (Columns::ColumnId_QuestDescription, ColumnBase::Display_String) {} 01384 01385 virtual QVariant get (const Record<ESXRecordT>& record) const 01386 { 01387 return QString::fromUtf8 (record.get().mResponse.c_str()); 01388 } 01389 01390 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01391 { 01392 ESXRecordT record2 = record.get(); 01393 01394 record2.mResponse = data.toString().toUtf8().constData(); 01395 01396 record.setModified (record2); 01397 } 01398 01399 virtual bool isEditable() const 01400 { 01401 return true; 01402 } 01403 }; 01404 01405 template<typename ESXRecordT> 01406 struct QuestIndexColumn : public Column<ESXRecordT> 01407 { 01408 QuestIndexColumn() 01409 : Column<ESXRecordT> (Columns::ColumnId_QuestIndex, ColumnBase::Display_Integer) 01410 {} 01411 01412 virtual QVariant get (const Record<ESXRecordT>& record) const 01413 { 01414 return record.get().mData.mDisposition; 01415 } 01416 01417 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01418 { 01419 ESXRecordT record2 = record.get(); 01420 record2.mData.mDisposition = data.toInt(); 01421 record.setModified (record2); 01422 } 01423 01424 virtual bool isEditable() const 01425 { 01426 return true; 01427 } 01428 }; 01429 01430 template<typename ESXRecordT> 01431 struct TopicColumn : public Column<ESXRecordT> 01432 { 01433 TopicColumn (bool journal) : Column<ESXRecordT> (journal ? Columns::ColumnId_Journal : Columns::ColumnId_Topic, ColumnBase::Display_String) {} 01434 01435 virtual QVariant get (const Record<ESXRecordT>& record) const 01436 { 01437 return QString::fromUtf8 (record.get().mTopicId.c_str()); 01438 } 01439 01440 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01441 { 01442 ESXRecordT record2 = record.get(); 01443 01444 record2.mTopicId = data.toString().toUtf8().constData(); 01445 01446 record.setModified (record2); 01447 } 01448 01449 virtual bool isEditable() const 01450 { 01451 return true; 01452 } 01453 01454 virtual bool isUserEditable() const 01455 { 01456 return false; 01457 } 01458 }; 01459 01460 template<typename ESXRecordT> 01461 struct ActorColumn : public Column<ESXRecordT> 01462 { 01463 ActorColumn() : Column<ESXRecordT> (Columns::ColumnId_Actor, ColumnBase::Display_String) {} 01464 01465 virtual QVariant get (const Record<ESXRecordT>& record) const 01466 { 01467 return QString::fromUtf8 (record.get().mActor.c_str()); 01468 } 01469 01470 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01471 { 01472 ESXRecordT record2 = record.get(); 01473 01474 record2.mActor = data.toString().toUtf8().constData(); 01475 01476 record.setModified (record2); 01477 } 01478 01479 virtual bool isEditable() const 01480 { 01481 return true; 01482 } 01483 }; 01484 01485 template<typename ESXRecordT> 01486 struct RaceColumn : public Column<ESXRecordT> 01487 { 01488 RaceColumn() : Column<ESXRecordT> (Columns::ColumnId_Race, ColumnBase::Display_String) {} 01489 01490 virtual QVariant get (const Record<ESXRecordT>& record) const 01491 { 01492 return QString::fromUtf8 (record.get().mRace.c_str()); 01493 } 01494 01495 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01496 { 01497 ESXRecordT record2 = record.get(); 01498 01499 record2.mRace = data.toString().toUtf8().constData(); 01500 01501 record.setModified (record2); 01502 } 01503 01504 virtual bool isEditable() const 01505 { 01506 return true; 01507 } 01508 }; 01509 01510 template<typename ESXRecordT> 01511 struct ClassColumn : public Column<ESXRecordT> 01512 { 01513 ClassColumn() : Column<ESXRecordT> (Columns::ColumnId_Class, ColumnBase::Display_String) {} 01514 01515 virtual QVariant get (const Record<ESXRecordT>& record) const 01516 { 01517 return QString::fromUtf8 (record.get().mClass.c_str()); 01518 } 01519 01520 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01521 { 01522 ESXRecordT record2 = record.get(); 01523 01524 record2.mClass = data.toString().toUtf8().constData(); 01525 01526 record.setModified (record2); 01527 } 01528 01529 virtual bool isEditable() const 01530 { 01531 return true; 01532 } 01533 }; 01534 01535 template<typename ESXRecordT> 01536 struct PcFactionColumn : public Column<ESXRecordT> 01537 { 01538 PcFactionColumn() : Column<ESXRecordT> (Columns::ColumnId_PcFaction, ColumnBase::Display_String) {} 01539 01540 virtual QVariant get (const Record<ESXRecordT>& record) const 01541 { 01542 return QString::fromUtf8 (record.get().mPcFaction.c_str()); 01543 } 01544 01545 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01546 { 01547 ESXRecordT record2 = record.get(); 01548 01549 record2.mPcFaction = data.toString().toUtf8().constData(); 01550 01551 record.setModified (record2); 01552 } 01553 01554 virtual bool isEditable() const 01555 { 01556 return true; 01557 } 01558 }; 01559 01560 template<typename ESXRecordT> 01561 struct ResponseColumn : public Column<ESXRecordT> 01562 { 01563 ResponseColumn() : Column<ESXRecordT> (Columns::ColumnId_Response, ColumnBase::Display_String) {} 01564 01565 virtual QVariant get (const Record<ESXRecordT>& record) const 01566 { 01567 return QString::fromUtf8 (record.get().mResponse.c_str()); 01568 } 01569 01570 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01571 { 01572 ESXRecordT record2 = record.get(); 01573 01574 record2.mResponse = data.toString().toUtf8().constData(); 01575 01576 record.setModified (record2); 01577 } 01578 01579 virtual bool isEditable() const 01580 { 01581 return true; 01582 } 01583 }; 01584 01585 template<typename ESXRecordT> 01586 struct DispositionColumn : public Column<ESXRecordT> 01587 { 01588 DispositionColumn() 01589 : Column<ESXRecordT> (Columns::ColumnId_Disposition, ColumnBase::Display_Integer) 01590 {} 01591 01592 virtual QVariant get (const Record<ESXRecordT>& record) const 01593 { 01594 return record.get().mData.mDisposition; 01595 } 01596 01597 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01598 { 01599 ESXRecordT record2 = record.get(); 01600 record2.mData.mDisposition = data.toInt(); 01601 record.setModified (record2); 01602 } 01603 01604 virtual bool isEditable() const 01605 { 01606 return true; 01607 } 01608 }; 01609 01610 template<typename ESXRecordT> 01611 struct RankColumn : public Column<ESXRecordT> 01612 { 01613 RankColumn() 01614 : Column<ESXRecordT> (Columns::ColumnId_Rank, ColumnBase::Display_Integer) 01615 {} 01616 01617 virtual QVariant get (const Record<ESXRecordT>& record) const 01618 { 01619 return static_cast<int> (record.get().mData.mRank); 01620 } 01621 01622 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01623 { 01624 ESXRecordT record2 = record.get(); 01625 record2.mData.mRank = static_cast<signed char> (data.toInt()); 01626 record.setModified (record2); 01627 } 01628 01629 virtual bool isEditable() const 01630 { 01631 return true; 01632 } 01633 }; 01634 01635 template<typename ESXRecordT> 01636 struct PcRankColumn : public Column<ESXRecordT> 01637 { 01638 PcRankColumn() 01639 : Column<ESXRecordT> (Columns::ColumnId_PcRank, ColumnBase::Display_Integer) 01640 {} 01641 01642 virtual QVariant get (const Record<ESXRecordT>& record) const 01643 { 01644 return static_cast<int> (record.get().mData.mPCrank); 01645 } 01646 01647 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01648 { 01649 ESXRecordT record2 = record.get(); 01650 record2.mData.mPCrank = static_cast<signed char> (data.toInt()); 01651 record.setModified (record2); 01652 } 01653 01654 virtual bool isEditable() const 01655 { 01656 return true; 01657 } 01658 }; 01659 01660 template<typename ESXRecordT> 01661 struct GenderColumn : public Column<ESXRecordT> 01662 { 01663 GenderColumn() 01664 : Column<ESXRecordT> (Columns::ColumnId_Gender, ColumnBase::Display_Gender) 01665 {} 01666 01667 virtual QVariant get (const Record<ESXRecordT>& record) const 01668 { 01669 return static_cast<int> (record.get().mData.mGender); 01670 } 01671 01672 virtual void set (Record<ESXRecordT>& record, const QVariant& data) 01673 { 01674 ESXRecordT record2 = record.get(); 01675 01676 record2.mData.mGender = data.toInt(); 01677 01678 record.setModified (record2); 01679 } 01680 01681 virtual bool isEditable() const 01682 { 01683 return true; 01684 } 01685 }; 01686 } 01687 01688 #endif