mainform.ui.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. /****************************************************************************
  2. ** ui.h extension file, included from the uic-generated form implementation.
  3. **
  4. ** If you wish to add, delete or rename slots use Qt Designer which will
  5. ** update this file, preserving your code. Create an init() slot in place of
  6. ** a constructor, and a destroy() slot in place of a destructor.
  7. *****************************************************************************/
  8. /*
  9. ktigcc - TIGCC IDE for KDE
  10. Copyright (C) 2004 Kevin Kofler
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2, or (at your option)
  14. any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software Foundation,
  21. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #include <qlabel.h>
  24. #include <qstatusbar.h>
  25. #include <qtimer.h>
  26. #include <qdatetime.h>
  27. #include <qdragobject.h>
  28. #include <cstdio>
  29. using std::puts;
  30. extern const char *tigcc_base;
  31. extern const char *quill_drv;
  32. // All the methods are inline because otherwise QT Designer will mistake them
  33. // for slots of the main form.
  34. class ListViewFolder : public QListViewItem {
  35. public:
  36. ListViewFolder(QListView *parent) : QListViewItem(parent)
  37. {
  38. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  39. setDragEnabled(TRUE);
  40. setDropEnabled(TRUE);
  41. }
  42. ListViewFolder(QListViewItem *parent) : QListViewItem(parent)
  43. {
  44. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  45. setDragEnabled(TRUE);
  46. setDropEnabled(TRUE);
  47. }
  48. ListViewFolder(QListView *parent, QListViewItem *after)
  49. : QListViewItem(parent, after)
  50. {
  51. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  52. setDropEnabled(TRUE);
  53. setDragEnabled(TRUE);
  54. }
  55. ListViewFolder(QListViewItem *parent, QListViewItem *after)
  56. : QListViewItem(parent, after)
  57. {
  58. setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  59. setDragEnabled(TRUE);
  60. setDropEnabled(TRUE);
  61. }
  62. virtual int rtti(void) const {return 0x716CC0;}
  63. virtual bool acceptDrop(const QMimeSource *mime) const {
  64. puts("folder acceptDrop called");
  65. return (mime->provides("x-ktigcc-folder")
  66. ||mime->provides("x-ktigcc-file"));
  67. }
  68. protected:
  69. virtual void dropped (QDropEvent *e) {
  70. puts("folder dropped called");
  71. }
  72. virtual void dragEnterEvent ( QDragEnterEvent * ) {
  73. puts("folder dragEnterEvent called");
  74. }
  75. };
  76. class ListViewFile : public QListViewItem {
  77. public:
  78. ListViewFile(QListView *parent) : QListViewItem(parent)
  79. {
  80. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  81. setDragEnabled(TRUE);
  82. setDropEnabled(TRUE);
  83. setRenameEnabled(0,TRUE);
  84. }
  85. ListViewFile(QListViewItem *parent) : QListViewItem(parent)
  86. {
  87. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  88. setDragEnabled(TRUE);
  89. setDropEnabled(TRUE);
  90. setRenameEnabled(0,TRUE);
  91. }
  92. ListViewFile(QListView *parent, QListViewItem *after)
  93. : QListViewItem(parent, after)
  94. {
  95. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  96. setDropEnabled(TRUE);
  97. setDragEnabled(TRUE);
  98. setRenameEnabled(0,TRUE);
  99. }
  100. ListViewFile(QListViewItem *parent, QListViewItem *after)
  101. : QListViewItem(parent, after)
  102. {
  103. setPixmap(0,QPixmap::fromMimeSource("filex.png"));
  104. setDragEnabled(TRUE);
  105. setDropEnabled(TRUE);
  106. setRenameEnabled(0,TRUE);
  107. }
  108. virtual int rtti(void) const {return 0x716CC1;}
  109. bool acceptDrop(const QMimeSource *mime) const {
  110. puts("file acceptDrop called");
  111. return (mime->provides("x-ktigcc-folder")
  112. ||mime->provides("x-ktigcc-file"));
  113. }
  114. QString textBuffer;
  115. protected:
  116. virtual void dropped (QDropEvent *e) {
  117. puts("file dropped called");
  118. }
  119. virtual void dragEnterEvent ( QDragEnterEvent * ) {
  120. puts("file dragEnterEvent called");
  121. }
  122. };
  123. // These should be instance variables in clean C++, but QT Designer won't let me
  124. // touch the class definition, so this is all I can do. And there is only one
  125. // instance of MainForm anyway.
  126. static QListViewItem *rootListItem;
  127. static QListViewItem *hFilesListItem;
  128. static QListViewItem *cFilesListItem;
  129. static QListViewItem *sFilesListItem;
  130. static QListViewItem *asmFilesListItem;
  131. static QListViewItem *qllFilesListItem;
  132. static QListViewItem *oFilesListItem;
  133. static QListViewItem *aFilesListItem;
  134. static QListViewItem *txtFilesListItem;
  135. static QListViewItem *othFilesListItem;
  136. static QListViewItem *currentListItem;
  137. static QLabel *leftStatusLabel;
  138. static QLabel *rightStatusLabel;
  139. static int fileCount=0, hFileCount=0, cFileCount=0, sFileCount=0, asmFileCount=0, qllFileCount=0, oFileCount=0, aFileCount=0, txtFileCount=0, othFileCount=0;
  140. class DnDListView : public QListView {
  141. private:
  142. public:
  143. DnDListView ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
  144. : QListView(parent,name,f) {}
  145. bool acceptDrop(const QMimeSource *mime) const {
  146. puts("acceptDrop called");
  147. return (mime->provides("x-ktigcc-folder")
  148. ||mime->provides("x-ktigcc-file"));
  149. }
  150. protected:
  151. virtual QDragObject *dragObject() {
  152. puts("dragObject called");
  153. QStoredDrag *storedDrag=new QStoredDrag("x-ktigcc-folder");
  154. QByteArray data(sizeof(QListViewItem*));
  155. data.duplicate(reinterpret_cast<char *>(&currentListItem),
  156. sizeof(QListViewItem*));
  157. storedDrag->setEncodedData(data);
  158. storedDrag->drag();
  159. puts("dragObject returning");
  160. return storedDrag;
  161. }
  162. virtual void dropped (QDropEvent *e) {
  163. puts("dropped called");
  164. }
  165. virtual void dragEnterEvent ( QDragEnterEvent * ) {
  166. puts("dragEnterEvent called");
  167. }
  168. };
  169. void MainForm::init()
  170. {
  171. fileNewFolderAction->setEnabled(FALSE);
  172. QValueList<int> list;
  173. list.append(150);
  174. list.append(500);
  175. splitter->setSizes(list);
  176. leftStatusLabel=new QLabel("0 Files Total",this);
  177. leftStatusLabel->setMaximumWidth(splitter->sizes().first());
  178. statusBar()->addWidget(leftStatusLabel,1);
  179. rightStatusLabel=new QLabel("",this);
  180. rightStatusLabel->setMaximumWidth(splitter->sizes().last());
  181. statusBar()->addWidget(rightStatusLabel,1);
  182. statusBar()->setSizeGripEnabled(FALSE);
  183. fileTree->setSorting(-1);
  184. fileTree->setColumnWidthMode(0,QListView::Maximum);
  185. rootListItem=new QListViewItem(fileTree);
  186. rootListItem->setText(0,"Project1");
  187. rootListItem->setPixmap(0,QPixmap::fromMimeSource("tpr.png"));
  188. rootListItem->setOpen(TRUE);
  189. rootListItem->setDragEnabled(TRUE);
  190. QListViewItem *folderListItem=new ListViewFolder(rootListItem);
  191. hFilesListItem=folderListItem;
  192. folderListItem->setText(0,"Header Files");
  193. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  194. cFilesListItem=folderListItem;
  195. folderListItem->setText(0,"C Files");
  196. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  197. sFilesListItem=folderListItem;
  198. folderListItem->setText(0,"GNU Assembly Files");
  199. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  200. asmFilesListItem=folderListItem;
  201. folderListItem->setText(0,"A68k Assembly Files");
  202. if (quill_drv) {
  203. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  204. qllFilesListItem=folderListItem;
  205. folderListItem->setText(0,"Quill Files");
  206. } else {
  207. qllFilesListItem=NULL;
  208. fileNewQuillSourceFileAction->setVisible(FALSE);
  209. }
  210. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  211. oFilesListItem=folderListItem;
  212. folderListItem->setText(0,"Object Files");
  213. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  214. aFilesListItem=folderListItem;
  215. folderListItem->setText(0,"Archive Files");
  216. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  217. txtFilesListItem=folderListItem;
  218. folderListItem->setText(0,"Text Files");
  219. folderListItem=new ListViewFolder(rootListItem,folderListItem);
  220. othFilesListItem=folderListItem;
  221. folderListItem->setText(0,"Other Files");
  222. startTimer(100);
  223. }
  224. void MainForm::fileNewProject()
  225. {
  226. rootListItem->setText(0,"Project1");
  227. fileTreeClicked(rootListItem);
  228. QListViewItem *f, *next;
  229. for (f=hFilesListItem->firstChild();f;f=next) {
  230. next=f->nextSibling();
  231. delete f;
  232. }
  233. for (f=cFilesListItem->firstChild();f;f=next) {
  234. next=f->nextSibling();
  235. delete f;
  236. }
  237. for (f=sFilesListItem->firstChild();f;f=next) {
  238. next=f->nextSibling();
  239. delete f;
  240. }
  241. for (f=asmFilesListItem->firstChild();f;f=next) {
  242. next=f->nextSibling();
  243. delete f;
  244. }
  245. if (qllFilesListItem) {
  246. for (f=qllFilesListItem->firstChild();f;f=next) {
  247. next=f->nextSibling();
  248. delete f;
  249. }
  250. }
  251. for (f=oFilesListItem->firstChild();f;f=next) {
  252. next=f->nextSibling();
  253. delete f;
  254. }
  255. for (f=aFilesListItem->firstChild();f;f=next) {
  256. next=f->nextSibling();
  257. delete f;
  258. }
  259. for (f=txtFilesListItem->firstChild();f;f=next) {
  260. next=f->nextSibling();
  261. delete f;
  262. }
  263. for (f=othFilesListItem->firstChild();f;f=next) {
  264. next=f->nextSibling();
  265. delete f;
  266. }
  267. fileCount=cFileCount=hFileCount=sFileCount=asmFileCount=qllFileCount=oFileCount=aFileCount=txtFileCount=othFileCount=0;
  268. updateLeftStatusLabel();
  269. }
  270. void MainForm::fileOpen()
  271. {
  272. }
  273. void MainForm::fileSave()
  274. {
  275. }
  276. void MainForm::fileSaveAs()
  277. {
  278. }
  279. void MainForm::filePrint()
  280. {
  281. }
  282. void MainForm::fileExit()
  283. {
  284. }
  285. void MainForm::editUndo()
  286. {
  287. }
  288. void MainForm::editRedo()
  289. {
  290. }
  291. void MainForm::editCut()
  292. {
  293. }
  294. void MainForm::editCopy()
  295. {
  296. }
  297. void MainForm::editPaste()
  298. {
  299. }
  300. void MainForm::editFind()
  301. {
  302. }
  303. void MainForm::helpIndex()
  304. {
  305. }
  306. void MainForm::helpContents()
  307. {
  308. }
  309. void MainForm::helpAbout()
  310. {
  311. }
  312. void MainForm::updateSizes()
  313. {
  314. int leftSize=splitter->sizes().first();
  315. int rightSize=splitter->sizes().last();
  316. int totalSize=leftSize+rightSize;
  317. int mySize=size().width();
  318. leftStatusLabel->setMaximumWidth(leftSize*mySize/totalSize);
  319. rightStatusLabel->setMaximumWidth(rightSize*mySize/totalSize-10>0?
  320. rightSize*mySize/totalSize-10:0);
  321. }
  322. void MainForm::resizeEvent(QResizeEvent *event)
  323. {
  324. QMainWindow::resizeEvent(event);
  325. if (event->size()==event->oldSize()) return;
  326. updateSizes();
  327. }
  328. void MainForm::timerEvent(QTimerEvent *event)
  329. {
  330. static int lastSplitterPos=-1;
  331. QMainWindow::timerEvent(event);
  332. if (lastSplitterPos==splitter->sizes().first()) return;
  333. lastSplitterPos=splitter->sizes().first();
  334. updateSizes();
  335. }
  336. void MainForm::fileTreeClicked(QListViewItem *item)
  337. {
  338. if (!item) return;
  339. if (currentListItem && currentListItem->rtti()==0x716CC0)
  340. currentListItem->setPixmap(0,QPixmap::fromMimeSource("folder1.png"));
  341. if (currentListItem && currentListItem->rtti()==0x716CC1)
  342. static_cast<ListViewFile *>(currentListItem)->textBuffer=kTextEdit1->text();
  343. if (item->rtti()==0x716CC0) {
  344. item->setPixmap(0,QPixmap::fromMimeSource("folder2.png"));
  345. fileNewFolderAction->setEnabled(TRUE);
  346. kTextEdit1->setEnabled(FALSE);
  347. kTextEdit1->setText("");
  348. kTextEdit1->setPaletteBackgroundColor(QColor(230,230,230));
  349. } else if (item->rtti()==0x716CC1) {
  350. fileNewFolderAction->setEnabled(TRUE);
  351. kTextEdit1->setEnabled(TRUE);
  352. kTextEdit1->setText(static_cast<ListViewFile *>(item)->textBuffer);
  353. kTextEdit1->setPaletteBackgroundColor(QColor(255,255,255));
  354. } else {
  355. fileNewFolderAction->setEnabled(FALSE);
  356. kTextEdit1->setText("");
  357. kTextEdit1->setPaletteBackgroundColor(QColor(230,230,230));
  358. }
  359. currentListItem=item;
  360. updateLeftStatusLabel();
  361. }
  362. void MainForm::fileNewFolder()
  363. {
  364. if (currentListItem->rtti()==0x716CC1)
  365. currentListItem=currentListItem->parent();
  366. QListViewItem *item=NULL, *next=currentListItem->firstChild();
  367. for (; next && next->rtti()==0x716CC0; next=item->nextSibling())
  368. item=next;
  369. QListViewItem *newFolder=item?new ListViewFolder(currentListItem,item)
  370. :new ListViewFolder(currentListItem);
  371. newFolder->setText(0,"NewFolder");
  372. newFolder->setRenameEnabled(0,TRUE);
  373. currentListItem->setOpen(TRUE);
  374. fileTreeClicked(newFolder);
  375. newFolder->startRename(0);
  376. }
  377. #define unused_col __attribute__((unused)) col /* stupid QT designer... */
  378. void MainForm::fileTreeContextMenuRequested(QListViewItem *item,
  379. const QPoint &pos,
  380. int unused_col)
  381. {
  382. fileTreeClicked(item);
  383. if (item && item->rtti()==0x716CC0) {
  384. QPopupMenu menu;
  385. menu.insertItem("New &Folder",0);
  386. menu.insertItem("New F&ile",1);
  387. QListViewItem *category=item;
  388. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  389. if (category==oFilesListItem || category==aFilesListItem
  390. || category==othFilesListItem) menu.setItemEnabled(1,FALSE);
  391. if (!(item==hFilesListItem || item==cFilesListItem || item==sFilesListItem
  392. || item==asmFilesListItem || item && item==qllFilesListItem
  393. || item==oFilesListItem || item==aFilesListItem
  394. || item==txtFilesListItem || item==othFilesListItem)) {
  395. menu.insertSeparator();
  396. menu.insertItem("&Remove",2);
  397. menu.insertItem("Re&name",3);
  398. }
  399. switch (menu.exec(pos)) {
  400. case 0:
  401. fileNewFolder();
  402. break;
  403. case 1:
  404. newFile(item);
  405. break;
  406. case 2:
  407. delete item;
  408. currentListItem=NULL;
  409. fileTreeClicked(fileTree->currentItem());
  410. break;
  411. case 3:
  412. item->startRename(0);
  413. }
  414. }
  415. }
  416. void MainForm::newFile( QListViewItem *parent, QString text, const char *iconName )
  417. {
  418. QListViewItem *item=NULL, *next=parent->firstChild();
  419. for (; next; next=item->nextSibling())
  420. item=next;
  421. ListViewFile *newFile=item?new ListViewFile(parent,item)
  422. :new ListViewFile(parent);
  423. newFile->setText(0,"New File");
  424. newFile->setPixmap(0,QPixmap::fromMimeSource(iconName));
  425. parent->setOpen(TRUE);
  426. fileTreeClicked(newFile);
  427. newFile->startRename(0);
  428. kTextEdit1->setText(text);
  429. fileCount++;
  430. QListViewItem *category=parent;
  431. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  432. (category==hFilesListItem?hFileCount:category==cFilesListItem?cFileCount:
  433. category==sFilesListItem?sFileCount:category==asmFilesListItem?asmFileCount:
  434. category==qllFilesListItem?qllFileCount:category==oFilesListItem?oFileCount:
  435. category==aFilesListItem?aFileCount:category==txtFilesListItem?txtFileCount:
  436. othFileCount)++;
  437. updateLeftStatusLabel();
  438. }
  439. void MainForm::newFile( QListViewItem *parent )
  440. {
  441. QListViewItem *category=parent;
  442. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  443. newFile(parent,category==txtFilesListItem?"":
  444. ((category==hFilesListItem?"// Header File\n//":
  445. category==cFilesListItem?"// C Source File\n//":
  446. category==sFilesListItem?"| Assembly Source File\n|":
  447. category==asmFilesListItem?"; Assembly Source File\n;":
  448. category==qllFilesListItem?"// Quill Source File\n//":"???\n")
  449. +QString(" Created ")
  450. +QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n"+
  451. QString(category==cFilesListItem?(cFileCount?
  452. "\n#include <tigcclib.h>\n":
  453. "\n// Delete or comment out the items you do not need.\n"
  454. "#define COMMENT_STRING \"Place your comment here.\"\n"
  455. "#define COMMENT_PROGRAM_NAME "
  456. "\"Place your program name here.\"\n"
  457. "#define COMMENT_VERSION_STRING "
  458. "\"Place your version string here.\"\n"
  459. "#define COMMENT_VERSION_NUMBER 0,0,0,0 "
  460. "/* major, minor, revision, subrevision */\n"
  461. "#define COMMENT_BW_ICON \\\n"
  462. "\t{0b0000000000000000, \\\n"
  463. "\t 0b0000000000000000, \\\n"
  464. "\t 0b0000000000000000, \\\n"
  465. "\t 0b0000000000000000, \\\n"
  466. "\t 0b0000000000000000, \\\n"
  467. "\t 0b0000000000000000, \\\n"
  468. "\t 0b0000000000000000, \\\n"
  469. "\t 0b0000000000000000, \\\n"
  470. "\t 0b0000000000000000, \\\n"
  471. "\t 0b0000000000000000, \\\n"
  472. "\t 0b0000000000000000, \\\n"
  473. "\t 0b0000000000000000, \\\n"
  474. "\t 0b0000000000000000, \\\n"
  475. "\t 0b0000000000000000, \\\n"
  476. "\t 0b0000000000000000, \\\n"
  477. "\t 0b0000000000000000}\n"
  478. "#define COMMENT_GRAY_ICON \\\n"
  479. "\t{0b0000000000000000, \\\n"
  480. "\t 0b0000000000000000, \\\n"
  481. "\t 0b0000000000000000, \\\n"
  482. "\t 0b0000000000000000, \\\n"
  483. "\t 0b0000000000000000, \\\n"
  484. "\t 0b0000000000000000, \\\n"
  485. "\t 0b0000000000000000, \\\n"
  486. "\t 0b0000000000000000, \\\n"
  487. "\t 0b0000000000000000, \\\n"
  488. "\t 0b0000000000000000, \\\n"
  489. "\t 0b0000000000000000, \\\n"
  490. "\t 0b0000000000000000, \\\n"
  491. "\t 0b0000000000000000, \\\n"
  492. "\t 0b0000000000000000, \\\n"
  493. "\t 0b0000000000000000, \\\n"
  494. "\t 0b0000000000000000},\n"
  495. "\t{0b0000000000000000, \\\n"
  496. "\t 0b0000000000000000, \\\n"
  497. "\t 0b0000000000000000, \\\n"
  498. "\t 0b0000000000000000, \\\n"
  499. "\t 0b0000000000000000, \\\n"
  500. "\t 0b0000000000000000, \\\n"
  501. "\t 0b0000000000000000, \\\n"
  502. "\t 0b0000000000000000, \\\n"
  503. "\t 0b0000000000000000, \\\n"
  504. "\t 0b0000000000000000, \\\n"
  505. "\t 0b0000000000000000, \\\n"
  506. "\t 0b0000000000000000, \\\n"
  507. "\t 0b0000000000000000, \\\n"
  508. "\t 0b0000000000000000, \\\n"
  509. "\t 0b0000000000000000, \\\n"
  510. "\t 0b0000000000000000}\n\n#include <tigcclib.h>\n\n"
  511. "// Main Function\nvoid _main(void)\n{\n"
  512. "\t// Place your code here.\n}\n"):"")),
  513. category==cFilesListItem||category==qllFilesListItem
  514. ?"filec.png":
  515. category==hFilesListItem?"fileh.png":
  516. category==sFilesListItem||category==asmFilesListItem
  517. ?"files.png":
  518. category==txtFilesListItem?"filet.png":"filex.png");
  519. }
  520. void MainForm::fileNewCHeader()
  521. {
  522. newFile(hFilesListItem,"// Header File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  523. }
  524. void MainForm::fileNewGNUAssemblyHeader()
  525. {
  526. newFile(hFilesListItem,"| Header File\n| Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  527. }
  528. void MainForm::fileNewA68kAssemblyHeader()
  529. {
  530. newFile(hFilesListItem,"; Header File\n; Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","fileh.png");
  531. }
  532. void MainForm::fileNewCSourceFile()
  533. {
  534. newFile(cFilesListItem,"// C Source File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","filec.png");
  535. }
  536. void MainForm::fileNewGNUAssemblySourceFile()
  537. {
  538. newFile(sFilesListItem,"| Assembly Source File\n| Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","files.png");
  539. }
  540. void MainForm::fileNewA68kAssemblySourceFile()
  541. {
  542. newFile(asmFilesListItem,"; Assembly Source File\n; Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","files.png");
  543. }
  544. void MainForm::fileNewQuillSourceFile()
  545. {
  546. newFile(qllFilesListItem,"// Quill Source File\n// Created "+QDateTime::currentDateTime ().toString(Qt::LocalDate)+"\n","filec.png");
  547. }
  548. void MainForm::fileNewTextFile()
  549. {
  550. newFile(txtFilesListItem,"","filet.png");
  551. }
  552. void MainForm::updateLeftStatusLabel()
  553. {
  554. QString text=QString::number(fileCount)+QString(" File")
  555. +QString(fileCount!=1?"s":"")+QString(" Total");
  556. QListViewItem *category=currentListItem;
  557. if (currentListItem->rtti()==0x716CC0||currentListItem->rtti()==0x716CC1) {
  558. while (category->parent()->rtti()==0x716CC0) category=category->parent();
  559. text+=QString(", ")+QString::number(category==hFilesListItem?hFileCount:
  560. category==cFilesListItem?cFileCount:
  561. category==sFilesListItem?sFileCount:
  562. category==asmFilesListItem?asmFileCount:
  563. category==qllFilesListItem?qllFileCount:
  564. category==oFilesListItem?oFileCount:
  565. category==aFilesListItem?aFileCount:
  566. category==txtFilesListItem?txtFileCount:
  567. othFileCount)
  568. +QString(" in Category");
  569. }
  570. leftStatusLabel->setText(text);
  571. }
  572. // Yes, this is an ugly hack... Any better suggestions?
  573. #define QListView DnDListView