DELTA 26542 0 180
SVN  +O c  jW t7unitunit *unitENDREP
DELTA
SVN   ŪŪŪ/********************************************************************** 
 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

// Qt
#include <QGridLayout>
#include <QLineEdit>
#include <QListWidget>
#include <QMenu>
#include <QPushButton>
#include <QToolButton>

// utility
#include "fcintl.h"
#include "log.h"

// common
#include "game.h"
#include "unittype.h"

// ruledit
#include "ruledit.h"
#include "ruledit_qt.h"
#include "validity.h"

#include "tab_unit.h"

/**************************************************************************
  Setup tab_building object
**************************************************************************/
tab_unit::tab_unit(ruledit_gui *ui_in) : QWidget()
{
  QVBoxLayout *main_layout = new QVBoxLayout(this);
  QGridLayout *unit_layout = new QGridLayout();
  QLabel *label;
  QPushButton *add_button;
  QPushButton *delete_button;

  ui = ui_in;
  selected = 0;

  unit_list = new QListWidget(this);

  connect(unit_list, SIGNAL(itemSelectionChanged()), this, SLOT(select_unit()));
  main_layout->addWidget(unit_list);

  unit_layout->setSizeConstraint(QLayout::SetMaximumSize);

  label = new QLabel(R__("Name"));
  label->setParent(this);
  name = new QLineEdit(this);
  name->setText("None");
  connect(name, SIGNAL(returnPressed()), this, SLOT(name_given()));
  unit_layout->addWidget(label, 0, 0);
  unit_layout->addWidget(name, 0, 1);

  label = new QLabel(R__("Rule Name"));
  label->setParent(this);
  rname = new QLineEdit(this);
  rname->setText("None");
  connect(rname, SIGNAL(returnPressed()), this, SLOT(name_given()));
  unit_layout->addWidget(label, 1, 0);
  unit_layout->addWidget(rname, 1, 1);

  add_button = new QPushButton(R__("Add Unit"), this);
  connect(add_button, SIGNAL(pressed()), this, SLOT(add_now()));
  unit_layout->addWidget(add_button, 5, 0);
  show_experimental(add_button);

  delete_button = new QPushButton(R__("Remove this Unit"), this);
  connect(delete_button, SIGNAL(pressed()), this, SLOT(delete_now()));
  unit_layout->addWidget(delete_button, 5, 1);
  show_experimental(delete_button);

  refresh();

  main_layout->addLayout(unit_layout);

  setLayout(main_layout);
}

/**************************************************************************
  Refresh the information.
**************************************************************************/
void tab_unit::refresh()
{
  unit_list->clear();

  unit_type_iterate(ptype) {
    QListWidgetItem *item = new QListWidgetItem(utype_rule_name(ptype));

    unit_list->insertItem(utype_index(ptype), item);
  } unit_type_iterate_end;
}

/**************************************************************************
  Update info of the unit
**************************************************************************/
void tab_unit::update_unit_info(struct unit_type *ptype)
{
  selected = ptype;

  if (selected != 0) {
    name->setText(untranslated_name(&(ptype->name)));
    rname->setText(utype_rule_name(ptype));
  } else {
    name->setText("None");
    rname->setText("None");
  }
}

/**************************************************************************
  User selected unit from the list.
**************************************************************************/
void tab_unit::select_unit()
{
  QList<QListWidgetItem *> select_list = unit_list->selectedItems();

  if (!select_list.isEmpty()) {
    update_unit_info(unit_type_by_rule_name(select_list.at(0)->text().toUtf8().data()));
  }
}

/**************************************************************************
  User entered name for the unit
**************************************************************************/
void tab_unit::name_given()
{
  if (selected != nullptr) {
    names_set(&(selected->name), 0,
              name->text().toUtf8().data(),
              rname->text().toUtf8().data());
    refresh();
  }
}

/**************************************************************************
  User requested unit deletion 
**************************************************************************/
void tab_unit::delete_now()
{
#if 0
  ui->clear_required(advance_rule_name(selected));
  if (is_tech_needed(selected, &ruledit_qt_display_requirers)) {
    return;
  }

  selected->require[AR_ONE] = A_NEVER;
#endif

  refresh();
  update_unit_info(0);
}

/**************************************************************************
  Initialize new tech for use.
**************************************************************************/
void tab_unit::initialize_new_unit(struct unit_type *ptype)
{
  name_set(&(ptype->name), "None", "None");
}

/**************************************************************************
  User requested new unit
**************************************************************************/
void tab_unit::add_now()
{
#if 0
  struct advance *new_adv;

  /* Try to reuse freed tech slot */
  advance_iterate(A_FIRST, padv) {
    if (padv->require[AR_ONE] == A_NEVER) {
      initialize_new_tech(padv);
      update_tech_info(padv);
      refresh();
      return;
    }
  } advance_iterate_end;

  /* Try to add completely new tech */
  if (game.control.num_tech_types >= A_LAST) {
    return;
  }

  new_adv = advance_by_number(game.control.num_tech_types++);
  initialize_new_bldg(new_adv);
  update_tech_info(new_adv);
#endif

  refresh();
}
ENDREP
DELTA 26542 6246 495
SVN  e3E   <Đ J \
            meta_tab_unit                tab_unit.cpp	\
		tab_unitENDREP
DELTA
SVN   eee/********************************************************************** 
 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifndef FC__TAB_UNIT_H
#define FC__TAB_UNIT_H

#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

// Qt
#include <QWidget>

class QLineEdit;
class QListWidget;

class ruledit_gui;

class tab_unit : public QWidget
{
  Q_OBJECT

  public:
    explicit tab_unit(ruledit_gui *ui_in);
    void refresh();

  private:
    ruledit_gui *ui;
    void update_unit_info(struct unit_type *ptype);
    void initialize_new_unit(struct unit_type *ptype);

    QLineEdit *name;
    QLineEdit *rname;
    QListWidget *unit_list;

    struct unit_type *selected;

  private slots:
    void name_given();
    void select_unit();
    void add_now();
    void delete_now();
};


#endif // FC__TAB_UNIT_H
ENDREP
DELTA 26154 0 4936
SVN  Â/ÄA t b M& sĪlZ  ĩbuilding.h"
#include "tab_misc.h"
#include "tab_nation.h"
#include "tab_tech.h"
#include "tab_unitbldg = new tab_building(this);
  stack->addTab(bldg, R__("Buildings"));
  unit = new tab_unit(this);
  stack->addTab(unit, R__("Unitsbldg->refresh();
    misc->refresh();
    nation->refresh();
    tech->refresh();
    unitENDREP
id: uys.5js.r26621/7926
type: file
pred: uys.5js.r26542/8925
count: 7
text: 26621 0 41 1871 5a7a42bc4f13bd9eaa03256f59ff07f6
cpath: /trunk/tools/ruledit/ruledit_qt.h
copyroot: 21464 /trunk/tools

id: sso.5js.r26621/8122
type: file
pred: sso.5js.r26542/8523
count: 13
text: 26621 6009 96 1203 365b15a4102bc1b3b624fb46defbdc21
cpath: /trunk/tools/ruledit/Makefile.am
copyroot: 21464 /trunk/tools

id: 1ej0.5js.r26621/8321
type: file
count: 0
text: 26621 66 5930 5916 d4f6da08e7e9275cd16532b987aafbf9
cpath: /trunk/tools/ruledit/tab_unit.cpp
copyroot: 21464 /trunk/tools

id: 1ej2.5js.r26621/8495
type: file
count: 0
text: 26621 6133 1395 1381 adeadd239784bcb6f6ae1d3b7020d550
cpath: /trunk/tools/ruledit/tab_unit.h
copyroot: 21464 /trunk/tools

id: uyr.5js.r26621/8669
type: file
pred: uyr.5js.r26542/8723
count: 10
text: 26621 7541 359 8725 435bf01957ac7ed7bb04267d1aeca0c1
cpath: /trunk/tools/ruledit/ruledit_qt.cpp
copyroot: 21464 /trunk/tools

PLAIN
K 11
Makefile.am
V 24
file sso.5js.r26621/8122
K 17
requirers_dlg.cpp
V 25
file 1942.5js.r25790/3689
K 15
requirers_dlg.h
V 25
file 1944.5js.r25790/3867
K 11
ruledit.cpp
V 24
file ssq.5m2.r26103/7729
K 9
ruledit.h
V 24
file uyp.5js.r26103/8147
K 14
ruledit_qt.cpp
V 24
file uyr.5js.r26621/8669
K 12
ruledit_qt.h
V 24
file uys.5js.r26621/7926
K 10
rulesave.c
V 24
file thd.5js.r26605/9795
K 10
rulesave.h
V 24
file thf.5js.r25650/7915
K 16
tab_building.cpp
V 25
file 1dyi.5js.r26605/9390
K 14
tab_building.h
V 25
file 1dyk.5js.r26605/9995
K 12
tab_misc.cpp
V 23
file vcq.5js.r25729/728
K 10
tab_misc.h
V 24
file vcs.5js.r25650/7518
K 14
tab_nation.cpp
V 25
file 18bk.5js.r25650/8316
K 12
tab_nation.h
V 25
file 18bm.5js.r25650/7144
K 12
tab_tech.cpp
V 23
file vct.5js.r26515/221
K 10
tab_tech.h
V 24
file vcu.5js.r24948/9337
K 12
tab_unit.cpp
V 25
file 1ej0.5js.r26621/8321
K 10
tab_unit.h
V 25
file 1ej2.5js.r26621/8495
K 10
validity.c
V 25
file 1402.5js.r26605/9596
K 10
validity.h
V 26
file 1404.5js.r26605/10199
END
ENDREP
id: ssm.5js.r26621/9904
type: dir
pred: ssm.5js.r26605/11336
count: 91
text: 26621 8872 1019 1019 666bb0761ca0ce6764496e63015f60c4
props: 24238 799 125 0 7fe4abae77ea160c7595b9a9ec251e53
cpath: /trunk/tools/ruledit
copyroot: 21464 /trunk/tools

PLAIN
K 11
Makefile.am
V 24
file 4pk.5js.r25961/6125
K 11
civmanual.c
V 23
file 2m5.5jt.r26251/164
K 10
download.c
V 22
file 4pl.5js.r24802/49
K 10
download.h
V 25
file 4pm.5js.r24756/10690
K 9
modinst.c
V 24
file bj7.5ck.r21139/5112
K 9
modinst.h
V 24
file 76i.5js.r24986/3800
K 7
mpcli.c
V 24
file y74.5js.r26143/3015
K 11
mpcmdline.c
V 24
file 73v.5js.r24286/1008
K 11
mpcmdline.h
V 25
file 73w.5ck.r20760/16287
K 6
mpdb.c
V 23
file bjc.5ck.r21142/258
K 6
mpdb.h
V 24
file bje.5ck.r20961/5129
K 12
mpgui_gtk2.c
V 24
file 4pn.5lm.r26143/3200
K 12
mpgui_gtk3.c
V 24
file 4pn.5ln.r26143/3407
K 12
mpgui_qt.cpp
V 24
file a65.5js.r26143/2821
K 10
mpgui_qt.h
V 25
file a67.5js.r24225/10956
K 19
mpgui_qt_worker.cpp
V 24
file vuz.5js.r23875/3825
K 17
mpgui_qt_worker.h
V 24
file vv1.5js.r23868/2651
K 7
ruledit
V 23
dir ssm.5js.r26621/9904
END
ENDREP
id: 4pj.5js.r26621/10996
type: dir
pred: 4pj.5js.r26605/12429
count: 216
text: 26621 10149 834 834 12b5f0554ad13d0d199470abb4f60d0c
props: 25526 0 300 0 6fd3530dab91e62ecb398957a0a66b2e
cpath: /trunk/tools
copyroot: 21464 /trunk/tools

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r23462/85000
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 19
file 1h.0.r9643/400
K 9
ChangeLog
V 26
file 6l.5ck.r22811/6091752
K 7
INSTALL
V 22
file 6.5ck.r26104/4084
K 11
Makefile.am
V 24
file 59.5ck.r25866/38855
K 4
NEWS
V 24
file 6m.5ck.r25634/30702
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 22
dir 8.5ck.r26599/16453
K 10
autogen.sh
V 24
file 12o.5ck.r25794/4003
K 9
bootstrap
V 23
dir 2p5.5ck.r26519/2055
K 6
client
V 22
dir d.5ck.r26620/18483
K 6
common
V 21
dir p.5ck.r26606/8216
K 12
configure.ac
V 23
file 149.5ck.r26582/983
K 4
data
V 21
dir w.5ck.r26619/7079
K 12
dependencies
V 25
dir 2yu.5ck.r25888/631324
K 11
diff_ignore
V 23
file qq.5ck.r24665/2850
K 3
doc
V 22
dir k7.5ck.r26619/2318
K 10
fc_version
V 25
file 2lo.5en.r26603/11523
K 2
m4
V 24
dir 12p.5ck.r26568/11344
K 7
scripts
V 23
dir 2yo.5ck.r26112/1112
K 6
server
V 21
dir z.5ck.r26609/9314
K 5
tests
V 22
dir 2g9.5ck.r25379/673
K 5
tools
V 24
dir 4pj.5js.r26621/10996
K 12
translations
V 23
dir t0a.5ck.r26573/8238
K 7
utility
V 22
dir 1c.5ck.r26611/3790
K 3
vms
V 25
dir u9.5ck.r21528/1396085
K 5
win32
V 23
dir 2eu.5ck.r25498/1618
END
ENDREP
id: 3.5ck.r26621/12402
type: dir
pred: 3.5ck.r26620/19885
count: 18369
text: 26621 11232 1157 1157 98cee6b3a2efd0c788cfec587d5bb4ab
props: 23244 4830 282 0 e4bb46e81629a60eef613b169b23a9ea
cpath: /trunk
copyroot: 15280 /trunk

PLAIN
K 8
branches
V 19
dir 1.0.r26618/5844
K 4
tags
V 19
dir 2.0.r25885/6524
K 5
trunk
V 22
dir 3.5ck.r26621/12402
K 7
website
V 21
dir 3ge.0.r22980/2263
END
ENDREP
id: 0.0.r26621/12795
type: dir
pred: 0.0.r26620/20277
count: 26621
text: 26621 12629 153 153 4d2b3006ca260c3c785e47cb3bd83cf9
cpath: /
copyroot: 0 /

sso.5js.t26620-1 modify true false /trunk/tools/ruledit/Makefile.am

_5.5js.t26620-1 add true false /trunk/tools/ruledit/tab_unit.h

uyr.5js.t26620-1 modify true false /trunk/tools/ruledit/ruledit_qt.cpp

uys.5js.t26620-1 modify true false /trunk/tools/ruledit/ruledit_qt.h

_3.5js.t26620-1 add true false /trunk/tools/ruledit/tab_unit.cpp


12795 12945
